diff options
author | Alistair Coles <alistairncoles@gmail.com> | 2022-09-19 14:33:20 +0100 |
---|---|---|
committer | Alistair Coles <alistairncoles@gmail.com> | 2022-09-30 11:20:23 +0100 |
commit | a46f2324ab926ae71d3a4d3214267ffd82fd1ee8 (patch) | |
tree | a0b751a23595b437afe2512544be40f0c88a3016 /swift/container | |
parent | f15b92084f0f10148f887b75b031686279bab6f3 (diff) | |
download | swift-a46f2324ab926ae71d3a4d3214267ffd82fd1ee8.tar.gz |
sharder: always merge child shard ranges fetched from root
While the sharder is auditing shard container DBs it would previously
only merge shard ranges fetched from root into the shard DB if the
shard was shrinking; shrinking is the only time when a shard normally
*must* receive sub-shards from the root. With this patch the sharder
will also merge shard ranges fetched from the root if they are known
to be the children of the shard, regardless of the state of the shard.
Children shard ranges would previously only have been merged during
replication with peers of the shard; merging shard-ranges from the
root during audit potentially speeds their propagation to peers that
have yet to replicate.
Change-Id: I57aafc537ff94b081d0e1ea70e7fb7dd3598c61e
Diffstat (limited to 'swift/container')
-rw-r--r-- | swift/container/sharder.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/swift/container/sharder.py b/swift/container/sharder.py index 28b3e3c53..466325a10 100644 --- a/swift/container/sharder.py +++ b/swift/container/sharder.py @@ -1201,6 +1201,7 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator): shard range is found in ``shard_ranges``. """ own_shard_range_from_root = None + children_shard_ranges = [] other_shard_ranges = [] for shard_range in shard_ranges: # look for this shard range in the list of shard ranges received @@ -1222,9 +1223,20 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator): self.logger.info( 'Updated own shard range from %s to %s', orig_own_shard_range, own_shard_range) + elif shard_range.is_child_of(own_shard_range): + children_shard_ranges.append(shard_range) else: other_shard_ranges.append(shard_range) + if children_shard_ranges and not broker.is_sharded(): + # Merging shard ranges from the root is only necessary until this + # DB is fully cleaved and reaches SHARDED DB state, after which it + # is useful for debugging for the set of sub-shards to which a + # shards has sharded to be frozen. + self.logger.debug('Updating %d children shard ranges from root', + len(children_shard_ranges)) + broker.merge_shard_ranges(children_shard_ranges) + if (other_shard_ranges and own_shard_range.state in ShardRange.SHRINKING_STATES): # If own_shard_range state is shrinking, save off *all* shards |