diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-21 12:02:10 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-21 12:02:10 +0300 |
commit | 510a24d09da65ac274206fe9d6544bc722c18a56 (patch) | |
tree | c24e5f2d237266122ac8843aaa462b2325271974 /library/cpp | |
parent | d49283ffe563f4a1f20deef863a18f8de6a275e8 (diff) | |
download | ydb-510a24d09da65ac274206fe9d6544bc722c18a56.tar.gz |
intermediate changes
ref:c7577ae41288ba1544a9cd1f00cdeff854fe2994
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/lwtrace/log.h | 6 | ||||
-rw-r--r-- | library/cpp/lwtrace/log_shuttle.h | 1 | ||||
-rw-r--r-- | library/cpp/lwtrace/trace_ut.cpp | 58 |
3 files changed, 65 insertions, 0 deletions
diff --git a/library/cpp/lwtrace/log.h b/library/cpp/lwtrace/log.h index 0e05ec6306..d8c2a221a9 100644 --- a/library/cpp/lwtrace/log.h +++ b/library/cpp/lwtrace/log.h @@ -448,6 +448,12 @@ namespace NLWTrace { template <class TReader> void ExtractItems(TReader& r) { ReadItems(r); + for (TItem *i = OldBuffer->GetFront(), *e = OldBuffer->GetBack();; OldBuffer->Inc(i)) { + i->Clear(); + if (i == e) { + break; + } + } OldBuffer->Clear(); } }; diff --git a/library/cpp/lwtrace/log_shuttle.h b/library/cpp/lwtrace/log_shuttle.h index 729a38615f..8549acd833 100644 --- a/library/cpp/lwtrace/log_shuttle.h +++ b/library/cpp/lwtrace/log_shuttle.h @@ -201,6 +201,7 @@ namespace NLWTrace { template <class TDepot> void TLogShuttle<TDepot>::Clear() { TrackLog.Clear(); + AtomicSet(ForkFailed, 0); } template <class TDepot> diff --git a/library/cpp/lwtrace/trace_ut.cpp b/library/cpp/lwtrace/trace_ut.cpp index cb03e4fbde..afb2f4e53f 100644 --- a/library/cpp/lwtrace/trace_ut.cpp +++ b/library/cpp/lwtrace/trace_ut.cpp @@ -876,5 +876,63 @@ Y_UNIT_TEST_SUITE(LWTraceTrace) { } reader; mngr.ReadDepot("Query1", reader); } + + Y_UNIT_TEST(ShouldResetFailedForksCounterUponShuttleParking) { + TManager mngr(*Singleton<TProbeRegistry>(), true); + TQuery q; + bool parsed = NProtoBuf::TextFormat::ParseFromString(R"END( + Blocks { + ProbeDesc { + Name: "NoParam" + Provider: "LWTRACE_UT_PROVIDER" + } + Action { + RunLogShuttleAction { + MaxTrackLength: 100 + ShuttlesCount: 2 + } + } + } + )END", &q); + + UNIT_ASSERT(parsed); + mngr.New("Query1", q); + + struct { + ui32 cnt = 0; + void Push(TThread::TId, const TTrackLog&) { + ++cnt; + } + } reader; + + { + // Run shuttle ans fail fork + TOrbit initial; + TOrbit fork1; + TOrbit fork2; + + LWTRACK(NoParam, initial); + UNIT_ASSERT_VALUES_EQUAL(initial.HasShuttles(), true); + UNIT_ASSERT_VALUES_EQUAL(initial.Fork(fork1), true); + LWTRACK(IntParam, fork1, 1); + UNIT_ASSERT_VALUES_EQUAL(fork1.Fork(fork2), false); + initial.Join(fork1); + } + + mngr.ReadDepot("Query1", reader); + UNIT_ASSERT_VALUES_EQUAL(reader.cnt, 0); + + reader.cnt = 0; + + { + TOrbit initial; + + LWTRACK(NoParam, initial); + UNIT_ASSERT_VALUES_EQUAL(initial.HasShuttles(), true); + } + + mngr.ReadDepot("Query1", reader); + UNIT_ASSERT_VALUES_EQUAL(reader.cnt, 1); + } #endif // LWTRACE_DISABLE } |