]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: cannot re-init an orphan scan job
authorYehuda Sadeh <yehuda@redhat.com>
Sun, 3 May 2015 00:28:30 +0000 (17:28 -0700)
committerLoic Dachary <ldachary@redhat.com>
Sun, 30 Aug 2015 15:55:59 +0000 (17:55 +0200)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit f8993102731518153bb18eb74c3e6e4943a5dbac)

src/rgw/rgw_admin.cc
src/rgw/rgw_orphan.cc

index d9bbb681e15571f94cbf918986397e65412de25b..7008d6544ef12818eb08803cd423c94dc428a50a 100644 (file)
@@ -2598,6 +2598,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();
index 9e8e5b8f88e2e3395f5aa01f81c7695df1c5eae9..47721c8a52d9843a404e43681ee1bc43eda7ca8b 100644 (file)
@@ -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;
       }