ceph_test_rados_tier: add test case for delete+create compound ops

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>
This commit is contained in:
Sage Weil 2015-03-16 11:22:54 -07:00
parent a69055f7d5
commit 53cc492bee

View 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
{