]> git.apps.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)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Wed, 21 Oct 2015 11:59:16 +0000 (17:29 +0530)
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>
(cherry picked from commit 049ea702b9bf4a8a62ae2770d9ba55c0730b3eef)

src/osd/ReplicatedPG.cc
src/osd/osd_types.h

index e1d0acf50892893e6ae3f56fb8b97b5e7d685993..c1735d31029626b3f79f8fa9e8c91c8909eac9a6 100644 (file)
@@ -4047,9 +4047,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;
 
@@ -5577,7 +5581,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 b9b3b8150ab97759219199875072505dacb0defe..52d45d293a1e74c5aab438dd0ea89e4dbca5782c 100644 (file)
@@ -2836,12 +2836,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)";
 }