Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
SingleStore Managed Service does not support this command.
Rebalances the partitions for a database.
REBALANCE PARTITIONS ON db_name [FULL] [FORCE]
db_name
is the name of a SingleStore DB database.REBALANCE_PARTITIONS
restores redundancy by replicating any partitions with only one instance, and then moving partitions around to ensure balance across all the leaves. Use RESTORE REDUNDANCY
instead if you want to restore redundancy only, without rebalancing partitions.FORCE
option causes rebalance to create empty partitions for any partition on the cluster which has neither a master nor replica partition attached. Use this option carefully. If an offline node has the only copy of a partition then running REBALANCE
with FORCE
will cause the offline node’s partition to be orphaned. When the offline node comes back online the partition won’t be attached back to the cluster. It will have been replaced with an empty partition by rebalance. For some example cases where FORCE
is useful, see Dealing with Failures.FULL
option takes effect when the number of partitions in the database is not divisible by the number of leaves. Suppose you have a cluster with 20 partitions and 8 leaves. When using the FULL
option to rebalance the database, 2 partitions (20/8) would be evenly placed on each of the 8 leaves. The remaining 4 partitions would be placed on the leaves with a fewer number of master partitions. When not using the FULL
option to rebalance the database, 2 partitions (20/8) would be evenly placed on each of the 8 leaves, but the remaining 4 partitions would be placed on the first 4 available leaves; the number of partitions on each leaf would be 3,3,3,3,2,2,2,2.REBALANCE
is going to execute, run EXPLAIN REBALANCE PARTITIONS.REBALANCE
is an online operation, meaning that as it runs you can continue to read and write data in the database you are rebalancing. However, since REBALANCE
often needs to move the location of a master partition to another leaf, write transactions may experience some temporary blocking during the rebalance as this happens.REBALANCE PARTITIONS ON test;
****
Query OK, 1 row affected (9.80 sec)