if (!obs.exists || obs.oi.is_whiteout())
return -ENOENT;
- t.remove(coll, soid);
-
if (oi.size > 0) {
interval_set<uint64_t> ch;
ch.insert(0, oi.size);
ctx->modified_ranges.union_of(ch);
}
- ctx->delta_stats.num_objects--;
+ ctx->delta_stats.num_wr++;
ctx->delta_stats.num_bytes -= oi.size;
-
oi.size = 0;
+
+ // cache: writeback: set whiteout on delete?
+ if (pool.info.cache_mode == pg_pool_t::CACHEMODE_WRITEBACK) {
+ dout(20) << __func__ << " setting whiteout on " << soid << dendl;
+ oi.set_flag(object_info_t::FLAG_WHITEOUT);
+ t.truncate(coll, soid, 0);
+ t.omap_clear(coll, soid);
+ t.rmattrs(coll, soid);
+ return 0;
+ }
+
+ t.remove(coll, soid);
+ ctx->delta_stats.num_objects--;
snapset.head_exists = false;
obs.exists = false;
-
- ctx->delta_stats.num_wr++;
return 0;
}
IoCtx base_ioctx;
ASSERT_EQ(0, cluster.ioctx_create(base_pool_name.c_str(), base_ioctx));
+ // create object
+ {
+ bufferlist bl;
+ bl.append("hi there");
+ ObjectWriteOperation op;
+ op.write_full(bl);
+ ASSERT_EQ(0, base_ioctx.operate("foo", &op));
+ }
+
// configure cache
bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
cluster.wait_for_latest_osdmap();
// create some whiteouts, verify they behave
- ASSERT_EQ(-ENOENT, base_ioctx.remove("foo"));
+ ASSERT_EQ(0, base_ioctx.remove("foo"));
+
ASSERT_EQ(-ENOENT, base_ioctx.remove("bar"));
- ASSERT_EQ(-ENOENT, base_ioctx.remove("foo"));
ASSERT_EQ(-ENOENT, base_ioctx.remove("bar"));
// verify the whiteouts are there in the cache tier
ASSERT_TRUE(it == cache_ioctx.objects_end());
}
+ ASSERT_EQ(-ENOENT, base_ioctx.remove("foo"));
+
// tear down tiers
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + base_pool_name +