mirror of https://github.com/citusdata/citus.git
Merge pull request #920 from citusdata/fix/error_on_different_shard_placement_count
Error on different shard placement countspull/921/head v6.0.0-rc.1
commit
03c06a3b68
|
@ -151,8 +151,9 @@ MarkTablesColocated(Oid sourceRelationId, Oid targetRelationId)
|
|||
* following cases:
|
||||
* 1.Shard counts are different,
|
||||
* 2.Shard intervals don't match
|
||||
* 3.Shard placements are not colocated (not on the same node)
|
||||
* 4.Shard placements have different health states
|
||||
* 3.Matching shard intervals have different number of shard placements
|
||||
* 4.Shard placements are not colocated (not on the same node)
|
||||
* 5.Shard placements have different health states
|
||||
*
|
||||
* Note that, this functions assumes that both tables are hash distributed.
|
||||
*/
|
||||
|
@ -219,6 +220,16 @@ ErrorIfShardPlacementsNotColocated(Oid leftRelationId, Oid rightRelationId)
|
|||
leftPlacementList = ShardPlacementList(leftShardId);
|
||||
rightPlacementList = ShardPlacementList(rightShardId);
|
||||
|
||||
if (list_length(leftPlacementList) != list_length(rightPlacementList))
|
||||
{
|
||||
ereport(ERROR, (errmsg("cannot colocate tables %s and %s",
|
||||
leftRelationName, rightRelationName),
|
||||
errdetail("Shard %ld of %s and shard %ld of %s "
|
||||
"have different number of shard placements.",
|
||||
leftShardId, leftRelationName,
|
||||
rightShardId, rightRelationName)));
|
||||
}
|
||||
|
||||
/* sort shard placements according to the node */
|
||||
sortedLeftPlacementList = SortList(leftPlacementList,
|
||||
CompareShardPlacementsByNode);
|
||||
|
|
|
@ -689,7 +689,7 @@ ERROR: cannot colocate tables table1_groupb and table1_groupd
|
|||
DETAIL: Shard counts don't match for table1_groupb and table1_groupd.
|
||||
SELECT mark_tables_colocated('table1_groupB', ARRAY['table1_groupE']);
|
||||
ERROR: cannot colocate tables table1_groupb and table1_groupe
|
||||
DETAIL: Shard 1300027 of table1_groupb and shard 1300047 of table1_groupe are not colocated.
|
||||
DETAIL: Shard 1300026 of table1_groupb and shard 1300046 of table1_groupe have different number of shard placements.
|
||||
SELECT mark_tables_colocated('table1_groupB', ARRAY['table1_groupF']);
|
||||
ERROR: cannot colocate tables table1_groupb and table1_groupf
|
||||
DETAIL: Shard counts don't match for table1_groupb and table1_groupf.
|
||||
|
|
Loading…
Reference in New Issue