]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_idempotent_sequence: make get-last-op return 0 if no txns applied
authorSage Weil <sage.weil@dreamhost.com>
Thu, 12 Apr 2012 23:14:44 +0000 (16:14 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Sat, 14 Apr 2012 03:38:24 +0000 (20:38 -0700)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/test/filestore_test/test_idempotent_sequence.cc

index ffb84ddf5b2f2a1b2d10ab0d02f80af93af2dd28..78eaa19f9772dac749823f2bde883348d064af9e 100644 (file)
@@ -301,9 +301,11 @@ int run_get_last_op(std::string& filestore_path, std::string& journal_path)
   hobject_t txn_object(sobject_t("txn", CEPH_NOSNAP));
   bufferlist bl;
   store->read(txn_coll, txn_object, 0, 100, bl);
-  bufferlist::iterator p = bl.begin();
-  int32_t txn;
-  ::decode(txn, p);
+  int32_t txn = 0;
+  if (bl.length()) {
+    bufferlist::iterator p = bl.begin();
+    ::decode(txn, p);
+  }
 
   store->umount();
   delete store;