From: Yehuda Sadeh Date: Tue, 15 Mar 2016 01:44:50 +0000 (-0700) Subject: rgw: data shard sync doesn't exit on error X-Git-Tag: v10.1.0~72^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=70ca604fb50e40527714e1c62c6a0d166433d645;p=ceph.git rgw: data shard sync doesn't exit on error We don't handle the error at the top level, so no need to exit. Just continue with the backoff mechanism. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 35798b4c780c..96383896d297 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -1125,7 +1125,7 @@ class RGWDataSyncShardControlCR : public RGWBackoffControlCR { public: RGWDataSyncShardControlCR(RGWDataSyncEnv *_sync_env, rgw_bucket& _pool, - uint32_t _shard_id, rgw_data_sync_marker& _marker) : RGWBackoffControlCR(_sync_env->cct), + uint32_t _shard_id, rgw_data_sync_marker& _marker) : RGWBackoffControlCR(_sync_env->cct, false), sync_env(_sync_env), pool(_pool), shard_id(_shard_id), @@ -1180,6 +1180,12 @@ public: reset_backoff(_reset_backoff) { } + ~RGWDataSyncCR() { + for (auto iter : shard_crs) { + iter.second->put(); + } + } + int operate() { reenter(this) { @@ -1237,6 +1243,7 @@ public: iter != sync_status.sync_markers.end(); ++iter) { RGWDataSyncShardControlCR *cr = new RGWDataSyncShardControlCR(sync_env, sync_env->store->get_zone_params().log_pool, iter->first, iter->second); + cr->get(); shard_crs_lock.Lock(); shard_crs[iter->first] = cr; shard_crs_lock.Unlock(); @@ -1274,7 +1281,7 @@ class RGWDataSyncControlCR : public RGWBackoffControlCR uint32_t num_shards; public: - RGWDataSyncControlCR(RGWDataSyncEnv *_sync_env, uint32_t _num_shards) : RGWBackoffControlCR(_sync_env->cct), + RGWDataSyncControlCR(RGWDataSyncEnv *_sync_env, uint32_t _num_shards) : RGWBackoffControlCR(_sync_env->cct, true), sync_env(_sync_env), num_shards(_num_shards) { } diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index 4d7c4813a2d3..411ab4c5dd78 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -97,7 +97,9 @@ int RGWBackoffControlCR::operate() { } if (retcode < 0 && retcode != -EBUSY && retcode != -EAGAIN) { ldout(cct, 0) << "ERROR: RGWBackoffControlCR called coroutine returned " << retcode << dendl; - return set_cr_error(retcode); + if (exit_on_error) { + return set_cr_error(retcode); + } } if (reset_backoff) { backoff.reset(); @@ -108,7 +110,9 @@ int RGWBackoffControlCR::operate() { yield call(finisher_cr); if (retcode < 0) { ldout(cct, 0) << "ERROR: call to finisher_cr() failed: retcode=" << retcode << dendl; - return set_cr_error(retcode); + if (exit_on_error) { + return set_cr_error(retcode); + } } } } @@ -1638,7 +1642,7 @@ public: const std::string& period, RGWMetadataLog* mdlog, uint32_t _shard_id, const rgw_meta_sync_marker& _marker, std::string&& period_marker) - : RGWBackoffControlCR(_sync_env->cct), sync_env(_sync_env), + : RGWBackoffControlCR(_sync_env->cct, true), sync_env(_sync_env), pool(_pool), period(period), mdlog(mdlog), shard_id(_shard_id), sync_marker(_marker), period_marker(std::move(period_marker)), obj_ctx(sync_env->store) {} diff --git a/src/rgw/rgw_sync.h b/src/rgw/rgw_sync.h index 1ab130b9a2b6..b694269f87ec 100644 --- a/src/rgw/rgw_sync.h +++ b/src/rgw/rgw_sync.h @@ -126,6 +126,8 @@ class RGWBackoffControlCR : public RGWCoroutine RGWSyncBackoff backoff; bool reset_backoff; + bool exit_on_error; + protected: bool *backoff_ptr() { return &reset_backoff; @@ -140,7 +142,8 @@ protected: } public: - RGWBackoffControlCR(CephContext *_cct) : RGWCoroutine(_cct), cr(NULL), lock("RGWBackoffControlCR::lock"), reset_backoff(false) { + RGWBackoffControlCR(CephContext *_cct, bool _exit_on_error) : RGWCoroutine(_cct), cr(NULL), lock("RGWBackoffControlCR::lock"), + reset_backoff(false), exit_on_error(_exit_on_error) { } virtual ~RGWBackoffControlCR() {