Skip to content

Commit e509829

Browse files
authored
Merge pull request ceph#51852 from Matan-B/wip-matanb-crimson-watch-notify-logs
crimson/osd/watch: Add logs around Watch/Notify Reviewed-by: Samuel Just <[email protected]>
2 parents fa09e73 + 3548489 commit e509829

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

src/crimson/osd/watch.cc

Lines changed: 28 additions & 5 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);
@@ -222,8 +231,7 @@ bool notify_reply_t::operator<(const notify_reply_t& rhs) const
222231
std::ostream &operator<<(std::ostream &out, const notify_reply_t &rhs)
223232
{
224233
out << "notify_reply_t{watcher_gid=" << rhs.watcher_gid
225-
<< ", watcher_cookie=" << rhs.watcher_cookie
226-
<< ", bl=" << rhs.bl << "}";
234+
<< ", watcher_cookie=" << rhs.watcher_cookie << "}";
227235
return out;
228236
}
229237

@@ -237,9 +245,19 @@ Notify::Notify(crimson::net::ConnectionRef conn,
237245
user_version(user_version)
238246
{}
239247

248+
Notify::~Notify()
249+
{
250+
logger().debug("{} for notify(id={})", __func__, ninfo.notify_id);
251+
}
252+
240253
seastar::future<> Notify::remove_watcher(WatchRef watch)
241254
{
255+
logger().debug("{} for notify(id={})", __func__, ninfo.notify_id);
256+
242257
if (discarded || complete) {
258+
logger().debug("{} for notify(id={}) discarded/complete already"
259+
" discarded: {} complete: {}", __func__,
260+
ninfo.notify_id, discarded ,complete);
243261
return seastar::now();
244262
}
245263
[[maybe_unused]] const auto num_removed = watchers.erase(watch);
@@ -259,7 +277,12 @@ seastar::future<> Notify::complete_watcher(
259277
WatchRef watch,
260278
const ceph::bufferlist& reply_bl)
261279
{
280+
logger().debug("{} for notify(id={})", __func__, ninfo.notify_id);
281+
262282
if (discarded || complete) {
283+
logger().debug("{} for notify(id={}) discarded/complete already"
284+
" discarded: {} complete: {}", __func__,
285+
ninfo.notify_id, discarded ,complete);
263286
return seastar::now();
264287
}
265288
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)