From: Samuel Just Date: Sun, 29 Mar 2015 22:46:59 +0000 (-0700) Subject: ECTransaction: write out the hinfo key on touch as well X-Git-Tag: v0.94~3^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4250%2Fhead;p=ceph.git 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 --- diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc index 0a2af7d9bd77..e1cf3868dfb0 100644 --- a/src/osd/ECTransaction.cc +++ b/src/osd/ECTransaction.cc @@ -28,7 +28,9 @@ struct AppendObjectsGenerator: public boost::static_visitor { 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 { 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) {