From 195316cd9a5f4e85405df9f4cf0956913b5af086 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 23 Nov 2021 15:44:03 -0500 Subject: [PATCH] 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 --- src/rgw/rgw_sync.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index 80b710d404a7c..e7f27602029c7 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; } -- 2.39.5