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>
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;
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 =
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)";
}