]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: remove failed notify
authorSage Weil <sage@redhat.com>
Tue, 18 Nov 2014 23:35:28 +0000 (15:35 -0800)
committerSage Weil <sage@redhat.com>
Thu, 4 Dec 2014 18:39:20 +0000 (10:39 -0800)
Decided this wasn't useful.

Signed-off-by: Sage Weil <sage@redhat.com>
13 files changed:
src/common/ceph_strings.cc
src/include/ceph_fs.h
src/include/rados/librados.h
src/include/rados/librados.hpp
src/librados/IoCtxImpl.cc
src/librados/librados.cc
src/osd/Watch.cc
src/osd/Watch.h
src/osdc/Objecter.cc
src/osdc/Objecter.h
src/test/librados/watch_notify.cc
src/test/osd/RadosModel.h
src/tools/rados/rados.cc

index 02359b7b0905f7ad9f6fd0d231ca07b46ef39f78..41203bc23fcebf039d7768183bb3b0c77a64c78f 100644 (file)
@@ -185,7 +185,6 @@ const char *ceph_watch_event_name(int e)
        switch (e) {
        case CEPH_WATCH_EVENT_NOTIFY: return "notify";
        case CEPH_WATCH_EVENT_NOTIFY_COMPLETE: return "notify_complete";
-       case CEPH_WATCH_EVENT_FAILED_NOTIFY: return "failed_notify";
        case CEPH_WATCH_EVENT_DISCONNECT: return "disconnect";
        }
        return "???";
