From: Yehuda Sadeh Date: Sun, 3 May 2015 00:28:30 +0000 (-0700) Subject: rgw: cannot re-init an orphan scan job X-Git-Tag: v9.0.3~76^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f8993102731518153bb18eb74c3e6e4943a5dbac;p=ceph.git rgw: cannot re-init an orphan scan job Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 6f04fd2a70cc..c353b1ee7d66 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2571,6 +2571,12 @@ next: int ret = search.init(job_id, pinfo); if (ret < 0) { + if (ret == -EEXIST) { + cerr << "cannot init new search, job already exists" << std::endl; + } + if (ret == -ENOENT) { + cerr << "job not found" << std::endl; + } return -ret; } ret = search.run(); diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc index 9e8e5b8f88e2..47721c8a52d9 100644 --- a/src/rgw/rgw_orphan.cc +++ b/src/rgw/rgw_orphan.cc @@ -106,8 +106,6 @@ int RGWOrphanStore::init() return r; } - - return 0; } @@ -148,6 +146,13 @@ int RGWOrphanSearch::init(const string& job_name, RGWOrphanSearchInfo *info) { search_info.job_name = job_name; search_info.num_shards = (info->num_shards ? info->num_shards : DEFAULT_NUM_SHARDS); search_stage = RGWOrphanSearchStage(ORPHAN_SEARCH_STAGE_INIT); + + RGWOrphanSearchState state; + r = orphan_store.read_job(job_name, state); + if (r >= 0) { + lderr(store->ctx()) << "ERROR: job already exists" << dendl; + return -EEXIST; + } r = save_state(); if (r < 0) { lderr(store->ctx()) << "ERROR: failed to write state ret=" << r << dendl; @@ -634,7 +639,6 @@ int RGWOrphanSearch::compare_oid_indexes() if (cur_linked == key_fp) { ldout(store->ctx(), 20) << "linked: " << key << dendl; - cout << "good: " << key << std::endl; continue; }