missing error message when rebalancing a ring with more replicas than available zones

Bug #982368 reported by Christian Berendt
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
Andy McCrae

Bug Description

I think it should be checked if replicas <= zones before starting the rebalancing and then there should be printed a correct error message.

os0020:/etc/swift # swift-ring-builder account.builder create 18 3 1

os0020:/etc/swift # swift-ring-builder account.builder
account.builder, build version 2
262144 partitions, 3 replicas, 2 zones, 2 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices: id zone ip address port name weight partitions balance meta
             0 1 172.19.13.30 6002 xvdb1 100.00 0 -100.00
             1 2 172.19.13.31 6002 xvdb1 100.00 0 -100.00

os0020:/etc/swift # swift-ring-builder account.builder rebalance
Traceback (most recent call last):
  File "/usr/bin/swift-ring-builder", line 690, in <module>
    Commands.__dict__.get(command, Commands.unknown)()
  File "/usr/bin/swift-ring-builder", line 528, in rebalance
    parts, balance = builder.rebalance()
  File "/usr/lib64/python2.6/site-packages/swift/common/ring/builder.py", line 254, in rebalance
    self._initial_balance()
  File "/usr/lib64/python2.6/site-packages/swift/common/ring/builder.py", line 412, in _initial_balance
    while available_devs[index]['zone'] in other_zones:
IndexError: list index out of range

John Leach (johnleach)
Changed in swift:
status: New → Confirmed
Changed in swift:
assignee: nobody → Andy McCrae (andrew-mccrae)
Revision history for this message
Samuel Merritt (torgomatic) wrote :

FYI, there's a pending patchset (https://review.openstack.org/6845) that, if it gets accepted, would fix this by removing the zones >= replicas restriction.

Revision history for this message
Andy McCrae (andrew-mccrae) wrote :

Thanks for the heads up! I've had a look at the pending patchset, I like the change, will hold onto this until the patchset is merged and then confirm/close it out.

Revision history for this message
Andy McCrae (andrew-mccrae) wrote :

Confirmed this was fixed in the release mentioned by Samuel above:

root@swiftTest:/etc/swift# swift-ring-builder test.builder rebalance
Reassigned 256 (100.00%) partitions. Balance is now 0.00.
root@swiftTest:/etc/swift# swift-ring-builder test.builder
test.builder, build version 2
256 partitions, 3 replicas, 1 zones, 2 devices, 0.00 balance

Won't error when zones < replicas and now approaches it in a more sensible manner. Marking this as Resolved.

Changed in swift:
status: Confirmed → Fix Released
Thierry Carrez (ttx)
Changed in swift:
status: Fix Released → Fix Committed
Thierry Carrez (ttx)
Changed in swift:
milestone: none → 1.5.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.