]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
KeyValueStore: Add clone op detect to promote error 2710/head
authorHaomai Wang <haomaiwang@gmail.com>
Thu, 16 Oct 2014 02:03:42 +0000 (10:03 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Mon, 20 Oct 2014 05:26:20 +0000 (13:26 +0800)
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/os/KeyValueStore.cc

index daa8b059bcae3b4ddfd5e5bea3d38ae9383ecde3..59e9eb2b5855157edc37b9acd93720613eeb8c5b 100644 (file)
@@ -1182,6 +1182,7 @@ unsigned KeyValueStore::_do_transaction(Transaction& transaction,
 
   Transaction::iterator i = transaction.begin();
   uint64_t op_num = 0;
+  bool exist_clone = false;
 
   while (i.have_op()) {
     if (handle)
@@ -1302,6 +1303,7 @@ unsigned KeyValueStore::_do_transaction(Transaction& transaction,
         coll_t cid = i.decode_cid();
         ghobject_t oid = i.decode_oid();
         ghobject_t noid = i.decode_oid();
+        exist_clone = true;
         r = _clone(cid, oid, noid, t);
       }
       break;
@@ -1313,6 +1315,7 @@ unsigned KeyValueStore::_do_transaction(Transaction& transaction,
         ghobject_t noid = i.decode_oid();
         uint64_t off = i.decode_length();
         uint64_t len = i.decode_length();
+        exist_clone = true;
         r = _clone_range(cid, oid, noid, off, len, off, t);
       }
       break;
@@ -1325,6 +1328,7 @@ unsigned KeyValueStore::_do_transaction(Transaction& transaction,
         uint64_t srcoff = i.decode_length();
         uint64_t len = i.decode_length();
         uint64_t dstoff = i.decode_length();
+        exist_clone = true;
         r = _clone_range(cid, oid, noid, srcoff, len, dstoff, t);
       }
       break;
@@ -1514,18 +1518,20 @@ unsigned KeyValueStore::_do_transaction(Transaction& transaction,
     if (r < 0) {
       bool ok = false;
 
+      if (r == -ENOENT && !(op == Transaction::OP_CLONERANGE ||
+                            op == Transaction::OP_CLONE ||
+                            op == Transaction::OP_CLONERANGE2))
+        // -ENOENT is normally okay
+        // ...including on a replayed OP_RMCOLL with checkpoint mode
+        ok = true;
       if (r == -ENODATA)
         ok = true;
 
       if (!ok) {
         const char *msg = "unexpected error code";
 
-        if (op == Transaction::OP_CLONERANGE ||
-            op == Transaction::OP_CLONE ||
-            op == Transaction::OP_CLONERANGE2) {
+        if (exist_clone) {
           dout(0) << "BUG: clone failed will lead to paritial transaction applied" << dendl;
-          if (r == -ENOENT)
-            msg = "ENOENT on clone suggests osd bug";
         }
 
         if (r == -ENOSPC)