]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ECTransaction: write out the hinfo key on touch as well 4250/head
authorSamuel Just <sjust@redhat.com>
Sun, 29 Mar 2015 22:46:59 +0000 (15:46 -0700)
committerSamuel Just <sjust@redhat.com>
Tue, 31 Mar 2015 15:30:10 +0000 (08:30 -0700)
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>
src/osd/ECTransaction.cc

index 0a2af7d9bd77457f664465647cdcfa9758a5a266..e1cf3868dfb087bfe6809dbf4f7696cc4cc0c16f 100644 (file)
@@ -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) {