index 6bca7b2d1e191d8a2167b3677afec5d60d8a1463..838394d5db25b1dff743564305022d9756e3864a 100644 (file)
@@ -132,8 +132,7 @@ struct ceph_dir_layout {
 enum {
        CEPH_WATCH_EVENT_NOTIFY           = 1, /* notifying watcher */
        CEPH_WATCH_EVENT_NOTIFY_COMPLETE  = 2, /* notifier notified when done */
-       CEPH_WATCH_EVENT_FAILED_NOTIFY    = 3, /* we made a notify time out */
-       CEPH_WATCH_EVENT_DISCONNECT       = 4, /* we were disconnected */
+       CEPH_WATCH_EVENT_DISCONNECT       = 3, /* we were disconnected */
 };
 
 const char *ceph_watch_event_name(int o);
index ccf6a04924302b5135a0256fc4dc2d0d452da127..946d78a9ba153730647fda253cbe3d916ec9a253 100644 (file)
@@ -1894,22 +1894,6 @@ typedef void (*rados_watchcb2_t)(void *arg,
                                 void *data,
                                 size_t data_len);
 
-/**
- * @typedef rados_watchfailcb_t
- *
- * Callback activated when a notify is not acked in a timely manner,
- * resulting in a timeout for the notifier.
- *
- * @param arg opaque user-defined value provided to rados_watch2()
- * @param notify_id an id for this notify event
- * @param handle the watcher handle we are notifying
- * @param notifier_id the unique client id for the notifier
- */
-typedef void (*rados_watchfailcb_t)(void *arg,
-                                   uint64_t notify_id,
-                                   uint64_t handle,
-                                   uint64_t notifier_id);
-
 /**
  * @typedef rados_watcherrcb_t
  *
@@ -1972,14 +1956,12 @@ CEPH_RADOS_API int rados_watch(rados_ioctx_t io, const char *o, uint64_t ver,
  * @param o the object to watch
  * @param cookie where to store the internal id assigned to this watch
  * @param watchcb2 what to do when a notify is received on this object
- * @param watchfailcb what to do when a notify is not acked in time
  * @param watcherrcb what to do when the watch session encounters an error
  * @param arg opaque value to pass to the callback
  * @returns 0 on success, negative error code on failure
  */
 CEPH_RADOS_API int rados_watch2(rados_ioctx_t io, const char *o, uint64_t *cookie,
                                rados_watchcb2_t watchcb,
-                               rados_watchfailcb_t watchfailcb,
                                rados_watcherrcb_t watcherrcb,
                                void *arg);
 
@@ -1997,7 +1979,7 @@ CEPH_RADOS_API int rados_watch2(rados_ioctx_t io, const char *o, uint64_t *cooki
  * @param cookie the watch handle
  * @returns ms since last confirmed on success, negative error code on failure
  */
-int rados_watch_check(rados_ioctx_t io, uint64_t cookie);
+CEPH_RADOS_API int rados_watch_check(rados_ioctx_t io, uint64_t cookie);
 
 /**
  * Unregister an interest in an object
index 235479e00f056b832a35fd7aab8f65f31221e985..967308372a0b1c0df44d6529943e9e14d8ed6e98 100644 (file)
@@ -168,21 +168,6 @@ namespace librados
                               uint64_t notifier_id,
                               bufferlist& bl) = 0;
 
-    /**
-     * Callback activated when we are too slow to ack a notify
-     *
-     * If we fail to ack a notify or our ack doesn't arrive in time
-     * and a notify timeout is triggered for another client, this
-     * callback will be triggered to let us know about it.
-     *
-     * @param notify_id unique id for this notify event
-     * @param cookie the watcher we are notifying
-     * @param notifier_id the unique client id of the notifier
-     */
-    virtual void handle_failed_notify(uint64_t notify_id,
-                                     uint64_t cookie,
-                                     uint64_t notifier_id) = 0;
-
     /**
      * Callback activated when we encounter an error with the watch.
      *
index 921d19f4e9551c77648aaac87dc952a204e46711..6c43aa177c1b0cedcd1c709a7e3e686bec516a5c 100644 (file)
@@ -1062,16 +1062,6 @@ struct WatchInfo : public Objecter::WatchContext {
       ioctx->notify_ack(oid, notify_id, cookie, empty);
     }
   }
-  void handle_failed_notify(uint64_t notify_id,
-                           uint64_t cookie,
-                           uint64_t notifier_id) {
-    ldout(ioctx->client->cct, 10) << __func__ << " " << notify_id
-                                 << " cookie " << cookie
-                                 << " notifier_id " << notifier_id
-                                 << dendl;
-    if (ctx2)
-      ctx2->handle_failed_notify(notify_id, cookie, notifier_id);
-  }
   void handle_error(uint64_t cookie, int err) {
     ldout(ioctx->client->cct, 10) << __func__ << " cookie " << cookie
                                  << " err " << err
index 8402475e5d70280c8a0e6d10d27663b1af3f217f..3c45d1f70565bc410265a0a4a6c4f88dcf35e0ea 100644 (file)
@@ -3780,25 +3780,17 @@ extern "C" int rados_watch(rados_ioctx_t io, const char *o, uint64_t ver,
 
 struct C_WatchCB2 : public librados::WatchCtx2 {
   rados_watchcb2_t wcb;
-  rados_watchfailcb_t failcb;
   rados_watcherrcb_t errcb;
   void *arg;
   C_WatchCB2(rados_watchcb2_t _wcb,
-            rados_watchfailcb_t _failcb,
             rados_watcherrcb_t _errcb,
-            void *_arg) : wcb(_wcb), failcb(_failcb), errcb(_errcb), arg(_arg) {}
+            void *_arg) : wcb(_wcb), errcb(_errcb), arg(_arg) {}
   void handle_notify(uint64_t notify_id,
                     uint64_t cookie,
                     uint64_t notifier_gid,
                     bufferlist& bl) {
     wcb(arg, notify_id, cookie, notifier_gid, bl.c_str(), bl.length());
   }
-  void handle_failed_notify(uint64_t notify_id,
-                           uint64_t cookie,
-                           uint64_t notifier_gid) {
-    if (failcb)
-      failcb(arg, notify_id, cookie, notifier_gid);
-  }
   void handle_error(uint64_t cookie, int err) {
     if (errcb)
       errcb(arg, cookie, err);
@@ -3807,7 +3799,6 @@ struct C_WatchCB2 : public librados::WatchCtx2 {
 
 extern "C" int rados_watch2(rados_ioctx_t io, const char *o, uint64_t *handle,
                            rados_watchcb2_t watchcb,
-                           rados_watchfailcb_t watchfailcb,
                            rados_watcherrcb_t watcherrcb,
                            void *arg)
 {
@@ -3819,7 +3810,7 @@ extern "C" int rados_watch2(rados_ioctx_t io, const char *o, uint64_t *handle,
     uint64_t *cookie = handle;
     librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
     object_t oid(o);
-    C_WatchCB2 *wc = new C_WatchCB2(watchcb, watchfailcb, watcherrcb, arg);
+    C_WatchCB2 *wc = new C_WatchCB2(watchcb, watcherrcb, arg);
     ret = ctx->watch(oid, cookie, NULL, wc);
   }
   tracepoint(librados, rados_watch_exit, ret, handle ? *handle : 0);
index cdce052bf65456595a6ed7cb94d5d037d098e771..aab917edd576dd5817da0aa728a10669effb337b 100644 (file)
@@ -186,7 +186,6 @@ void Notify::maybe_complete_notify()
     ::encode(notify_replies, bl);
     list<pair<uint64_t,uint64_t> > missed;
     for (set<WatchRef>::iterator p = watchers.begin(); p != watchers.end(); ++p) {
-      (*p)->send_failed_notify(this);
       missed.push_back(make_pair((*p)->get_watcher_gid(),
                                 (*p)->get_cookie()));
     }
@@ -477,17 +476,6 @@ void Watch::send_notify(NotifyRef notif)
   conn->send_message(notify_msg);
 }
 
-void Watch::send_failed_notify(Notify *notif)
-{
-  if (!conn)
-    return;
-  bufferlist empty;
-  MWatchNotify *reply(new MWatchNotify(cookie, notif->version, notif->notify_id,
-                                      CEPH_WATCH_EVENT_FAILED_NOTIFY, empty));
-  reply->notifier_gid = notif->client_gid;
-  conn->send_message(reply);
-}
-
 void Watch::send_disconnect()
 {
   if (!conn)
index 9dc468255104ee65ca3d1ff4928a6ee141d34da4..1a76691125d44de2a36c258a651d498afd9c50a0 100644 (file)
@@ -203,9 +203,6 @@ public:
     return conn.get() != NULL;
   }
 
-  /// send a failed notify message
-  void send_failed_notify(Notify *notif);
-
   /// send a disconnect notice to the client
   void send_disconnect();
 
index 4540017ea0a237105c61010ed2f426128136a961..d32f660fef812ebe7f85145be11da8b757c8ec2c 100644 (file)
@@ -791,11 +791,6 @@ void Objecter::_do_watch_notify(LingerOp *info, MWatchNotify *m)
                                       m->notifier_gid, m->bl);
     break;
 
-  case CEPH_WATCH_EVENT_FAILED_NOTIFY:
-    info->watch_context->handle_failed_notify(m->notify_id, m->cookie,
-                                             m->notifier_gid);
-    break;
-
   case CEPH_WATCH_EVENT_DISCONNECT:
     info->watch_context->handle_error(m->cookie, -ENOTCONN);
     break;
index b2249f928996bd3706c9c80fc7d8c4701c5dd813..f7006ec4fb0e0ebcacc0e06e623d565443c470ff 100644 (file)
@@ -1453,9 +1453,6 @@ public:
                               uint64_t cookie,
                               uint64_t notifier_id,
                               bufferlist& bl) = 0;
-    virtual void handle_failed_notify(uint64_t notify_id,
-                                     uint64_t cookie,
-                                     uint64_t notifier_id) = 0;
     virtual void handle_error(uint64_t cookie, int err) = 0;
     virtual ~WatchContext() {}
   };
index 12ccac321b85fe0695b0de3bc190505fb28d0a45..c81311e4387a793587726069d04c26358726e489 100644 (file)
@@ -45,7 +45,6 @@ std::set<uint64_t> notify_cookies;
 rados_ioctx_t notify_io;
 const char *notify_oid = 0;
 int notify_err = 0;
-bool notify_failed = false;
 
 static void watch_notify2_test_cb(void *arg,
                                  uint64_t notify_id,
@@ -65,16 +64,6 @@ static void watch_notify2_test_cb(void *arg,
   rados_notify_ack(notify_io, notify_oid, notify_id, cookie, "reply", 5);
 }
 
-static void watch_notify2_test_failcb(void *arg,
-                                     uint64_t notify_id,
-                                     uint64_t cookie,
-                                     uint64_t notifier_gid)
-{
-  std::cout << __func__ << " from " << notifier_gid << " notify_id " << notify_id
-           << " cookie " << cookie << std::endl;
-  notify_failed = true;
-}
-
 static void watch_notify2_test_errcb(void *arg, uint64_t cookie, int err)
 {
   std::cout << __func__ << " cookie " << cookie << std::endl;
@@ -98,13 +87,6 @@ public:
     notify_ioctx->notify_ack(notify_oid, notify_id, cookie, reply);
   }
 
-  void handle_failed_notify(uint64_t notify_id, uint64_t cookie,
-                           uint64_t notifier_gid) {
-    std::cout << __func__ << " cookie " << cookie << " notify_id " << notify_id
-             << " notifier_gid " << notifier_gid << std::endl;
-    notify_failed = true;
-  }
-
   void handle_error(uint64_t cookie, int err) {
     std::cout << __func__ << " cookie " << cookie << std::endl;
     notify_err = err;
@@ -246,7 +228,6 @@ TEST_F(LibRadosWatchNotify, Watch2Timeout) {
   ASSERT_EQ(0,
            rados_watch2(ioctx, notify_oid, &handle,
                         watch_notify2_test_cb,
-                        watch_notify2_test_failcb,
                         watch_notify2_test_errcb, NULL));
   int age = rados_watch_check(ioctx, handle);
   time_t age_bound = time(0) + 1 - start;
@@ -291,7 +272,6 @@ TEST_F(LibRadosWatchNotify, Watch2Timeout) {
   ASSERT_EQ(0,
            rados_watch2(ioctx, notify_oid, &handle,
                         watch_notify2_test_cb,
-                        watch_notify2_test_failcb,
                         watch_notify2_test_errcb, NULL));
   ASSERT_TRUE(rados_watch_check(ioctx, handle) > 0);
 
@@ -332,7 +312,6 @@ TEST_F(LibRadosWatchNotify, WatchNotify2) {
   ASSERT_EQ(0,
       rados_watch2(ioctx, notify_oid, &handle,
                   watch_notify2_test_cb,
-                  watch_notify2_test_failcb,
                   watch_notify2_test_errcb, NULL));
   ASSERT_TRUE(rados_watch_check(ioctx, handle) > 0);
   char *reply_buf = 0;
@@ -413,12 +392,10 @@ TEST_F(LibRadosWatchNotify, WatchNotify2Multi) {
   ASSERT_EQ(0,
       rados_watch2(ioctx, notify_oid, &handle1,
                   watch_notify2_test_cb,
-                  watch_notify2_test_failcb,
                   watch_notify2_test_errcb, NULL));
   ASSERT_EQ(0,
       rados_watch2(ioctx, notify_oid, &handle2,
                   watch_notify2_test_cb,
-                  watch_notify2_test_failcb,
                   watch_notify2_test_errcb, NULL));
   ASSERT_TRUE(rados_watch_check(ioctx, handle1) > 0);
   ASSERT_TRUE(rados_watch_check(ioctx, handle2) > 0);
@@ -456,7 +433,6 @@ TEST_F(LibRadosWatchNotify, WatchNotify2Timeout) {
   notify_oid = "foo";
   notify_sleep = 3; // 3s
   notify_cookies.clear();
-  notify_failed = false;
   char buf[128];
   memset(buf, 0xcc, sizeof(buf));
   ASSERT_EQ(0, rados_write(ioctx, notify_oid, buf, sizeof(buf), 0));
@@ -464,7 +440,6 @@ TEST_F(LibRadosWatchNotify, WatchNotify2Timeout) {
   ASSERT_EQ(0,
       rados_watch2(ioctx, notify_oid, &handle,
                   watch_notify2_test_cb,
-                  watch_notify2_test_failcb,
                   watch_notify2_test_errcb, NULL));
   ASSERT_TRUE(rados_watch_check(ioctx, handle) > 0);
   char *reply_buf = 0;
@@ -473,10 +448,6 @@ TEST_F(LibRadosWatchNotify, WatchNotify2Timeout) {
                                      "notify", 6, 1000, // 1s
                                      &reply_buf, &reply_buf_len));
   ASSERT_EQ(1u, notify_cookies.size());
-  int wait = 10;
-  while (!notify_failed && --wait)
-    sleep(1);
-  ASSERT_TRUE(notify_failed);
   {
     bufferlist reply;
     reply.append(reply_buf, reply_buf_len);
@@ -491,7 +462,6 @@ TEST_F(LibRadosWatchNotify, WatchNotify2Timeout) {
   rados_buffer_free(reply_buf);
 
   // we should get the next notify, though!
-  notify_failed = false;
   notify_sleep = 0;
   notify_cookies.clear();
   ASSERT_EQ(0, rados_notify2(ioctx, notify_oid,
@@ -508,7 +478,6 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify2Timeout) {
   notify_ioctx = &ioctx;
   notify_sleep = 3;  // 3s
   notify_cookies.clear();
-  notify_failed = true;
   char buf[128];
   memset(buf, 0xcc, sizeof(buf));
   bufferlist bl1;
@@ -525,10 +494,6 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify2Timeout) {
   bufferlist bl2, bl_reply;
   ASSERT_EQ(-ETIMEDOUT, ioctx.notify(notify_oid, bl2, 1000 /* 1s */,
                                     &bl_reply));
