Print notification for each colocated shard.

colocation_shards_notice
eaydingol 2024-03-12 09:10:50 +00:00
parent 8afa2d0386
commit a7580f4443
3 changed files with 34 additions and 9 deletions

View File

@ -861,15 +861,28 @@ ExecutePlacementUpdates(List *placementUpdateList, Oid shardReplicationModeOid,
foreach(placementUpdateCell, placementUpdateList)
{
PlacementUpdateEvent *placementUpdate = lfirst(placementUpdateCell);
ereport(NOTICE, (errmsg(
"%s shard %lu from %s:%u to %s:%u ...",
noticeOperation,
placementUpdate->shardId,
placementUpdate->sourceNode->workerName,
placementUpdate->sourceNode->workerPort,
placementUpdate->targetNode->workerName,
placementUpdate->targetNode->workerPort
)));
List *colocatedUpdateList = GetColocatedRebalanceSteps(list_make1(
placementUpdate));
ListCell *colocatedUpdateCell = NULL;
/*
* Print the notification for each colocated shard as the placement of each colocated
* shard will be updated in the subsequent call.
*/
foreach(colocatedUpdateCell, colocatedUpdateList)
{
PlacementUpdateEvent *colocatedUpdate = lfirst(colocatedUpdateCell);
ereport(NOTICE, (errmsg(
"%s shard %lu from %s:%u to %s:%u ...",
noticeOperation,
colocatedUpdate->shardId,
colocatedUpdate->sourceNode->workerName,
colocatedUpdate->sourceNode->workerPort,
colocatedUpdate->targetNode->workerName,
colocatedUpdate->targetNode->workerPort
)));
}
UpdateShardPlacement(placementUpdate, responsiveWorkerList,
shardReplicationModeOid);
MemoryContextReset(localContext);

View File

@ -1776,6 +1776,8 @@ DETAIL: The balance improvement of 0.1xxxxx is lower than the improvement_thres
NOTICE: Ignored 1 moves, all of which are shown in notices above
HINT: If you do want these moves to happen, try changing improvement_threshold to a lower value than what it is now (0.5).
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
rebalance_table_shards
---------------------------------------------------------------------
@ -2805,6 +2807,8 @@ select 1 from citus_add_node('localhost', :worker_2_port);
(1 row)
select rebalance_table_shards();
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
rebalance_table_shards
---------------------------------------------------------------------
@ -2905,6 +2909,8 @@ SELECT sh.logicalrelid, pl.nodeport
-- but because the coordinator is not allowed for shards, rebalancer will distribute each colocation group to both workers
select rebalance_table_shards(shard_transfer_mode:='block_writes');
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
rebalance_table_shards
---------------------------------------------------------------------

View File

@ -244,6 +244,7 @@ DROP TABLE statement_replicated;
-- and the other in block_writes
SELECT rebalance_table_shards(max_shard_moves:=1);
NOTICE: Stopped searching before we were out of moves. Please rerun the rebalancer after it's finished for a more optimal placement.
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
rebalance_table_shards
---------------------------------------------------------------------
@ -252,6 +253,8 @@ NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
SELECT rebalance_table_shards(shard_transfer_mode:='block_writes');
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
rebalance_table_shards
---------------------------------------------------------------------
@ -417,6 +420,9 @@ SET citus.shard_replication_factor TO 1;
SELECT master_drain_node('localhost', :master_port, shard_transfer_mode:='block_writes');
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
NOTICE: Moving shard xxxxx from localhost:xxxxx to localhost:xxxxx ...
master_drain_node
---------------------------------------------------------------------