diff options
author | Alistair Coles <alistairncoles@gmail.com> | 2022-09-14 15:18:05 +0100 |
---|---|---|
committer | Alistair Coles <alistairncoles@gmail.com> | 2022-09-30 08:46:57 +0100 |
commit | f15b92084f0f10148f887b75b031686279bab6f3 (patch) | |
tree | 14ccf0b789c4781c556645330f071be11ed50094 /swift/container | |
parent | 429702e30de95ca3f0188b89d51364f6b47d5121 (diff) | |
download | swift-f15b92084f0f10148f887b75b031686279bab6f3.tar.gz |
sharder: always get ranges from root while shrinking
While auditing a shard container that is in a shrinking state, the
sharder will merge any shard ranges fetched from the root that cover
the shard's namespace. Previously this was conditional upon the
sharder also fetching the shard's *own* shard range from the
root. However, in extreme circumstances, the shard's own shard range
could become deleted and reclaimed from the root while the shard DB
still needs to shrink to its acceptor ranges. This patch therefore
allows the shard to be updated with potential acceptor ranges from the
root even when its own shard range is not fetched from the root.
Also change the log level from debug to info when logging an update to
a shard's own shard range from root.
Change-Id: I17957cf0ef4936f91e69c6d9ae21551972f0df31
Diffstat (limited to 'swift/container')
-rw-r--r-- | swift/container/sharder.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/swift/container/sharder.py b/swift/container/sharder.py index d65804614..28b3e3c53 100644 --- a/swift/container/sharder.py +++ b/swift/container/sharder.py @@ -1219,15 +1219,14 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator): own_shard_range = broker.get_own_shard_range() if (orig_own_shard_range != own_shard_range or orig_own_shard_range.state != own_shard_range.state): - self.logger.debug( + self.logger.info( 'Updated own shard range from %s to %s', orig_own_shard_range, own_shard_range) else: other_shard_ranges.append(shard_range) - if (other_shard_ranges and own_shard_range_from_root and - own_shard_range.state in - (ShardRange.SHRINKING, ShardRange.SHRUNK)): + if (other_shard_ranges and + own_shard_range.state in ShardRange.SHRINKING_STATES): # If own_shard_range state is shrinking, save off *all* shards # returned because these may contain shards into which this # shard is to shrink itself; shrinking is the only case when we @@ -1259,7 +1258,7 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator): own_shard_range.timestamp < delete_age and broker.empty()): broker.delete_db(Timestamp.now().internal) - self.logger.debug('Deleted shard container %s (%s)', + self.logger.debug('Marked shard container as deleted %s (%s)', broker.db_file, quote(broker.path)) def _do_audit_shard_container(self, broker): @@ -1796,7 +1795,7 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator): quote(broker.path), shard_range) replication_quorum = self.existing_shard_replication_quorum - if own_shard_range.state in (ShardRange.SHRINKING, ShardRange.SHRUNK): + if own_shard_range.state in ShardRange.SHRINKING_STATES: if shard_range.includes(own_shard_range): # When shrinking to a single acceptor that completely encloses # this shard's namespace, include deleted own (donor) shard @@ -2001,8 +2000,7 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator): quote(broker.path)) return False own_shard_range.update_meta(0, 0) - if own_shard_range.state in (ShardRange.SHRINKING, - ShardRange.SHRUNK): + if own_shard_range.state in ShardRange.SHRINKING_STATES: own_shard_range.update_state(ShardRange.SHRUNK) modified_shard_ranges = [] else: |