diff --git a/src/Common/OvercommitTracker.h b/src/Common/OvercommitTracker.h index 267ba13aecb..37de75f4848 100644 --- a/src/Common/OvercommitTracker.h +++ b/src/Common/OvercommitTracker.h @@ -155,11 +155,15 @@ private: Poco::Logger * logger = &Poco::Logger::get("GlobalOvercommitTracker"); }; +// This class is used to disallow tracking during logging to avoid deadlocks. struct OvercommitTrackerBlockerInThread { OvercommitTrackerBlockerInThread() { ++counter; } ~OvercommitTrackerBlockerInThread() { --counter; } + OvercommitTrackerBlockerInThread(OvercommitTrackerBlockerInThread const &) = delete; + OvercommitTrackerBlockerInThread & operator=(OvercommitTrackerBlockerInThread const &) = delete; + static bool isBlocked() { return counter > 0; } private: