swift/bin
Clay Gerrard 2558be42c8 Populate shrinking shards with shard ranges learnt from root
Shard shrinking can be instigated by a third party modifying shard
ranges, moving one shard to shrinking state and expanding the
namespace of one or more other shard(s) to act as acceptors. These
state and namespace changes must propagate to the shrinking and
acceptor shards. The shrinking shard must also discover the acceptor
shard(s) into which it will shard itself.

The sharder audit function already updates shards with their own state
and namespace changes from the root. However, there is currently no
mechanism for the shrinking shard to learn about the acceptor(s) other
than by a PUT request being made to the shrinking shard container.

This patch modifies the shard container audit function so that other
overlapping shards discovered from the root are merged into the
audited shard's db. In this way, the audited shard will have acceptor
shards to cleave to if shrinking.

This new behavior is restricted to when the shard is shrinking. In
general, a shard is responsible for processing its own sub-shard
ranges (if any) and reporting them to root. Replicas of a shard
container synchronise their sub-shard ranges via replication, and do
not rely on the root to propagate sub-shard ranges between shard
replicas. The exception to this is when a third party (or
auto-sharding) wishes to instigate shrinking by modifying the shard
and other acceptor shards in the root container.  In other
circumstances, merging overlapping shard ranges discovered from the
root is undesirable because it risks shards inheriting other unrelated
shard ranges. For example, if the root has become polluted by
split-brain shard range management, a sharding shard may have its
sub-shards polluted by an undesired shard from the root.

During the shrinking process a shard range's own shard range state may
be either shrinking or, prior to this patch, sharded. The sharded
state could occur when one replica of a shrinking shard completed
shrinking and moved the own shard range state to sharded before other
replica(s) had completed shrinking. This makes it impossible to
distinguish a shrinking shard (with sharded state), which we do want
to inherit shard ranges, from a sharding shard (with sharded state),
which we do not want to inherit shard ranges.

This patch therefore introduces a new shard range state, 'SHRUNK', and
applies this state to shard ranges that have completed shrinking.
Shards are now restricted to inherit shard ranges from the root only
when their own shard range state is either SHRINKING or SHRUNK.

This patch also:

 - Stops overlapping shrinking shards from generating audit warnings:
   overlaps are cured by shrinking and we therefore expect shrinking
   shards to sometimes overlap.

 - Extends an existing probe test to verify that overlapping shard
   ranges may be resolved by shrinking a subset of the shard ranges.

 - Adds a --no-auto-shard option to swift-container-sharder to enable the
   probe tests to disable auto-sharding.

 - Improves sharder logging, in particular by decrementing ranges_todo
   when a shrinking shard is skipped during cleaving.

 - Adds a ShardRange.sort_key class method to provide a single definition
   of ShardRange sort ordering.

 - Improves unit test coverage for sharder shard auditing.

Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Cherry-Picked-From: I9034a5715406b310c7282f1bec9625fe7acd57b6
Change-Id: I6543bfff5ca517ab4d6ffda881e3a50724078c65
2021-02-22 18:29:48 -06:00
..
swift-account-audit Merge "swift-account-audit: work with encryption" 2020-01-22 16:59:19 +00:00
swift-account-auditor Change OpenStack LLC to Foundation 2013-09-20 01:02:31 +08:00
swift-account-info swift-(account|container)-info: tolerate LockTimeouts 2018-04-10 17:09:07 -07:00
swift-account-reaper Change OpenStack LLC to Foundation 2013-09-20 01:02:31 +08:00
swift-account-replicator Support -d <devs> and -p <partitions> in DB replicators. 2018-03-05 16:26:19 -08:00
swift-account-server make the bind_port config setting required 2014-09-08 07:28:43 -07:00
swift-config Turn on H233 and start using print function 2016-07-08 16:19:52 +00:00
swift-container-auditor Change OpenStack LLC to Foundation 2013-09-20 01:02:31 +08:00
swift-container-info swift-container-info: Show shard ranges summary 2020-07-22 12:29:53 -05:00
swift-container-reconciler Add container-reconciler daemon 2014-06-18 17:31:39 -07:00
swift-container-replicator Support -d <devs> and -p <partitions> in DB replicators. 2018-03-05 16:26:19 -08:00
swift-container-server make the bind_port config setting required 2014-09-08 07:28:43 -07:00
swift-container-sharder Populate shrinking shards with shard ranges learnt from root 2021-02-22 18:29:48 -06:00
swift-container-sync Fix shebang of commands 2015-08-06 11:02:40 +09:00
swift-container-updater Change OpenStack LLC to Foundation 2013-09-20 01:02:31 +08:00
swift-dispersion-populate py3: Fix swift-dispersion-populate 2020-09-28 20:42:27 +00:00
swift-dispersion-report Add bin/swift-dispersion-report 2017-09-13 05:57:30 +00:00
swift-drive-audit py3: Fix swift-drive-audit 2019-10-13 21:55:58 -07:00
swift-form-signature Make swift-form-signature testable 2014-07-24 14:38:53 -07:00
swift-get-nodes swift-get-nodes: Allow users to specify either quoted or unquoted paths 2020-06-08 12:03:56 -07:00
swift-init Merge "Add description of server options (all, main, rest) for swift-init help" 2016-07-08 23:31:20 +00:00
swift-object-auditor Allow specification of object devices for audit 2014-03-11 14:17:08 +00:00
swift-object-expirer Change OpenStack LLC to Foundation 2013-09-20 01:02:31 +08:00
swift-object-info Merge "Optionally drop common prefixes in swift-*-info output" 2018-03-13 03:39:02 +00:00
swift-object-reconstructor Clarify usage of replicator and reconstructor override options 2017-07-26 12:53:46 +01:00
swift-object-relinker relinker: Improve performance by limiting I/O 2020-03-31 17:33:06 -04:00
swift-object-replicator Clarify usage of replicator and reconstructor override options 2017-07-26 12:53:46 +01:00
swift-object-server make the bind_port config setting required 2014-09-08 07:28:43 -07:00
swift-object-updater Change OpenStack LLC to Foundation 2013-09-20 01:02:31 +08:00
swift-oldies fix swift_oldies on RH based systems 2016-08-11 16:24:57 -04:00
swift-orphans Find .d pid files with swift-orphans 2019-08-30 11:54:47 -07:00
swift-proxy-server make the bind_port config setting required 2014-09-08 07:28:43 -07:00
swift-recon Fix shebang of commands 2015-08-06 11:02:40 +09:00
swift-recon-cron Fix locking in swift-recon-cron 2018-08-15 21:51:14 +00:00
swift-reconciler-enqueue Another amendment with missing parenthesis 2016-07-07 20:15:14 +03:00
swift-ring-builder Fix shebang of commands 2015-08-06 11:02:40 +09:00
swift-ring-builder-analyzer Fix shebang of commands 2015-08-06 11:02:40 +09:00
swift-ring-composer Experimental swift-ring-composer CLI to build composite rings 2018-06-14 09:50:55 +01:00