Merge branch 'master' into remove-deprecated-gucs-udfs

pull/4529/head
Ahmet Gedemenli 2021-01-22 13:29:07 +03:00 committed by GitHub
commit 63fab1b7d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -543,13 +543,23 @@ ColocationId(int shardCount, int replicationFactor, Oid distributionColumnType,
indexOK, NULL, scanKeyCount, scanKey); indexOK, NULL, scanKeyCount, scanKey);
HeapTuple colocationTuple = systable_getnext(scanDescriptor); HeapTuple colocationTuple = systable_getnext(scanDescriptor);
if (HeapTupleIsValid(colocationTuple))
while (HeapTupleIsValid(colocationTuple))
{ {
Form_pg_dist_colocation colocationForm = Form_pg_dist_colocation colocationForm =
(Form_pg_dist_colocation) GETSTRUCT(colocationTuple); (Form_pg_dist_colocation) GETSTRUCT(colocationTuple);
if (colocationId == INVALID_COLOCATION_ID || colocationId >
colocationForm->colocationid)
{
/*
* We assign the smallest colocation id among all the matches so that we
* assign the same colocation group for similar distributed tables
*/
colocationId = colocationForm->colocationid; colocationId = colocationForm->colocationid;
} }
colocationTuple = systable_getnext(scanDescriptor);
}
systable_endscan(scanDescriptor); systable_endscan(scanDescriptor);
table_close(pgDistColocation, AccessShareLock); table_close(pgDistColocation, AccessShareLock);