Skip to content

Commit 44c730d

Browse files
author
babenko
committed
Revert commit rXXXXXX, YT-23050: Hazard pointers must not depend on logging
commit_hash:6e301c759169c8dabc9a6efde93b9afe9a5a241a
1 parent 8a06db3 commit 44c730d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

yt/yt/core/misc/hazard_ptr.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "hazard_ptr.h"
22

3+
#include "private.h"
4+
35
#include <yt/yt/core/misc/singleton.h>
46
#include <yt/yt/core/misc/proc.h>
57
#include <yt/yt/core/misc/ring_queue.h>
@@ -23,6 +25,10 @@ using namespace NConcurrency;
2325

2426
////////////////////////////////////////////////////////////////////////////////
2527

28+
static constexpr auto& Logger = LockFreeLogger;
29+
30+
////////////////////////////////////////////////////////////////////////////////
31+
2632
namespace NDetail {
2733

2834
////////////////////////////////////////////////////////////////////////////////
@@ -319,6 +325,16 @@ bool THazardPointerManager::DoReclaimHazardPointers(THazardThreadState* threadSt
319325
retireList.push(item);
320326
});
321327

328+
YT_LOG_TRACE_IF(
329+
!protectedPointers.empty(),
330+
"Scanning hazard pointers (Candidates: %v, Protected: %v)",
331+
MakeFormattableView(TRingQueueIterableWrapper(retireList), [&] (auto* builder, auto item) {
332+
builder->AppendFormat("%v", TTaggedPtr<void>::Unpack(item.PackedPtr).Ptr);
333+
}),
334+
MakeFormattableView(protectedPointers, [&] (auto* builder, auto ptr) {
335+
builder->AppendFormat("%v", ptr);
336+
}));
337+
322338
size_t pushedCount = 0;
323339
auto popCount = retireList.size();
324340
while (popCount-- > 0) {

yt/yt/core/misc/hazard_ptr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include <yt/yt/core/concurrency/scheduler_api.h>
66

7+
#include <library/cpp/yt/logging/logger.h>
8+
79
#include <atomic>
810

911
namespace NYT {

0 commit comments

Comments
 (0)