1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Correct bin/storage analyze internal API for cluster environments

Summary:
Ref T12819. This worked right in a non-cluster environment, but `bin/storage upgrade` iterates over each master in a partitioned cluster environment.

Tweak the API so `bin/storage analyze` targets a single host but `bin/storage upgrade` can hit all the masters.

Test Plan: Will run `bin/storage upgrade` in production again. Ran `upgrade` and `analyze` locally, still work fine.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12819

Differential Revision: https://secure.phabricator.com/D18576
This commit is contained in:
epriestley 2017-09-07 14:52:38 -07:00
parent a46a9ff165
commit 4cae4a3b76
2 changed files with 6 additions and 4 deletions

View file

@ -12,7 +12,8 @@ final class PhabricatorStorageManagementAnalyzeWorkflow
}
public function didExecute(PhutilArgumentParser $args) {
$this->analyzeTables();
$api = $this->getSingleAPI();
$this->analyzeTables($api);
return 0;
}

View file

@ -143,7 +143,7 @@ abstract class PhabricatorStorageManagementWorkflow
if (!$this->dryRun) {
$should_analyze = (($err == 0) || ($err == 2));
if ($should_analyze) {
$this->analyzeTables();
$this->analyzeTables($api);
}
}
} catch (Exception $ex) {
@ -1172,12 +1172,13 @@ abstract class PhabricatorStorageManagementWorkflow
->lock();
}
final protected function analyzeTables() {
final protected function analyzeTables(
PhabricatorStorageManagementAPI $api) {
// Analyzing tables can sometimes have a significant effect on query
// performance, particularly for the fulltext ngrams tables. See T12819
// for some specific examples.
$api = $this->getSingleAPI();
$conn = $api->getConn(null);
$patches = $this->getPatches();