Skip to content

LOGBROKER-7430 added unit test on reading with restarts#34487

Merged
GrigoriyPA merged 4 commits intoydb-platform:mainfrom
GrigoriyPA:LOGBROKER-7430-add-unit-test-on-reading-with-restarts
Feb 19, 2026
Merged

LOGBROKER-7430 added unit test on reading with restarts#34487
GrigoriyPA merged 4 commits intoydb-platform:mainfrom
GrigoriyPA:LOGBROKER-7430-add-unit-test-on-reading-with-restarts

Conversation

@GrigoriyPA
Copy link
Collaborator

Changelog entry

Added unit test on reading with restarts

Changelog category

  • Bugfix

Description for reviewers

Bugfix ticket: https://st.yandex-team.ru/LOGBROKER-7430#6992f432cf614c2f332fbc7a

Copilot AI review requested due to automatic review settings February 19, 2026 11:13
@GrigoriyPA GrigoriyPA requested a review from a team as a code owner February 19, 2026 11:13
@github-actions
Copy link

github-actions bot commented Feb 19, 2026

2026-02-19 11:14:12 UTC Pre-commit check linux-x86_64-relwithdebinfo for 0e9bcb4 has started.
2026-02-19 11:15:53 UTC Artifacts will be uploaded here
2026-02-19 11:18:00 UTC ya make is running...
🟡 2026-02-19 13:24:14 UTC Some tests failed, follow the links below. Going to retry failed tests...

Details

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
46818 43311 0 3 3495 9

2026-02-19 13:24:33 UTC ya make is running... (failed tests rerun, try 2)
🟢 2026-02-19 13:26:02 UTC Tests successful.

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
114 (only retried tests) 114 0 0 0 0

🟢 2026-02-19 13:26:09 UTC Build successful.
🟢 2026-02-19 13:26:32 UTC ydbd size 2.4 GiB changed* by +59.3 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 93cd6aa merge: 0e9bcb4 diff diff %
ydbd size 2 573 536 360 Bytes 2 573 597 056 Bytes +59.3 KiB +0.002%
ydbd stripped size 542 455 496 Bytes 542 465 832 Bytes +10.1 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@ydbot
Copy link
Collaborator

ydbot commented Feb 19, 2026

Run Extra Tests

Run additional tests for this PR. You can customize:

  • Test Size: small, medium, large (default: all)
  • Test Targets: any directory path (default: ydb/)
  • Sanitizers: ASAN, MSAN, TSAN
  • Coredumps: enable for debugging (default: off)
  • Additional args: custom ya make arguments

▶  Run tests

@github-actions
Copy link

🟢 2026-02-19 11:15:42 UTC The validation of the Pull Request description is successful.

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

2026-02-19 11:18:00 UTC Pre-commit check linux-x86_64-release-asan for 0e9bcb4 has started.
2026-02-19 11:18:20 UTC Artifacts will be uploaded here
2026-02-19 11:20:36 UTC ya make is running...
🟡 2026-02-19 13:06:00 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
17240 17179 0 33 19 9

🟢 2026-02-19 13:06:12 UTC Build successful.
🟡 2026-02-19 13:06:46 UTC ydbd size 3.9 GiB changed* by +116.3 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 93cd6aa merge: 0e9bcb4 diff diff %
ydbd size 4 190 703 656 Bytes 4 190 822 760 Bytes +116.3 KiB +0.003%
ydbd stripped size 1 567 952 768 Bytes 1 567 999 808 Bytes +45.9 KiB +0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets LOGBROKER-7430 by adding a restart-heavy read test scenario and adjusting topic read-session internals to better handle decompression/cancellation and improve hang diagnostics during reconnects.

Changes:

  • Add/extend a unit test flow that repeatedly restarts PQRB tablet while reading to validate recovery behavior.
  • Update read-session internals around “not-ready tail” cleanup, self-check timing, and diagnostic logging.
  • Improve test crash diagnostics by enabling YDB backtraces and installing terminate/signal handlers in the test setup.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ydb/public/sdk/cpp/tests/integration/topic/utils/managed_executor.cpp Ensure moved tasks are cleared to prevent re-running them.
ydb/public/sdk/cpp/src/client/topic/ut/ut_utils/ya.make Add peer dependency needed by new test utilities.
ydb/public/sdk/cpp/src/client/topic/ut/ut_utils/topic_sdk_test_setup.cpp Add backtrace/terminate/signal handling for better test crash output.
ydb/public/sdk/cpp/src/client/topic/ut/basic_usage_ut.cpp Enhance restart-based read test loop and tablet restart behavior.
ydb/public/sdk/cpp/src/client/topic/impl/read_session_impl.ipp Adjust event-queue tail deletion, self-check cadence, and expand warning diagnostics.
ydb/public/sdk/cpp/src/client/topic/impl/read_session_impl.h Add small APIs for diagnostics/counters and tweak decompression event behavior.
Comments suppressed due to low confidence (5)

