From: Sage Weil Date: Tue, 18 Nov 2014 23:35:28 +0000 (-0800) Subject: librados: remove failed notify X-Git-Tag: v0.91~78 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=61fc317d722ee45ceebe948f6781a24d697079d3;p=ceph.git librados: remove failed notify Decided this wasn't useful. Signed-off-by: Sage Weil --- diff --git a/src/common/ceph_strings.cc b/src/common/ceph_strings.cc index 02359b7b0905..41203bc23fce 100644 --- a/src/common/ceph_strings.cc +++ b/src/common/ceph_strings.cc @@ -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 "???"; diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 6bca7b2d1e19..838394d5db25 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -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); diff --git a/src/include/rados/librados.h b/src/include/rados/librados.h index ccf6a0492430..946d78a9ba15 100644 --- a/src/include/rados/librados.h +++ b/src/include/rados/librados.h @@ -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 diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 235479e00f05..967308372a0b 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -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. * diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 921d19f4e955..6c43aa177c1b 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -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 diff --git a/src/librados/librados.cc b/src/librados/librados.cc index 8402475e5d70..3c45d1f70565 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -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); diff --git a/src/osd/Watch.cc b/src/osd/Watch.cc index cdce052bf654..aab917edd576 100644 --- a/src/osd/Watch.cc +++ b/src/osd/Watch.cc @@ -186,7 +186,6 @@ void Notify::maybe_complete_notify() ::encode(notify_replies, bl); list > missed; for (set::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) diff --git a/src/osd/Watch.h b/src/osd/Watch.h index 9dc468255104..1a76691125d4 100644 --- a/src/osd/Watch.h +++ b/src/osd/Watch.h @@ -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(); diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 4540017ea0a2..d32f660fef81 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -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; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index b2249f928996..f7006ec4fb0e 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -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() {} }; diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index 12ccac321b85..c81311e4387a 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -45,7 +45,6 @@ std::set 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); } diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index c9702c4c61d4..8b2fc890963f 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -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; diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index 1d7d8748d375..b75187a78954 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -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