From ac726c6dd4a6f4aec4f532794c9e8b05f67e7bb7 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 16 Feb 2016 14:06:49 -0800 Subject: [PATCH] rgw: data sync error handling (for sync init) Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_coroutine.cc | 1 - src/rgw/rgw_cr_rados.cc | 1 + src/rgw/rgw_cr_rados.h | 2 +- src/rgw/rgw_data_sync.cc | 15 +++++++++++---- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index b01be51fce883..ba36756501c33 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -373,7 +373,6 @@ void RGWCoroutinesManager::report_error(RGWCoroutinesStack *op) if (err.empty()) { return; } -#warning need to have error logging infrastructure that logs on backend lderr(cct) << "ERROR: failed operation: " << op->error_str() << dendl; } diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 2f8cca870a038..0b5243f7dd337 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -388,6 +388,7 @@ int RGWOmapAppend::operate() { } } if (get_ret_status() < 0) { + ldout(cct, 0) << "ERROR: failed to store entries in omap" << dendl; return set_state(RGWCoroutine_Error); } } diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 97fe612b22b61..e2692741d2abc 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -563,7 +563,7 @@ public: bool finish() { bool success = true; for (vector::iterator iter = shards.begin(); iter != shards.end(); ++iter) { - success &= (*iter)->finish(); + success &= ((*iter)->finish() && (!(*iter)->is_error())); } return success; } diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 9927670e39eda..d348a4850ef0a 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -447,6 +447,7 @@ class RGWListBucketIndexesCR : public RGWCoroutine { int num_shards; int req_ret; + int ret; list result; list::iterator iter; @@ -467,7 +468,7 @@ public: RGWListBucketIndexesCR(RGWDataSyncEnv *_sync_env, rgw_data_sync_status *_sync_status) : RGWCoroutine(_sync_env->cct), sync_env(_sync_env), store(sync_env->store), sync_status(_sync_status), - req_ret(0), entries_index(NULL), i(0), failed(false) { + req_ret(0), ret(0), entries_index(NULL), i(0), failed(false) { oid_prefix = datalog_sync_full_sync_index_prefix + "." + sync_env->source_zone; path = "/admin/metadata/bucket.instance"; num_shards = sync_status->sync_info.num_shards; @@ -504,7 +505,6 @@ public: } num_shards = meta_info.data.get_bucket_info().num_shards; -#warning error handling of shards if (num_shards > 0) { for (i = 0; i < num_shards; i++) { char buf[16]; @@ -529,15 +529,22 @@ public: spawn(new RGWSimpleRadosWriteCR(sync_env->async_rados, store, store->get_zone_params().log_pool, RGWDataSyncStatusManager::shard_obj_name(sync_env->source_zone, shard_id), marker), true); } + } else { + yield call(sync_env->error_logger->log_error_cr(sync_env->conn->get_remote_id(), "data.init", "", + EIO, string("failed to build bucket instances map"))); } - int ret; while (collect(&ret)) { if (ret < 0) { - return set_state(RGWCoroutine_Error); + yield call(sync_env->error_logger->log_error_cr(sync_env->conn->get_remote_id(), "data.init", "", + -ret, string("failed to store sync status: ") + cpp_strerror(-ret))); + req_ret = ret; } yield; } drain_all(); + if (req_ret < 0) { + yield return set_cr_error(req_ret); + } yield return set_cr_done(); } return 0; -- 2.39.5