]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: only trim logs for uninitialized bucket sync status
authorCasey Bodley <cbodley@redhat.com>
Thu, 13 Feb 2020 19:26:20 +0000 (14:26 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 13 Feb 2020 20:39:01 +0000 (15:39 -0500)
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 <cbodley@redhat.com>
src/rgw/rgw_trim_bilog.cc
src/test/rgw/rgw_multi/tests.py

index 8ccc6d54743876817d16e9fe4eeaf6d64a60e8a1..9e2ac89d218edce87478e7651af84386bb88deb6 100644 (file)
@@ -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
index 4ff642e68fe12a95256a2eb0b608ee506a732987..2ddf88c6170e715b7e9e7ac9dfb0b7410d1a7852 100644 (file)
@@ -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