aboutsummaryrefslogtreecommitdiffstats
path: root/yt
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2024-10-08 20:52:07 +0300
committerbabenko <babenko@yandex-team.com>2024-10-08 21:03:48 +0300
commit44c730d2c72b3db3836bc51c16fd65a59fee7995 (patch)
tree8c1d82765801dbd9a68e50b588e7c165fb9c0f58 /yt
parent8a06db32ead073cffc76465c8a703d0c9bfd06d7 (diff)
downloadydb-44c730d2c72b3db3836bc51c16fd65a59fee7995.tar.gz
Revert commit rXXXXXX, YT-23050: Hazard pointers must not depend on logging
commit_hash:6e301c759169c8dabc9a6efde93b9afe9a5a241a
Diffstat (limited to 'yt')
-rw-r--r--yt/yt/core/misc/hazard_ptr.cpp16
-rw-r--r--yt/yt/core/misc/hazard_ptr.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/yt/yt/core/misc/hazard_ptr.cpp b/yt/yt/core/misc/hazard_ptr.cpp
index ec288eddd9..ce78cbccf2 100644
--- a/yt/yt/core/misc/hazard_ptr.cpp
+++ b/yt/yt/core/misc/hazard_ptr.cpp
@@ -1,5 +1,7 @@
#include "hazard_ptr.h"
+#include "private.h"
+
#include <yt/yt/core/misc/singleton.h>
#include <yt/yt/core/misc/proc.h>
#include <yt/yt/core/misc/ring_queue.h>
@@ -23,6 +25,10 @@ using namespace NConcurrency;
////////////////////////////////////////////////////////////////////////////////
+static constexpr auto& Logger = LockFreeLogger;
+
+////////////////////////////////////////////////////////////////////////////////
+
namespace NDetail {
////////////////////////////////////////////////////////////////////////////////
@@ -319,6 +325,16 @@ bool THazardPointerManager::DoReclaimHazardPointers(THazardThreadState* threadSt
retireList.push(item);
});
+ YT_LOG_TRACE_IF(
+ !protectedPointers.empty(),
+ "Scanning hazard pointers (Candidates: %v, Protected: %v)",
+ MakeFormattableView(TRingQueueIterableWrapper(retireList), [&] (auto* builder, auto item) {
+ builder->AppendFormat("%v", TTaggedPtr<void>::Unpack(item.PackedPtr).Ptr);
+ }),
+ MakeFormattableView(protectedPointers, [&] (auto* builder, auto ptr) {
+ builder->AppendFormat("%v", ptr);
+ }));
+
size_t pushedCount = 0;
auto popCount = retireList.size();
while (popCount-- > 0) {
diff --git a/yt/yt/core/misc/hazard_ptr.h b/yt/yt/core/misc/hazard_ptr.h
index 40202bbf44..f6a3bf58ca 100644
--- a/yt/yt/core/misc/hazard_ptr.h
+++ b/yt/yt/core/misc/hazard_ptr.h
@@ -4,6 +4,8 @@
#include <yt/yt/core/concurrency/scheduler_api.h>
+#include <library/cpp/yt/logging/logger.h>
+
#include <atomic>
namespace NYT {