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
This commit is contained in:
Alistair Coles 2023-07-20 10:44:43 +01:00
parent bfbe8f909f
commit 6d53010508

View File

@ -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.