]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: retry read_log_info() while master is down 8453/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 4 Apr 2016 20:56:04 +0000 (16:56 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 5 Apr 2016 18:07:22 +0000 (14:07 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_sync.cc

index 38f92edb98a452a6633f7827c01b9e70a6004380..922a9048a6c43ed1e483d6cad9b014b39511b272 100644 (file)
@@ -1868,13 +1868,28 @@ int RGWRemoteMetaLog::run_sync()
   }
 
   RGWObjectCtx obj_ctx(store, NULL);
+  int r = 0;
 
   // get shard count and oldest log period from master
   rgw_mdlog_info mdlog_info;
-  int r = read_log_info(&mdlog_info);
-  if (r < 0) {
-    lderr(store->ctx()) << "ERROR: fail to fetch master log info (r=" << r << ")" << dendl;
-    return r;
+  for (;;) {
+    if (going_down.read()) {
+      ldout(store->ctx(), 1) << __func__ << "(): going down" << dendl;
+      return 0;
+    }
+    r = read_log_info(&mdlog_info);
+    if (r == -EIO) {
+      // keep retrying if master isn't alive
+      ldout(store->ctx(), 10) << __func__ << "(): waiting for master.." << dendl;
+      backoff.backoff_sleep();
+      continue;
+    }
+    backoff.reset();
+    if (r < 0) {
+      lderr(store->ctx()) << "ERROR: fail to fetch master log info (r=" << r << ")" << dendl;
+      return r;
+    }
+    break;
   }
 
   do {
@@ -1924,7 +1939,7 @@ int RGWRemoteMetaLog::run_sync()
   auto num_shards = sync_status.sync_info.num_shards;
   if (num_shards != mdlog_info.num_shards) {
     lderr(store->ctx()) << "ERROR: can't sync, mismatch between num shards, master num_shards=" << mdlog_info.num_shards << " local num_shards=" << num_shards << dendl;
-    return r;
+    return -EINVAL;
   }
 
   RGWPeriodHistory::Cursor cursor;