ydb/public/sdk/cpp/src/client/topic/ut/basic_usage_ut.cpp:188

  • IReadSession::WaitEvent() returns a future, but the returned value is ignored here, so this does not actually wait for an event and can cause the loop to spin until the timeout assertion trips. Use ReadSession->WaitEvent().Wait(...) (with a remaining-time/deadline) instead of ignoring the future and sleeping.
    auto WaitTasks = [&, timeout = TInstant::Now() + TDuration::Seconds(60)](auto f, size_t c) {
        while (f() < c) {
            UNIT_ASSERT(timeout > TInstant::Now());
            ReadSession->WaitEvent();
            std::this_thread::sleep_for(100ms);

ydb/public/sdk/cpp/src/client/topic/ut/ut_utils/topic_sdk_test_setup.cpp:47

  • This constructor installs global std::terminate and process-wide signal handlers but never restores previous handlers. That can leak side effects across unrelated tests and is hard to debug in large test suites. Consider guarding this with a std::once_flag or storing/restoring previous handlers in a RAII helper; also prefer sigaction and avoid non-async-signal-safe operations inside a signal handler.
    NKikimr::EnableYDBBacktraceFormat();

    std::set_terminate(&TerminateHandler);
    for (auto sig : {SIGFPE, SIGILL, SIGSEGV}) {
        signal(sig, &BackTraceSignalHandler);

ydb/public/sdk/cpp/src/client/topic/impl/read_session_impl.ipp:2224

  • PR description/title say this change adds a unit test, but the PR also modifies production read-session logic (read_session_impl.*) and test harness behavior (terminate/signal handlers). Please update the PR description to reflect the functional/runtime changes so reviewers and release notes consumers aren’t surprised.
    ui64 notStartedTasks = 0;
    for (const auto& decompressionItem : DecompressionQueue) {
        if (const auto& stream = *decompressionItem.PartitionStream; handledPartitionStreams.emplace(stream.GetAssignId()).second) {
            readyEventsCount += stream.GetReadyEventsCount();
            amountEvents += stream.GetEventsCount();
            notStartedTasks += decompressionItem.BatchInfo->GetNotStartedTasksCunt();

ydb/public/sdk/cpp/src/client/topic/impl/read_session_impl.ipp:2195

  • The comments in SelfCheck() still reference a 1-minute threshold, but the code now uses TDuration::Seconds(30). Please update the comment(s) to match the new 30-second window so future debugging isn’t misled.
    if (delta < TDuration::Seconds(30)) {
        // Session ok, we got at least one event from server since last 1 minute
        return;

ydb/public/sdk/cpp/src/client/topic/impl/read_session_impl.ipp:2242

  • amountEvents is computed via GetEventsCount() (total queue size: ready+not-ready and data+non-data), but the log label says "not ready data events". This makes the warning misleading during incident/debugging; either compute the metric that matches the label or rename the label to reflect what’s actually being reported.
        << ", pending decompression batches: " << DecompressionQueue.size()
        << ", not ready data events: " << amountEvents
        << ", alive partition streams: " << PartitionStreams.size()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

2026-02-19 13:34:28 UTC Pre-commit check linux-x86_64-release-asan for dd6404f has started.
2026-02-19 13:34:45 UTC Artifacts will be uploaded here
2026-02-19 13:37:06 UTC ya make is running...
2026-02-19 13:44:19 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

2026-02-19 13:35:58 UTC Pre-commit check linux-x86_64-relwithdebinfo for dd6404f has started.
2026-02-19 13:36:05 UTC Artifacts will be uploaded here
2026-02-19 13:37:26 UTC ya make is running...
2026-02-19 13:44:14 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

2026-02-19 13:45:50 UTC Pre-commit check linux-x86_64-release-asan for e8c0c16 has started.
2026-02-19 13:46:07 UTC Artifacts will be uploaded here
2026-02-19 13:48:19 UTC ya make is running...
🟡 2026-02-19 15:39:45 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
17245 17202 0 27 7 9

🟢 2026-02-19 15:39:57 UTC Build successful.
🟢 2026-02-19 15:40:32 UTC ydbd size 3.9 GiB changed* by +14.8 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 6196fd7 merge: e8c0c16 diff diff %
ydbd size 4 190 805 048 Bytes 4 190 820 248 Bytes +14.8 KiB +0.000%
ydbd stripped size 1 567 995 200 Bytes 1 567 996 928 Bytes +1.7 KiB +0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

2026-02-19 13:45:52 UTC Pre-commit check linux-x86_64-relwithdebinfo for e8c0c16 has started.
2026-02-19 13:46:09 UTC Artifacts will be uploaded here
2026-02-19 13:48:23 UTC ya make is running...
🟡 2026-02-19 16:15:01 UTC Some tests failed, follow the links below. Going to retry failed tests...

Details

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
46622 43187 0 4 3419 12

2026-02-19 16:15:19 UTC ya make is running... (failed tests rerun, try 2)
🟢 2026-02-19 16:16:30 UTC Tests successful.

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
74 (only retried tests) 74 0 0 0 0

🟢 2026-02-19 16:16:37 UTC Build successful.
🟢 2026-02-19 16:17:00 UTC ydbd size 2.4 GiB changed* by +12.3 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 6196fd7 merge: e8c0c16 diff diff %
ydbd size 2 573 584 568 Bytes 2 573 597 152 Bytes +12.3 KiB +0.000%
ydbd stripped size 542 463 848 Bytes 542 465 320 Bytes +1.4 KiB +0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@GrigoriyPA GrigoriyPA requested a review from uzhastik February 19, 2026 14:07
@GrigoriyPA GrigoriyPA merged commit 9b39c77 into ydb-platform:main Feb 19, 2026
9 checks passed
@GrigoriyPA GrigoriyPA deleted the LOGBROKER-7430-add-unit-test-on-reading-with-restarts branch February 19, 2026 16:17
@ydbot
Copy link
Collaborator

ydbot commented Feb 19, 2026

Backport

To backport this PR, click the button next to the target branch and then click "Run workflow" in the Run Actions UI.

Branch Run
stable-25-3, stable-25-3-1, stable-25-4, stable-25-4-1 ▶  Backport
stable-25-4, stable-25-4-1 ▶  Backport
stable-25-4 ▶  Backport

▶  Backport manual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments