Skip to content

Commit b1c05f9

Browse files
committed
crimson/osd/watch: Add logs around Watch/Notify
Signed-off-by: Matan Breizman <[email protected]>
1 parent c42efbf commit b1c05f9

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

src/crimson/osd/watch.cc

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ seastar::future<> Watch::send_notify_msg(NotifyRef notify)
111111

112112
seastar::future<> Watch::start_notify(NotifyRef notify)
113113
{
114-
logger().info("{} adding notify(id={})", __func__, notify->ninfo.notify_id);
114+
logger().debug("{} gid={} cookie={} starting notify(id={})",
115+
__func__, get_watcher_gid(), get_cookie(),
116+
notify->ninfo.notify_id);
115117
auto [ it, emplaced ] = in_progress_notifies.emplace(std::move(notify));
116118
ceph_assert(emplaced);
117119
ceph_assert(is_alive());
@@ -158,6 +160,7 @@ seastar::future<> Watch::send_disconnect_msg()
158160

159161
void Watch::discard_state()
160162
{
163+
logger().debug("{} gid={} cookie={}", __func__, get_watcher_gid(), get_cookie());
161164
ceph_assert(obc);
162165
in_progress_notifies.clear();
163166
timeout_timer.cancel();
@@ -174,14 +177,18 @@ void Watch::got_ping(utime_t)
174177

175178
seastar::future<> Watch::remove()
176179
{
177-
logger().info("{}", __func__);
180+
logger().debug("{} gid={} cookie={}", __func__, get_watcher_gid(), get_cookie());
178181
// in contrast to ceph-osd crimson sends CEPH_WATCH_EVENT_DISCONNECT directly
179182
// from the timeout handler and _after_ CEPH_WATCH_EVENT_NOTIFY_COMPLETE.
180183
// this simplifies the Watch::remove() interface as callers aren't obliged
181184
// anymore to decide whether EVENT_DISCONNECT needs to be send or not -- it
182185
// becomes an implementation detail of Watch.
183186
return seastar::do_for_each(in_progress_notifies,
184187
[this_shared=shared_from_this()] (auto notify) {
188+
logger().debug("Watch::remove gid={} cookie={} notify(id={})",
189+
this_shared->get_watcher_gid(),
190+
this_shared->get_cookie(),
191+
notify->ninfo.notify_id);
185192
return notify->remove_watcher(this_shared);
186193
}).then([this] {
187194
discard_state();
@@ -191,7 +198,9 @@ seastar::future<> Watch::remove()
191198

192199
void Watch::cancel_notify(const uint64_t notify_id)
193200
{
194-
logger().info("{} notify_id={}", __func__, notify_id);
201+
logger().debug("{} gid={} cookie={} notify(id={})",
202+
__func__, get_watcher_gid(), get_cookie(),
203+
notify_id);
195204
const auto it = in_progress_notifies.find(notify_id);
196205
assert(it != std::end(in_progress_notifies));
197206
in_progress_notifies.erase(it);
@@ -237,9 +246,19 @@ Notify::Notify(crimson::net::ConnectionRef conn,
237246
user_version(user_version)
238247
{}
239248

249+
Notify::~Notify()
250+
{
251+
logger().debug("{} for notify(id={})", __func__, ninfo.notify_id);
252+
}
253+
240254
seastar::future<> Notify::remove_watcher(WatchRef watch)
241255
{
256+
logger().debug("{} for notify(id={})", __func__, ninfo.notify_id);
257+
242258
if (discarded || complete) {
259+
logger().debug("{} for notify(id={}) discarded/complete already"
260+
" discarded: {} complete: {}", __func__,
261+
ninfo.notify_id, discarded ,complete);
243262
return seastar::now();
244263
}
245264
[[maybe_unused]] const auto num_removed = watchers.erase(watch);
@@ -259,7 +278,12 @@ seastar::future<> Notify::complete_watcher(
259278
WatchRef watch,
260279
const ceph::bufferlist& reply_bl)
261280
{
281+
logger().debug("{} for notify(id={})", __func__, ninfo.notify_id);
282+
262283
if (discarded || complete) {
284+
logger().debug("{} for notify(id={}) discarded/complete already"
285+
" discarded: {} complete: {}", __func__,
286+
ninfo.notify_id, discarded ,complete);
263287
return seastar::now();
264288
}
265289
notify_replies.emplace(notify_reply_t{

src/crimson/osd/watch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ class Notify : public seastar::enable_shared_from_this<Notify> {
140140
[this] { do_notify_timeout(); }
141141
};
142142

143+
~Notify();
144+
143145
/// (gid,cookie) -> reply_bl for everyone who acked the notify
144146
std::multiset<notify_reply_t> notify_replies;
145147

0 commit comments

Comments
 (0)