]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add pgls start_epoch field
authorSage Weil <sage.weil@dreamhost.com>
Thu, 12 May 2011 00:55:00 +0000 (17:55 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Thu, 12 May 2011 00:55:00 +0000 (17:55 -0700)
If the pgls.start_epoch is set, the cookie is only considered valid if the
osd pg interval has not changed since then.  If it has, then the cookie
is no longer valid and is ignored, effectively restarting the pgls process.

Old clients never set this and are unaffected.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/rados.h
src/osd/ReplicatedPG.cc
src/osd/osd_types.h

index 09dc3e097dd15354fce24a0da080be77ec9b8c10..59d619df4636fc959d6f2b87621c7556b7cd536a 100644 (file)
@@ -379,6 +379,7 @@ struct ceph_osd_op {
                } __attribute__ ((packed)) cls;
                struct {
                        __le64 cookie, count;
+                       __le32 start_epoch; /* for the pgls sequence */
                } __attribute__ ((packed)) pgls;
                struct {
                        __le64 snapid;
index 16278df336e4e75af9266ae80f1619634c886d50..e7840caadaacbabe5db9885ce1dcbdcbd427537a 100644 (file)
@@ -263,6 +263,15 @@ void ReplicatedPG::do_pg_op(MOSDOp *op)
         PGLSResponse response;
         response.handle = (collection_list_handle_t)(uint64_t)(p->op.pgls.cookie);
 
+       // reset cookie?
+       if (p->op.pgls.start_epoch &&
+           p->op.pgls.start_epoch < info.history.same_primary_since) {
+         dout(10) << " pgls sequence started epoch " << p->op.pgls.start_epoch
+                  << " < same_primary_since " << info.history.same_primary_since
+                  << ", resetting cookie" << dendl;
+         response.handle = 0;
+       }
+
        uint64_t high_bit = 1ull << 63;
        if ((response.handle & high_bit) == 0) {
          // it's an offset into the missing set
index 3f034642ec2259cfc50c1ab2cd269f0b2cbaa275..c3eccc76dfa9990be6c7b11ff26a66ba0a75048d 100644 (file)
@@ -1554,6 +1554,14 @@ inline ostream& operator<<(ostream& out, const OSDOp& op) {
       out << ".";
       op.data.write(op.op.cls.class_len, op.op.cls.method_len, out);
     }
+  } else if (ceph_osd_op_type_pg(op.op.op)) {
+    switch (op.op.op) {
+    case CEPH_OSD_OP_PGLS:
+    case CEPH_OSD_OP_PGLS_FILTER:
+      out << " cookie " << op.op.pgls.cookie;
+      out << " start_epoch " << op.op.pgls.start_epoch;
+      break;
+    }
   }
   return out;
 }