mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Update table schema for "AffectedPath" table
Summary: Ref T13639. Make schema changes: - Make repositoryID nullable, for revisions with no repository. - Remove "epoch", which has no readers and no clear use. - Change the ordering of the key, since "pathID" has more unique values and no queries ever issue without it. Test Plan: - Ran `bin/storage upgrade`, got a clean schema. - Reindexed all revisions with an external script. - Reviewed index via debug UI, saw appropriate index for non-repositoy revisions. Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13639 Differential Revision: https://secure.phabricator.com/D21617
This commit is contained in:
parent
38ef910da8
commit
01ea84029d
4 changed files with 11 additions and 8 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_differential.differential_affectedpath
|
||||||
|
DROP epoch;
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_differential.differential_affectedpath
|
||||||
|
CHANGE repositoryID repositoryID INT UNSIGNED;
|
|
@ -32,7 +32,7 @@ final class DifferentialAffectedPathEngine
|
||||||
if ($repository) {
|
if ($repository) {
|
||||||
$repository_id = $repository->getID();
|
$repository_id = $repository->getID();
|
||||||
} else {
|
} else {
|
||||||
return;
|
$repository_id = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$paths = $this->getAffectedPaths();
|
$paths = $this->getAffectedPaths();
|
||||||
|
@ -48,10 +48,9 @@ final class DifferentialAffectedPathEngine
|
||||||
foreach ($path_ids as $path_id) {
|
foreach ($path_ids as $path_id) {
|
||||||
$sql[] = qsprintf(
|
$sql[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'(%d, %d, %d, %d)',
|
'(%nd, %d, %d)',
|
||||||
$repository_id,
|
$repository_id,
|
||||||
$path_id,
|
$path_id,
|
||||||
PhabricatorTime::getNow(),
|
|
||||||
$revision->getID());
|
$revision->getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ final class DifferentialAffectedPathEngine
|
||||||
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
|
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
|
||||||
queryfx(
|
queryfx(
|
||||||
$conn,
|
$conn,
|
||||||
'INSERT INTO %R (repositoryID, pathID, epoch, revisionID) VALUES %LQ',
|
'INSERT INTO %R (repositoryID, pathID, revisionID) VALUES %LQ',
|
||||||
$table,
|
$table,
|
||||||
$chunk);
|
$chunk);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ final class DifferentialAffectedPath extends DifferentialDAO {
|
||||||
|
|
||||||
protected $repositoryID;
|
protected $repositoryID;
|
||||||
protected $pathID;
|
protected $pathID;
|
||||||
protected $epoch;
|
|
||||||
protected $revisionID;
|
protected $revisionID;
|
||||||
|
|
||||||
protected function getConfiguration() {
|
protected function getConfiguration() {
|
||||||
|
@ -16,15 +15,16 @@ final class DifferentialAffectedPath extends DifferentialDAO {
|
||||||
self::CONFIG_TIMESTAMPS => false,
|
self::CONFIG_TIMESTAMPS => false,
|
||||||
self::CONFIG_COLUMN_SCHEMA => array(
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
'id' => null,
|
'id' => null,
|
||||||
|
'repositoryID' => 'id?',
|
||||||
),
|
),
|
||||||
self::CONFIG_KEY_SCHEMA => array(
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
'PRIMARY' => null,
|
'PRIMARY' => null,
|
||||||
'repositoryID' => array(
|
|
||||||
'columns' => array('repositoryID', 'pathID', 'epoch'),
|
|
||||||
),
|
|
||||||
'revisionID' => array(
|
'revisionID' => array(
|
||||||
'columns' => array('revisionID'),
|
'columns' => array('revisionID'),
|
||||||
),
|
),
|
||||||
|
'key_path' => array(
|
||||||
|
'columns' => array('pathID', 'repositoryID'),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue