From bdc664fb3d2d363ca55b0761c9054294315f054f Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Sun, 29 Mar 2015 15:46:59 -0700 Subject: [PATCH] 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 --- src/osd/ECTransaction.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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) { -- 2.47.3