Alistair Coles c9c42c07c9 swift-manage-shard-ranges: add repair and analyze commands
Adds a repair command that reads shard ranges from the container DB,
identifies overlapping shard ranges and recommends how overlaps can be
repaired by shrinking into a single chosen path.  Prompted user input
or a '-y' option will then cause the appropriately modified shard
ranges to be merged into the container DB.

The repair command does not fix gaps in shard range paths and can
therefore only succeed if there is at least one unbroken path of
shards through the entire namespace.

Also adds an analyze command that loads shard data from a file and
reports overlapping shard ranges, but takes no action.  The analyze
command is similar to the repair command but reads shard data from
file rather than a container db and makes no changes to the db.

e.g.:
  swift-manage-shard-ranges <db-file-name> repair
  swift-manage-shard-ranges <shard-data.json> analyze

to see more detail:
  swift-manage-shard-ranges -v <shard-data.json> analyze

For consistency with the new repair command, and to be more cautious,
this patch changes the user input required to apply the compact
command changes to the DB from 'y' to 'yes'.

Change-Id: I9ec411462e4aaf9f21aba6c5fd7698ff75a07de3
2021-03-25 11:00:15 +00:00
..