Skip to content

Commit 8bea749

Browse files
committed
Remove use of ON_LOG_LEVEL
There was no clients who registered for the ON_LOG_LEVEL events left in the system. Change-Id: I05028373b5d1e5126de538d0ee7f5a7ec5a6732b Reviewed-on: http://review.couchbase.org/107892 Tested-by: Build Bot <[email protected]> Reviewed-by: Jim Walker <[email protected]>
1 parent cb3e3e7 commit 8bea749

File tree

2 files changed

+10
-33
lines changed

2 files changed

+10
-33
lines changed

daemon/memcached.cc

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -302,26 +302,6 @@ void perform_callbacks(ENGINE_EVENT_TYPE type,
302302
}
303303
break;
304304
}
305-
case ON_LOG_LEVEL:
306-
if (void_cookie != nullptr) {
307-
throw std::invalid_argument("perform_callbacks: cookie "
308-
"(which is " +
309-
std::to_string(reinterpret_cast<uintptr_t>(void_cookie)) +
310-
") should be NULL for ON_LOG_LEVEL");
311-
}
312-
for (auto& handler : engine_event_handlers[type]) {
313-
handler.cb(void_cookie, ON_LOG_LEVEL, data, handler.cb_data);
314-
}
315-
316-
if (service_online) {
317-
// MB-33637: Make the verbosity change in the calling thread.
318-
// This should be a relatively quick operation as we only block if
319-
// we are registering or unregistering new loggers. It also prevents
320-
// a race condition on shutdown where we could attempt to log
321-
// something but the logger has already been destroyed.
322-
populate_log_level();
323-
}
324-
break;
325305

326306
default:
327307
throw std::invalid_argument("perform_callbacks: type "
@@ -357,13 +337,6 @@ static void register_callback(EngineIface* eh,
357337
all_buckets[idx].engine_event_handlers[type].push_back({cb, cb_data});
358338
break;
359339

360-
case ON_LOG_LEVEL:
361-
if (eh != nullptr) {
362-
throw std::invalid_argument("register_callback: 'eh' must be NULL");
363-
}
364-
engine_event_handlers[type].push_back({cb, cb_data});
365-
break;
366-
367340
default:
368341
throw std::invalid_argument("register_callback: type (which is " +
369342
std::to_string(type) +
@@ -486,7 +459,12 @@ static void verbosity_changed_listener(const std::string&, Settings &s) {
486459
logger->set_level(settings.getLogLevel());
487460
}
488461

489-
perform_callbacks(ON_LOG_LEVEL, nullptr, nullptr);
462+
// MB-33637: Make the verbosity change in the calling thread.
463+
// This should be a relatively quick operation as we only block if
464+
// we are registering or unregistering new loggers. It also prevents
465+
// a race condition on shutdown where we could attempt to log
466+
// something but the logger has already been destroyed.
467+
populate_log_level();
490468
}
491469

492470
static void scramsha_fallback_salt_changed_listener(const std::string&,
@@ -2434,8 +2412,8 @@ extern "C" int memcached_main(int argc, char **argv) {
24342412

24352413
initialize_audit();
24362414

2437-
/* inform interested parties of initial verbosity level */
2438-
perform_callbacks(ON_LOG_LEVEL, nullptr, nullptr);
2415+
// inform interested parties of initial verbosity level
2416+
populate_log_level();
24392417

24402418
recalculate_max_connections();
24412419

include/memcached/server_callback_iface.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
* changes in the server.
2525
*/
2626
typedef enum {
27-
ON_DISCONNECT = 0, /**< A connection was terminated. */
28-
ON_LOG_LEVEL = 1 /**< Changed log level */
27+
ON_DISCONNECT = 0 /**< A connection was terminated. */
2928
} ENGINE_EVENT_TYPE;
3029

31-
#define MAX_ENGINE_EVENT_TYPE 3
30+
#define MAX_ENGINE_EVENT_TYPE 1
3231

3332
/**
3433
* Callback for server events.

0 commit comments

Comments
 (0)