From 6d5301050847df1b09a3e548be7095e4b73a945c Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Thu, 20 Jul 2023 10:44:43 +0100 Subject: [PATCH] sharder: use ContainerBroker.has_other_shard_ranges() method The Related-Change introduced an optimised has_other_shard_ranges() method that can be used instead of get_shard_ranges() when the caller only needs to know if any other shard ranges exist. Change-Id: Ie0e3b4d31f7dc129523f82dc7ed62aac580214bf Related-Change: I01fd4f3e395c8846280f44e17a56935fc6210444 --- swift/container/sharder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swift/container/sharder.py b/swift/container/sharder.py index b24adbad73..69b4d7512a 100644 --- a/swift/container/sharder.py +++ b/swift/container/sharder.py @@ -61,7 +61,7 @@ def sharding_enabled(broker): # if broker has been marked deleted it will have lost sysmeta, but we still # need to process the broker (for example, to shrink any shard ranges) so # fallback to checking if it has any shard ranges - if broker.get_shard_ranges(): + if broker.has_other_shard_ranges(): return True return False @@ -2348,7 +2348,7 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator): own_shard_range = broker.get_own_shard_range() if own_shard_range.state in ShardRange.CLEAVING_STATES: - if broker.get_shard_ranges(): + if broker.has_other_shard_ranges(): # container has been given shard ranges rather than # found them e.g. via replication or a shrink event, # or manually triggered cleaving.