From 40418d7cc75b98320749c4b031d1cdb2ed46ee16 Mon Sep 17 00:00:00 2001 From: Shilpa Jagannath Date: Wed, 2 Jun 2021 23:27:06 +0530 Subject: [PATCH] rgw: fix incremental sync by using the right generation for bilog listing Signed-off-by: Shilpa Jagannath --- src/rgw/rgw_data_sync.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index d53654d697807..7b95714ff5f03 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -4213,7 +4213,6 @@ class RGWBucketShardIncrementalSyncCR : public RGWCoroutine { boost::intrusive_ptr lease_cr; bilog_list_result extended_result; list list_result; - uint64_t generation; int next_num_shards; uint64_t next_gen; bool truncated; @@ -4221,6 +4220,7 @@ class RGWBucketShardIncrementalSyncCR : public RGWCoroutine { list::iterator entries_iter, entries_end; map, pair > squash_map; rgw_bucket_shard_sync_info& sync_info; + uint64_t generation; rgw_obj_key key; rgw_bi_log_entry *entry{nullptr}; bool updated_status{false}; @@ -4242,13 +4242,14 @@ public: const rgw_raw_obj& _bucket_status_obj, boost::intrusive_ptr lease_cr, rgw_bucket_shard_sync_info& sync_info, + uint64_t generation, RGWSyncTraceNodeRef& _tn_parent, RGWObjVersionTracker& objv_tracker, ceph::real_time* stable_timestamp) : RGWCoroutine(_sc->cct), sc(_sc), sync_env(_sc->env), sync_pipe(_sync_pipe), bs(_sync_pipe.info.source_bs), bucket_status_obj(_bucket_status_obj), lease_cr(std::move(lease_cr)), - sync_info(sync_info), zone_id(sync_env->svc->zone->get_zone().id), + sync_info(sync_info), generation(generation), zone_id(sync_env->svc->zone->get_zone().id), tn(sync_env->sync_tracer->add_node(_tn_parent, "inc_sync", SSTR(bucket_shard_str{bs}))), marker_tracker(sc, shard_status_oid, sync_info.inc_marker, tn, @@ -4259,7 +4260,6 @@ public: set_status("init"); rules = sync_pipe.get_rules(); target_location_key = sync_pipe.info.dest_bs.bucket.get_key(); - generation = 0; // TODO: remove once datalog shard is done } bool check_key_handled(const rgw_obj_key& key) { @@ -5057,6 +5057,7 @@ class RGWSyncBucketShardCR : public RGWCoroutine { rgw_bucket_sync_pair_info sync_pair; rgw_bucket_sync_pipe& sync_pipe; BucketSyncState& bucket_state; + uint64_t generation; ceph::real_time* progress; const std::string shard_status_oid; @@ -5072,11 +5073,12 @@ public: const rgw_bucket_sync_pair_info& _sync_pair, rgw_bucket_sync_pipe& sync_pipe, BucketSyncState& bucket_state, + uint64_t generation, const RGWSyncTraceNodeRef& tn, ceph::real_time* progress) : RGWCoroutine(_sc->cct), sc(_sc), sync_env(_sc->env), lease_cr(std::move(lease_cr)), sync_pair(_sync_pair), - sync_pipe(sync_pipe), bucket_state(bucket_state), progress(progress), + sync_pipe(sync_pipe), bucket_state(bucket_state), generation(generation), progress(progress), shard_status_oid(RGWBucketPipeSyncStatusManager::inc_status_oid(sc->source_zone, sync_pair)), bucket_status_obj(sc->env->svc->zone->get_zone_params().log_pool, RGWBucketPipeSyncStatusManager::full_status_oid(sc->source_zone, @@ -5105,7 +5107,7 @@ int RGWSyncBucketShardCR::operate(const DoutPrefixProvider *dpp) yield call(new RGWBucketShardIncrementalSyncCR(sc, sync_pipe, shard_status_oid, bucket_status_obj, lease_cr, - sync_status, tn, + sync_status, generation, tn, objv_tracker, progress)); if (retcode < 0) { tn->log(5, SSTR("incremental sync on bucket failed, retcode=" << retcode)); @@ -5310,7 +5312,7 @@ int RGWSyncBucketCR::operate(const DoutPrefixProvider *dpp) yield call(new RGWSyncBucketShardCR(sc, data_lease_cr, sync_pair, sync_pipe, bucket_status.state, - tn, progress)); + bucket_status.incremental_gen, tn, progress)); if (retcode < 0) { return set_cr_error(retcode); } -- 2.39.5