rgw/multisite: metadata sync only retries on errors

in 866d66b874, 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 <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2021-11-23 15:44:03 -05:00
parent 8a293c21f2
commit 195316cd9a

View File

@ -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;
}