Skip to content

Commit 201f29f

Browse files
author
epriestley
committed
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
1 parent 91abc0f commit 201f29f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,18 @@ public function didExecute(PhutilArgumentParser $args) {
5656
->setShowHeader(false)
5757
->setPadding(2)
5858
->addColumn('name', array('title' => pht('Database / Table')))
59-
->addColumn('size', array('title' => pht('Size')))
60-
->addColumn('percentage', array('title' => pht('Percentage')));
59+
->addColumn(
60+
'size',
61+
array(
62+
'title' => pht('Size'),
63+
'align' => PhutilConsoleTable::ALIGN_RIGHT,
64+
))
65+
->addColumn(
66+
'percentage',
67+
array(
68+
'title' => pht('Percentage'),
69+
'align' => PhutilConsoleTable::ALIGN_RIGHT,
70+
));
6171

6272
foreach ($totals as $db => $size) {
6373
list($database_size, $database_percentage) = $this->formatSize(
@@ -98,7 +108,7 @@ public function didExecute(PhutilArgumentParser $args) {
98108

99109
private function formatSize($n, $o) {
100110
return array(
101-
sprintf('%8.8s MB', number_format($n / (1024 * 1024), 1)),
111+
pht('%s MB', new PhutilNumber($n / (1024 * 1024), 1)),
102112
sprintf('%3.1f%%', 100 * ($n / $o)),
103113
);
104114
}

0 commit comments

Comments
 (0)