-  int wait = 10;
-  while (!notify_failed && --wait)
-    sleep(1);
-  ASSERT_TRUE(notify_failed);
   ASSERT_TRUE(ioctx.watch_check(handle) > 0);
   ioctx.unwatch(handle);
 }
index c9702c4c61d413989c7863fe7043a3b88315c8b9..8b2fc890963f0dc7d5ba2b9674d5b543b2439171 100644 (file)
@@ -80,11 +80,6 @@ public:
     waiting = false;
     cond.SignalAll();
   }
-  void handle_failed_notify(uint64_t notify_id, uint64_t cookie,
-                           uint64_t notifier_id) {
-    Mutex::Locker l(lock);
-    cout << "watch handle_failed_notify" << std::endl;
-  }
   void handle_error(uint64_t cookie, int err) {
     Mutex::Locker l(lock);
     cout << "watch handle_error " << err << std::endl;
index 1d7d8748d3753d3c695d44ce0f6228f2f1e5f228..b75187a7895437b528dc55fa173f19f4d2f02454 100644 (file)
@@ -504,15 +504,6 @@ public:
     bl.hexdump(cout);
     ioctx.notify_ack(name, notify_id, cookie, bl);
   }
-  void handle_failed_notify(uint64_t notify_id,
-                           uint64_t cookie,
-                           uint64_t notifier_id) {
-    cout << "FAILED_NOTIFY"
-        << " cookie " << cookie
-        << " notify_id " << notify_id
-        << " from " << notifier_id
-        << std::endl;
-  }
   void handle_error(uint64_t cookie, int err) {
     cout << "ERROR"
         << " cookie " << cookie