From: Casey Bodley Date: Tue, 23 Nov 2021 20:44:03 +0000 (-0500) Subject: rgw/multisite: metadata sync only retries on errors X-Git-Tag: v18.0.0~1558^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F44078%2Fhead;p=ceph.git rgw/multisite: metadata sync only retries on errors in 866d66b8749b28ec626a8d0adba3d14fdd8abead, metadata sync was fixed to retry on error codes other than EAGAIN/ECANCELED. but this change caused us to retry on success as well, which means we send 10 GET requests for each piece of metadata, and write it to rados 10 times Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index 80b710d404a7..e7f27602029c 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -1297,14 +1297,14 @@ int RGWMetaSyncSingleEntryCR::operate(const DoutPrefixProvider *dpp) { break; } - if (tries < NUM_TRANSIENT_ERROR_RETRIES - 1) { - ldpp_dout(dpp, 20) << *this << ": failed to fetch remote metadata: " << section << ":" << key << ", will retry" << dendl; - continue; - } - if (sync_status < 0) { - tn->log(10, SSTR("failed to send read remote metadata entry: section=" << section << " key=" << key << " status=" << sync_status)); - log_error() << "failed to send read remote metadata entry: section=" << section << " key=" << key << " status=" << sync_status << std::endl; + if (tries < NUM_TRANSIENT_ERROR_RETRIES - 1) { + ldpp_dout(dpp, 20) << *this << ": failed to fetch remote metadata: " << section << ":" << key << ", will retry" << dendl; + continue; + } + + tn->log(10, SSTR("failed to read remote metadata entry: section=" << section << " key=" << key << " status=" << sync_status)); + log_error() << "failed to read remote metadata entry: section=" << section << " key=" << key << " status=" << sync_status << std::endl; yield call(sync_env->error_logger->log_error_cr(dpp, sync_env->conn->get_remote_id(), section, key, -sync_status, string("failed to read remote metadata entry: ") + cpp_strerror(-sync_status))); return set_cr_error(sync_status); @@ -1317,12 +1317,12 @@ int RGWMetaSyncSingleEntryCR::operate(const DoutPrefixProvider *dpp) { for (tries = 0; tries < NUM_TRANSIENT_ERROR_RETRIES; tries++) { if (sync_status != -ENOENT) { tn->log(10, SSTR("storing local metadata entry")); - yield call(new RGWMetaStoreEntryCR(sync_env, raw_key, md_bl)); + yield call(new RGWMetaStoreEntryCR(sync_env, raw_key, md_bl)); } else { tn->log(10, SSTR("removing local metadata entry")); - yield call(new RGWMetaRemoveEntryCR(sync_env, raw_key)); + yield call(new RGWMetaRemoveEntryCR(sync_env, raw_key)); } - if (tries < NUM_TRANSIENT_ERROR_RETRIES - 1) { + if ((retcode < 0) && (tries < NUM_TRANSIENT_ERROR_RETRIES - 1)) { ldpp_dout(dpp, 20) << *this << ": failed to store metadata: " << section << ":" << key << ", got retcode=" << retcode << dendl; continue; }