To support the gradual change in replica counts, a ring can have a real number of replicas and is not restricted to an integer number of replicas.
A fractional replica count is for the whole ring and not for individual partitions. It indicates the average number of replicas for each partition. For example, a replica count of 3.2 means that 20 percent of partitions have four replicas and 80 percent have three replicas.
The replica count is adjustable.
Example:
$ swift-ring-builder account.builder set_replicas 4 $ swift-ring-builder account.builder rebalance
You must rebalance the replica ring in globally distributed clusters. Operators of these clusters generally want an equal number of replicas and regions. Therefore, when an operator adds or removes a region, the operator adds or removes a replica. Removing unneeded replicas saves on the cost of disks.
You can gradually increase the replica count at a rate that does not adversely affect cluster performance.
For example:
$ swift-ring-builder object.builder set_replicas 3.01 $ swift-ring-builder object.builder rebalance <distribute rings and wait>... $ swift-ring-builder object.builder set_replicas 3.02 $ swift-ring-builder object.builder rebalance <creatdistribute rings and wait>...
Changes take effect after the ring is rebalanced.
Therefore, if you intend to change from 3 replicas to 3.01
but you accidentally type 2.01
, no data
is lost.
Additionally, swift-ring-builder
X.builder
create can now take a decimal argument for
the number of replicas.