From: Casey Bodley Date: Thu, 13 Feb 2020 19:26:20 +0000 (-0500) Subject: rgw: only trim logs for uninitialized bucket sync status X-Git-Tag: v15.1.1~324^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=82af57afa22dd9af5b5c7415f8c290c227c5dc52;p=ceph.git rgw: only trim logs for uninitialized bucket sync status the pubsub zone cannot trim logs when it's in the Stopped state, because it needs to resume from a specific position - so take that position into account for trim a similar issue effects full sync - it also records a marker position where it should resume incremental sync after full sync finishes, and we can't trim entries past that either Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_trim_bilog.cc b/src/rgw/rgw_trim_bilog.cc index 8ccc6d547438..9e2ac89d218e 100644 --- a/src/rgw/rgw_trim_bilog.cc +++ b/src/rgw/rgw_trim_bilog.cc @@ -364,8 +364,8 @@ int take_min_status(CephContext *cct, Iter first, Iter last, auto m = status->begin(); for (auto& shard : *peer) { auto& marker = *m++; - // only consider incremental sync markers - if (shard.state != rgw_bucket_shard_sync_info::StateIncrementalSync) { + // if no sync has started, we can safely trim everything + if (shard.state == rgw_bucket_shard_sync_info::StateInit) { continue; } // always take the first marker, or any later marker that's smaller diff --git a/src/test/rgw/rgw_multi/tests.py b/src/test/rgw/rgw_multi/tests.py index 4ff642e68fe1..2ddf88c6170e 100644 --- a/src/test/rgw/rgw_multi/tests.py +++ b/src/test/rgw/rgw_multi/tests.py @@ -270,16 +270,12 @@ def bucket_sync_status(target_zone, source_zone, bucket_name): assert(retcode == 2) # ENOENT bucket_sync_status_json = bucket_sync_status_json.decode('utf-8') - log.debug('current bucket sync markers=%s', bucket_sync_status_json) sync_status = json.loads(bucket_sync_status_json) markers={} for entry in sync_status: val = entry['val'] - if val['status'] == 'incremental-sync': - pos = val['inc_marker']['position'].split('#')[-1] # get rid of shard id; e.g., 6#00000000002.132.3 -> 00000000002.132.3 - else: - pos = '' + pos = val['inc_marker']['position'].split('#')[-1] # get rid of shard id; e.g., 6#00000000002.132.3 -> 00000000002.132.3 markers[entry['key']] = pos return markers