From 201f29fbf4ab74a2cd41433c4ba57c77d64e4e6e Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 8 Aug 2018 09:24:48 -0700 Subject: [PATCH] Fix truncation in "bin/storage probe" of tables larger than 100GB Summary: Ref T13164. PHI805 incidentally includes some `bin/storage probe` output for 100GB+ tables which renders wrong. We have the tools to render it properly, so stop doing this manually and let ConsoleTable figure out the alignment. Test Plan: Faked very large table sizes, ran `bin/storage probe`: {F5785946} (Then, un-faked the very large table sizes and ran it again, got sensible output.) Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13164 Differential Revision: https://secure.phabricator.com/D19567 --- ...PhabricatorStorageManagementProbeWorkflow.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php index a75afe69e8..5c55dc779e 100644 --- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php +++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php @@ -56,8 +56,18 @@ final class PhabricatorStorageManagementProbeWorkflow ->setShowHeader(false) ->setPadding(2) ->addColumn('name', array('title' => pht('Database / Table'))) - ->addColumn('size', array('title' => pht('Size'))) - ->addColumn('percentage', array('title' => pht('Percentage'))); + ->addColumn( + 'size', + array( + 'title' => pht('Size'), + 'align' => PhutilConsoleTable::ALIGN_RIGHT, + )) + ->addColumn( + 'percentage', + array( + 'title' => pht('Percentage'), + 'align' => PhutilConsoleTable::ALIGN_RIGHT, + )); foreach ($totals as $db => $size) { list($database_size, $database_percentage) = $this->formatSize( @@ -98,7 +108,7 @@ final class PhabricatorStorageManagementProbeWorkflow private function formatSize($n, $o) { return array( - sprintf('%8.8s MB', number_format($n / (1024 * 1024), 1)), + pht('%s MB', new PhutilNumber($n / (1024 * 1024), 1)), sprintf('%3.1f%%', 100 * ($n / $o)), ); }