]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, librados: distinguish between old and new watchers
authorSage Weil <sage@redhat.com>
Sat, 8 Nov 2014 01:47:09 +0000 (17:47 -0800)
committerSage Weil <sage@redhat.com>
Thu, 4 Dec 2014 18:32:38 +0000 (10:32 -0800)
Use a new watch op code that is different from the legacy one so we can
tell when the client is doing all the new stuff (like sending pings).

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

index fac5ffc0075ffed0feb385dc29abb2825c75158b..f8bba2a1cc67b25bc0d638556f0a5ac456973851 100644 (file)
@@ -448,11 +448,12 @@ enum {
 
 enum {
        CEPH_OSD_WATCH_OP_UNWATCH = 0,
-       CEPH_OSD_WATCH_OP_WATCH = 1,
+       CEPH_OSD_WATCH_OP_LEGACY_WATCH = 1,
        /* note: use only ODD ids to prevent pre-giant code from
           interpreting the op as UNWATCH */
-       CEPH_OSD_WATCH_OP_RECONNECT = 3,
-       CEPH_OSD_WATCH_OP_PING = 5,
+       CEPH_OSD_WATCH_OP_WATCH = 3,
+       CEPH_OSD_WATCH_OP_RECONNECT = 5,
+       CEPH_OSD_WATCH_OP_PING = 7,
 };
 
 const char *ceph_osd_watch_op_name(int o);
index 084f85102f2e757e3c87ef200ca89aaee4701f9a..7aaf07080fccd29c2efab06c5869970f64431c71 100644 (file)
@@ -4303,7 +4303,8 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
 
        watch_info_t w(cookie, cct->_conf->osd_client_watch_timeout,
          ctx->op->get_req()->get_connection()->get_peer_addr());
-       if (op.watch.op == CEPH_OSD_WATCH_OP_WATCH) {
+       if (op.watch.op == CEPH_OSD_WATCH_OP_WATCH ||
+           op.watch.op == CEPH_OSD_WATCH_OP_LEGACY_WATCH) {
          if (oi.watchers.count(make_pair(cookie, entity))) {
            dout(10) << " found existing watch " << w << " by " << entity << dendl;
          } else {