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>
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
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