]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_test_rados_tier: add test case for delete+create compound ops
authorSage Weil <sage@redhat.com>
Mon, 16 Mar 2015 18:22:54 +0000 (11:22 -0700)
committerSage Weil <sage@redhat.com>
Mon, 16 Mar 2015 18:35:43 +0000 (11:35 -0700)
This triggers #11123, originally observed when rgw does a delete + create
sequence in a single op and the whiteout gets left behind.

Signed-off-by: Sage Weil <sage@redhat.com>
src/test/librados/tier.cc

index f7d6bf014a4ad388a6046d7f05709bc98eefe48f..208380bc7b9d15ab42865d5b352ed5360604fb85 100644 (file)
@@ -670,6 +670,51 @@ TEST_F(LibRadosTwoPoolsPP, Whiteout) {
   }
 }
 
+TEST_F(LibRadosTwoPoolsPP, WhiteoutDeleteCreate) {
+  // configure cache
+  bufferlist inbl;
+  ASSERT_EQ(0, cluster.mon_command(
+    "{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
+    "\", \"tierpool\": \"" + cache_pool_name +
+    "\", \"force_nonempty\": \"--force-nonempty\" }",
+    inbl, NULL, NULL));
+  ASSERT_EQ(0, cluster.mon_command(
+    "{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
+    "\", \"overlaypool\": \"" + cache_pool_name + "\"}",
+    inbl, NULL, NULL));
+  ASSERT_EQ(0, cluster.mon_command(
+    "{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
+    "\", \"mode\": \"writeback\"}",
+    inbl, NULL, NULL));
+
+  // wait for maps to settle
+  cluster.wait_for_latest_osdmap();
+
+  // create an object
+  {
+    bufferlist bl;
+    bl.append("foo");
+    ASSERT_EQ(0, ioctx.write_full("foo", bl));
+  }
+
+  // do delete + create operation
+  {
+    ObjectWriteOperation op;
+    op.remove();
+    bufferlist bl;
+    bl.append("bar");
+    op.write_full(bl);
+    ASSERT_EQ(0, ioctx.operate("foo", &op));
+  }
+
+  // verify it still "exists" (w/ new content)
+  {
+    bufferlist bl;
+    ASSERT_EQ(1, ioctx.read("foo", bl, 1, 0));
+    ASSERT_EQ('b', bl[0]);
+  }
+}
+
 TEST_F(LibRadosTwoPoolsPP, Evict) {
   // create object
   {