mirror of https://github.com/citusdata/citus.git
Error on different shard placement count
In ErrorIfShardPlacementsNotColocated(), while checking if shards are colocated, error out if matching shard intervals have different number of shard placements.pull/920/head
parent
7f74d82835
commit
c6f5cabbe3
|
@ -151,8 +151,9 @@ MarkTablesColocated(Oid sourceRelationId, Oid targetRelationId)
|
||||||
* following cases:
|
* following cases:
|
||||||
* 1.Shard counts are different,
|
* 1.Shard counts are different,
|
||||||
* 2.Shard intervals don't match
|
* 2.Shard intervals don't match
|
||||||
* 3.Shard placements are not colocated (not on the same node)
|
* 3.Matching shard intervals have different number of shard placements
|
||||||
* 4.Shard placements have different health states
|
* 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.
|
* Note that, this functions assumes that both tables are hash distributed.
|
||||||
*/
|
*/
|
||||||
|
@ -219,6 +220,16 @@ ErrorIfShardPlacementsNotColocated(Oid leftRelationId, Oid rightRelationId)
|
||||||
leftPlacementList = ShardPlacementList(leftShardId);
|
leftPlacementList = ShardPlacementList(leftShardId);
|
||||||
rightPlacementList = ShardPlacementList(rightShardId);
|
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 */
|
/* sort shard placements according to the node */
|
||||||
sortedLeftPlacementList = SortList(leftPlacementList,
|
sortedLeftPlacementList = SortList(leftPlacementList,
|
||||||
CompareShardPlacementsByNode);
|
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.
|
DETAIL: Shard counts don't match for table1_groupb and table1_groupd.
|
||||||
SELECT mark_tables_colocated('table1_groupB', ARRAY['table1_groupE']);
|
SELECT mark_tables_colocated('table1_groupB', ARRAY['table1_groupE']);
|
||||||
ERROR: cannot colocate tables table1_groupb and 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']);
|
SELECT mark_tables_colocated('table1_groupB', ARRAY['table1_groupF']);
|
||||||
ERROR: cannot colocate tables table1_groupb and table1_groupf
|
ERROR: cannot colocate tables table1_groupb and table1_groupf
|
||||||
DETAIL: Shard counts don't match for table1_groupb and table1_groupf.
|
DETAIL: Shard counts don't match for table1_groupb and table1_groupf.
|
||||||
|
|
Loading…
Reference in New Issue