ring metadata differs depending on whether loading metadata_only

Bug #1942481 reported by Tim Burke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
New
Undecided
Unassigned

Bug Description

Assuming you've got a moderately-sized ring (>64k compressed or so), these loaded rings look different in some curious ways:

  >>> from swift.common.ring import *
  >>> r1 = RingData.load('/etc/swift/object.ring.gz', metadata_only=False)
  >>> r2 = RingData.load('/etc/swift/object.ring.gz', metadata_only=True)
  >>> r1.md5, r2.md5
  ('9a70d526cfce55bbffcf015a8c5fa00a', '61f10f9d771819f76c04834b12402800')
  >>> r1.size, r2.size
  (73834, 65536)
  >>> r1.raw_size, r2.raw_size
  (787888, 377954)

The trouble is that we bailed reading before all the bytes flowed through our RingReader. It might suffice to just set those three to None (i.e., unknown) when we're doing metadata_only=True. The alternative would seem to be mindlessly reading (and dropping on the floor) the rest of the ring, but surely the reason we said metadata_only=True was to *avoid* all that I/O, right?

The replica_count property is trickier, though, since it proxies through to looking at the replica2part2dev_id table:

  >>> r1.replica_count, r2.replica_count
  (6.0, 0)

Maybe we could have that return None if the table's empty? I can't think of a single useful thing that could be done with a zero-replica ring, so I feel like we could declare that similarly invalid -- surely there's supposed to be a replica_count, and we just don't know what it is. Right?

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.