From: Haomai Wang Date: Thu, 16 Oct 2014 02:03:42 +0000 (+0800) Subject: KeyValueStore: Add clone op detect to promote error X-Git-Tag: v0.88~51^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2710%2Fhead;p=ceph.git KeyValueStore: Add clone op detect to promote error Signed-off-by: Haomai Wang --- diff --git a/src/os/KeyValueStore.cc b/src/os/KeyValueStore.cc index daa8b059bcae..59e9eb2b5855 100644 --- a/src/os/KeyValueStore.cc +++ b/src/os/KeyValueStore.cc @@ -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)