REBALANCE_SHARDS
Rebalances shard assignments across a cluster in Eon Mode. If the current session ends, the operation immediately aborts.
Run REBALANCE_SHARDS after you modify your cluster using ALTER NODE.
Syntax
REBALANCE_SHARDS()
Privileges
Superuser
Examples
The following example rebalances the shards of all the nodes in the database:
=> SELECT REBALANCE_SHARDS(); REBALANCE_SHARDS ------------------- REBALANCED SHARDS (1 row)
After running REBALANCE_SHARDS check the subscription status by querying the SESSION_SUBSCRIPTIONS table, for example:
=> SELECT * from session_subscriptions where is_participating='t' order by node_name, shard_name; node_oid | node_name | shard_oid | shard_name | is_participating -------------------+------------+--------------------+-----------------+----------- 45035996273704978 | node01 | 45035996273704980 | replica | t 45035996273704978 | node01 | 45035996273704992 | segment003 | t 45035996273705124 | node02 | 45035996273704980 | replica | t 45035996273705124 | node02 | 45035996273704988 | segment002 | t 45035996273946332 | node04 | 45035996273704984 | segment001 | t