]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/tools/rebuild_mondb.cc
import ceph 14.2.5
[ceph.git] / ceph / src / tools / rebuild_mondb.cc
index 7704bd2507b0391e8ae60a4f02d78a776dbc62d7..8e3d5b45888024813bf35a1cf422fe5a61d0c057 100644 (file)
@@ -244,13 +244,13 @@ int update_osdmap(ObjectStore& fs, OSDSuperblock& sb, MonitorDBStore& ms)
     uint32_t crc = -1;
     uint64_t features = 0;
     // add inc maps
-    {
+    auto add_inc_result = [&] {
       const auto oid = OSD::get_inc_osdmap_pobject_name(e);
       bufferlist bl;
       int nread = fs.read(ch, oid, 0, 0, bl);
       if (nread <= 0) {
-        cerr << "missing " << oid << std::endl;
-        return -EINVAL;
+        cout << "missing " << oid << std::endl;
+        return -ENOENT;
       }
       t->put(prefix, e, bl);
 
@@ -277,6 +277,18 @@ int update_osdmap(ObjectStore& fs, OSDSuperblock& sb, MonitorDBStore& ms)
           // inc.decode() verifies `inc_crc`, so it's been taken care of.
         }
       }
+      return 0;
+    }();
+    switch (add_inc_result) {
+    case -ENOENT:
+      // no worries, we always have full map
+      break;
+    case -EINVAL:
+      return -EINVAL;
+    case 0:
+      break;
+    default:
+      assert(0);
     }
     // add full maps
     {