]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: reply to notify request with our unique notify_id
authorSage Weil <sage@redhat.com>
Thu, 1 Oct 2015 18:50:00 +0000 (14:50 -0400)
committerSage Weil <sage@redhat.com>
Thu, 1 Oct 2015 18:50:00 +0000 (14:50 -0400)
The OSD assigns a unique ID to each notify it queues for
processing.  Include this in the reply to the notifier so that
they can match it up with the eventual completions they receive.

This is necessary to distinguish between multiple completions
they may receive if there is PG peering and the notify is resent.
In particular, an earlier notify may return an error when a later
attempt succeeds.

This is forwards and backwards compatible: new clients will make use of
this reply payload but older clients ignore it.

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

index 857ed09b38af65f974020ab0e34c2d2a325dc60b..f294401e5c3c14abb45bdcd15c6ffdfff3acbe57 100644 (file)
@@ -4527,9 +4527,13 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
 
        notify_info_t n;
        n.timeout = timeout;
+       n.notify_id = osd->get_next_id(get_osdmap()->get_epoch());
        n.cookie = op.watch.cookie;
         n.bl = bl;
        ctx->notifies.push_back(n);
+
+       // return our unique notify id to the client
+       ::encode(n.notify_id, osd_op.outdata);
       }
       break;
 
@@ -6058,7 +6062,7 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn)
        p->bl,
        p->timeout,
        p->cookie,
-       osd->get_next_id(get_osdmap()->get_epoch()),
+       p->notify_id,
        ctx->obc->obs.oi.user_version,
        osd));
     for (map<pair<uint64_t, entity_name_t>, WatchRef>::iterator i =
index 828485340908e30194aef969d16f371ae1db9c18..d51c894632bbd99064eee2cb6541eec468d311b8 100644 (file)
@@ -2981,12 +2981,15 @@ static inline ostream& operator<<(ostream& out, const watch_info_t& w) {
 
 struct notify_info_t {
   uint64_t cookie;
+  uint64_t notify_id;
   uint32_t timeout;
   bufferlist bl;
 };
 
 static inline ostream& operator<<(ostream& out, const notify_info_t& n) {
-  return out << "notify(cookie " << n.cookie << " " << n.timeout << "s)";
+  return out << "notify(cookie " << n.cookie
+            << " notify" << n.notify_id
+            << " " << n.timeout << "s)";
 }