summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sjust@redhat.com>2015-03-29 15:46:59 -0700
committerSamuel Just <sjust@redhat.com>2015-03-31 08:30:10 -0700
commitbdc664fb3d2d363ca55b0761c9054294315f054f (patch)
treec914141111955c06543e3393278cd5424f899ff3
parent59143d141ccb4d36e8ede878c0e317ff8a5f6932 (diff)
downloadceph-bdc664fb3d2d363ca55b0761c9054294315f054f.tar.gz
ECTransaction: write out the hinfo key on touch as well
This way, even empty objects have the hinfo key written. That way, touch and touch->append->truncate end up with the same state. Fixes: 11265 Signed-off-by: Samuel Just <sjust@redhat.com>
-rw-r--r--src/osd/ECTransaction.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc
index 0a2af7d9bd7..e1cf3868dfb 100644
--- a/src/osd/ECTransaction.cc
+++ b/src/osd/ECTransaction.cc
@@ -28,7 +28,9 @@ struct AppendObjectsGenerator: public boost::static_visitor<void> {
void operator()(const ECTransaction::AppendOp &op) {
out->insert(op.oid);
}
- void operator()(const ECTransaction::TouchOp &op) {}
+ void operator()(const ECTransaction::TouchOp &op) {
+ out->insert(op.oid);
+ }
void operator()(const ECTransaction::CloneOp &op) {
out->insert(op.source);
out->insert(op.target);
@@ -114,6 +116,20 @@ struct TransGenerator : public boost::static_visitor<void> {
i->second.touch(
get_coll_ct(i->first, op.oid),
ghobject_t(op.oid, ghobject_t::NO_GEN, i->first));
+
+ /* No change, but write it out anyway in case the object did not
+ * previously exist. */
+ assert(hash_infos.count(op.oid));
+ ECUtil::HashInfoRef hinfo = hash_infos[op.oid];
+ bufferlist hbuf;
+ ::encode(
+ *hinfo,
+ hbuf);
+ i->second.setattr(
+ get_coll_ct(i->first, op.oid),
+ ghobject_t(op.oid, ghobject_t::NO_GEN, i->first),
+ ECUtil::get_hinfo_key(),
+ hbuf);
}
}
void operator()(const ECTransaction::AppendOp &op) {