Browse Source

Revert commit rXXXXXX, YT-23050: Hazard pointers must not depend on logging
commit_hash:6e301c759169c8dabc9a6efde93b9afe9a5a241a

babenko 5 months ago
parent
commit
44c730d2c7
2 changed files with 18 additions and 0 deletions
  1. 16 0
      yt/yt/core/misc/hazard_ptr.cpp
  2. 2 0
      yt/yt/core/misc/hazard_ptr.h

+ 16 - 0
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) {

+ 2 - 0
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 {