summaryrefslogtreecommitdiff
path: root/swift/container/sharder.py
diff options
context:
space:
mode:
Diffstat (limited to 'swift/container/sharder.py')
-rw-r--r--swift/container/sharder.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/swift/container/sharder.py b/swift/container/sharder.py
index 6eb8076ac..0d0acfa3c 100644
--- a/swift/container/sharder.py
+++ b/swift/container/sharder.py
@@ -1615,7 +1615,14 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator):
self._increment_stat('cleaved', 'failure', statsd=True)
return CLEAVE_FAILED
- own_shard_range = broker.get_own_shard_range()
+ own_shard_range = broker.get_own_shard_range(no_default=True)
+ if own_shard_range is None:
+ # A default should never be SHRINKING or SHRUNK but because we
+ # may write own_shard_range back to broker, let's make sure
+ # it can't be defaulted.
+ self.logger.warning('Failed to get own_shard_range for %s',
+ quote(broker.path))
+ return CLEAVE_FAILED
# only cleave from the retiring db - misplaced objects handler will
# deal with any objects in the fresh db
@@ -1833,7 +1840,14 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator):
# Move all CLEAVED shards to ACTIVE state and if a shard then
# delete own shard range; these changes will be simultaneously
# reported in the next update to the root container.
- own_shard_range = broker.get_own_shard_range()
+ own_shard_range = broker.get_own_shard_range(no_default=True)
+ if own_shard_range is None:
+ # This is more of a belts and braces, not sure we could even
+ # get this far with without an own_shard_range. But because
+ # we will be writing own_shard_range back, we need to make sure
+ self.logger.warning('Failed to get own_shard_range for %s',
+ quote(broker.path))
+ return False
own_shard_range.update_meta(0, 0)
if own_shard_range.state in (ShardRange.SHRINKING,
ShardRange.SHRUNK):