diff --git a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php --- a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php +++ b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php @@ -206,8 +206,8 @@ if ($this->paths !== null) { $where[] = qsprintf( $conn, - 'rpath.path IN (%Ls)', - $this->getFragmentsForPaths($this->paths)); + 'rpath.pathIndex IN (%Ls)', + $this->getFragmentIndexesForPaths($this->paths)); } if ($this->statuses !== null) { @@ -220,13 +220,13 @@ if ($this->controlMap) { $clauses = array(); foreach ($this->controlMap as $repository_phid => $paths) { - $fragments = $this->getFragmentsForPaths($paths); + $indexes = $this->getFragmentIndexesForPaths($paths); $clauses[] = qsprintf( $conn, - '(rpath.repositoryPHID = %s AND rpath.path IN (%Ls))', + '(rpath.repositoryPHID = %s AND rpath.pathIndex IN (%Ls))', $repository_phid, - $fragments); + $indexes); } $where[] = implode(' OR ', $clauses); } @@ -333,6 +333,16 @@ return $fragments; } + private function getFragmentIndexesForPaths(array $paths) { + $indexes = array(); + + foreach ($this->getFragmentsForPaths($paths) as $fragment) { + $indexes[] = PhabricatorHash::digestForIndex($fragment); + } + + return $indexes; + } + /* -( Path Control )------------------------------------------------------- */ diff --git a/src/applications/owners/storage/PhabricatorOwnersPackage.php b/src/applications/owners/storage/PhabricatorOwnersPackage.php --- a/src/applications/owners/storage/PhabricatorOwnersPackage.php +++ b/src/applications/owners/storage/PhabricatorOwnersPackage.php @@ -218,15 +218,20 @@ // and then merge results in PHP. $rows = array(); - foreach (array_chunk(array_keys($fragments), 128) as $chunk) { + foreach (array_chunk(array_keys($fragments), 1024) as $chunk) { + $indexes = array(); + foreach ($chunk as $fragment) { + $indexes[] = PhabricatorHash::digestForIndex($fragment); + } + $rows[] = queryfx_all( $conn, 'SELECT pkg.id, pkg.dominion, p.excluded, p.path FROM %T pkg JOIN %T p ON p.packageID = pkg.id - WHERE p.path IN (%Ls) AND pkg.status IN (%Ls) %Q', + WHERE p.pathIndex IN (%Ls) AND pkg.status IN (%Ls) %Q', $package->getTableName(), $path->getTableName(), - $chunk, + $indexes, array( self::STATUS_ACTIVE, ), diff --git a/src/applications/owners/storage/PhabricatorOwnersPath.php b/src/applications/owners/storage/PhabricatorOwnersPath.php --- a/src/applications/owners/storage/PhabricatorOwnersPath.php +++ b/src/applications/owners/storage/PhabricatorOwnersPath.php @@ -26,6 +26,9 @@ 'columns' => array('packageID', 'repositoryPHID', 'pathIndex'), 'unique' => true, ), + 'key_repository' => array( + 'columns' => array('repositoryPHID', 'pathIndex'), + ), ), ) + parent::getConfiguration(); }