Browse Source

Merge "sharder: stall cleaving at shard range gaps"

changes/96/747496/5
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
c5fe114c96
2 changed files with 11 additions and 5 deletions
  1. +7
    -0
      swift/container/sharder.py
  2. +4
    -5
      test/unit/container/test_sharder.py

+ 7
- 0
swift/container/sharder.py View File

@ -1706,6 +1706,8 @@ class ContainerSharder(ContainerReplicator):
quote(broker.path))
else:
cleaving_context.start()
own_shard_range = broker.get_own_shard_range()
cleaving_context.cursor = own_shard_range.lower_str
cleaving_context.ranges_todo = len(ranges_todo)
self.logger.debug('Starting to cleave (%s todo): %s',
cleaving_context.ranges_todo, quote(broker.path))
@ -1722,6 +1724,11 @@ class ContainerSharder(ContainerReplicator):
if len(ranges_done) == self.cleave_batch_size:
break
if shard_range.lower > cleaving_context.cursor:
self.logger.info('Stopped cleave at gap: %r - %r' %
(cleaving_context.cursor, shard_range.lower))
break
if shard_range.state not in (ShardRange.CREATED,
ShardRange.CLEAVED,
ShardRange.ACTIVE):


+ 4
- 5
test/unit/container/test_sharder.py View File

@ -1878,14 +1878,13 @@ class TestSharder(BaseTestSharder):
do_test(ShardRange.CLEAVED, (('d', 'k'), ('k', 't')), expect_delete)
# shrinking to incomplete acceptors, gap at start and end of namespace
do_test(ShardRange.CREATED, (('k', 't'),), expect_delete,
exp_progress_bounds=(('k', 't'),))
exp_progress_bounds=())
# shrinking to incomplete acceptors, gap at start of namespace
expect_delete = True
do_test(ShardRange.CLEAVED, (('k', 't'), ('t', '')), expect_delete,
exp_progress_bounds=(('k', 't'), ('t', '')))
# shrinking to incomplete acceptors, gap in middle
exp_progress_bounds=())
# shrinking to incomplete acceptors, gap in middle - some progress
do_test(ShardRange.CLEAVED, (('d', 'k'), ('t', '')), expect_delete,
exp_progress_bounds=(('d', 'k'), ('t', '')))
exp_progress_bounds=(('d', 'k'),))
def test_cleave_repeated(self):
# verify that if new objects are merged into retiring db after cleaving


Loading…
Cancel
Save