Skip to content

[opt](cloud) Add recycler rowset recycling benchmarks test - #68043

Merged
gavinchou merged 2 commits into
apache:masterfrom
wyxxxcat:benchmark_recycler
Sep 28, 2026
Merged

gavinchou merged 2 commits into
apache:masterfrom
wyxxxcat:benchmark_recycler

Conversation

@wyxxxcat

@wyxxxcat wyxxxcat commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Add comprehensive recycler rowset benchmarks covering legacy and new rowset formats, transaction aborts, delete bitmap variants, packed files, missing schemas, and mixed workloads.

Treat legacy rowsets with empty resource IDs as successfully queued for KV deletion instead of reporting a recycling failure.

The current statistical logic has a bug; there's no need to worry about recycled_num and recycled_bytes.

The performance check watermark can be controlled via the environment variable recycler_benchmark_duration_tolerance_ratio.

recycler benchmark: operation=recycle_rowsets
  branch                                           total_ms   recycled_num    recycled_bytes      get_keys      put_keys      del_keys    total_keys
  compacted_empty                                   1708.36          30000          46080000         30000             0         30000         60000
  compacted_with_data/data_only                     3489.12          30000          46080000         30001             0         30000         60001
  compacted_with_data/delete_bitmap_v1              4084.44          30000          46080000         30000             0         30000         60000
  compacted_with_data/delete_bitmap_v2              3869.88          30000          46080000         60000             0         60000        120000
  compacted_with_packed_data/data_only              9444.14              0                 0         63000         30000         33000        126000
  compacted_with_packed_data/delete_bitmap_v1       9465.94              0                 0         63000         30000         33000        126000
  compacted_with_packed_data/delete_bitmap_v2      10366.38          30000          46080000         93000         30000         63000        186000
  compacted_without_schema                          6544.83          30000          46080000         30000             0         30000         60000
  legacy_empty_resource                             1657.66              0                 0         30000             0         30000         60000
  legacy_with_resource                              5227.31          30000                 0         60000             0         60000        120000
  mixed                                            46285.68          90000          92160000        600000        120000        360000       1080000
  prepare_abort                                    22566.18              0                 0        270000         90000         90000        450000
  prepare_direct                                    5841.44              0                 0         60000             0         60000        120000
  prepare_mark                                      8208.94              0                 0        120000         30000         60000        210000
  total                                           138760.29         300000         368640000       1539001        330000        969000       2838001

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run buildall

@wyxxxcat
wyxxxcat force-pushed the benchmark_recycler branch 7 times, most recently from f10532e to 29cd37b Compare September 16, 2026 03:23
@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run buildall

@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.51% (2058/2655)
Line Coverage 65.76% (37741/57390)
Region Coverage 53.30% (35484/66568)
Branch Coverage 56.62% (11362/20066)

@wyxxxcat
wyxxxcat force-pushed the benchmark_recycler branch 4 times, most recently from a590ae9 to 25f0ef2 Compare September 18, 2026 02:47
@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run cloudut

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.52% (2059/2656)
Line Coverage 65.94% (37964/57571)
Region Coverage 53.23% (35507/66704)
Branch Coverage 56.78% (11424/20118)

@wyxxxcat
wyxxxcat force-pushed the benchmark_recycler branch 2 times, most recently from 970b682 to 444e884 Compare September 20, 2026 02:57

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes. The non-versioned status change is reasonable, but the same legacy shape is still treated as an error on active multi-version paths, and the benchmark integration has three determinism/portability problems.

Critical checkpoint conclusions:

  • Goal and test proof: the non-versioned branch is covered; the multi-version dropped-tablet path remains incomplete and untested.
  • Scope, parallel paths, and compatibility: the production edit is small, but parallel versioned handlers were missed; there is no wire/storage-format change.
  • Concurrency and lifecycle: worker-pool draining, vector ownership, real-S3 accessor precedence, and GUID-rooted cleanup look sound; no new lock, deadlock, or static-lifetime issue was found.
  • Persistence and deletion: the missed tablet path exits before its local range removal and can delay dropped-metadata cleanup until the separate legacy-expiration sweep.
  • Configuration and protocol: there are no production config or FE/BE variable changes; benchmark-only environment settings do not require runtime propagation.
  • Tests and performance: coverage spans many branches, but default correctness UT inherits host-derived wall-clock gates, one packed-file check risks FDB transaction timeout, and shared FDB state invalidates later scenarios after a partial failure.
  • Observability and errors: existing logs identify the instance, tablet, and key; asynchronous best-effort deletion failures retain keys for retry and were not raised as a separate issue.
  • User focus: none was supplied.

Validation was static-only as required; no local builds or tests were run. Exact-head Cloud UT currently reports pass, but that single controlled run does not clear the path and portability issues above.

Comment thread cloud/src/recycler/recycler.cpp Resolved
Comment thread cloud/test/CMakeLists.txt Resolved
Comment thread cloud/test/recycler_benchmark_test.cpp Resolved
Comment thread cloud/test/recycler_benchmark_test.cpp Resolved
@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run buildall

@@ -5880,7 +5880,7 @@ int InstanceRecycler::recycle_rowsets() {
LOG(INFO) << "delete the recycle rowset kv that has empty resource_id, key="
<< hex(k) << " value=" << proto_to_json(rowset);
rowset_keys.emplace_back(k);
return -1;
return 0;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We need to ensure that the rowset recycled through this path is successful.

@gavinchou gavinchou changed the title [feat](cloud) Add recycler rowset recycling benchmarks test [opt](cloud) Add recycler rowset recycling benchmarks test Sep 21, 2026
gavinchou
gavinchou previously approved these changes Sep 23, 2026
@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run cloudut

@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run cloudut

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.54% (2064/2662)
Line Coverage 65.86% (37992/57686)
Region Coverage 53.34% (35642/66816)
Branch Coverage 56.84% (11475/20190)

@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

run buildall

@wyxxxcat

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review summary

Static review of the authoritative base/head diff for the requested scope (no user focus supplied). No builds or tests were run, per the review instructions.

  • Goal and correctness: the non-versioned empty-resource branch now queues the legacy key and reports success; the related versioned-path compatibility concern is already covered by the existing inline thread, with no additional recycler defect found.
  • Concurrency and lifecycle: recycler worker-pool completion and teardown were traced; no new production locking/lifecycle issue was found. The packed benchmark's intended cross-worker conflict workload is not actually concurrent (inline finding below).
  • Persistence and state: the benchmark's fixed namespace/partial-failure contamination is already covered by the existing state-isolation thread.
  • Compatibility and parallel paths: the unchanged versioned handlers remain covered by the existing recycler comment; this review does not duplicate it.
  • Test coverage: the new abort-order scenario is vacuous because it registers no observation callback (inline finding below).
  • Performance/observability: the default-UT wall-clock and packed verification transaction risks are already covered by existing threads; no additional distinct issue was retained.

The two inline findings below should be addressed before merge.

ASSERT_EQ(recycler_->recycle_rowsets(), 0);
ASSERT_EQ(count_recycle_rowsets(), 1);

auto* sp = SyncPoint::get_instance();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Make the abort-before-delete check observe transaction state

prepare_abort_before_delete claims to validate ordering, but this block never calls set_call_back; it only enables an empty SyncPoint and then checks that the rowset eventually disappears. A regression that deletes the PREPARE rowset before aborting its transaction would still pass. Please install the existing MockAccessor::delete_prefix callback (and assert the seeded txn is TXN_STATUS_ABORTED) before checking rowset removal, or remove the ordering claim.

packed_info.set_state(PackedFileInfoPB::NORMAL);
int64_t offset = 0;
for (int64_t j = 0; j < kRowsetsPerPackedFile; ++j) {
// Spread references across scan batches so different recycler workers can

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Make the packed workload actually exercise cross-worker retries

The comment says these references are spread across scan batches so workers contend, but this test seeds exactly 10,000 rowset keys and scan_and_recycle fetches 10,000 per page; loop_done then submits that whole page to one delete_rowset_data worker, which updates packed-file KVs serially. Thus no same-packed-file conflict/retry is exercised, and the ten-pass loop only checks eventual counts. Please force multiple batches/workers (or add a barrier) and assert a retry/conflict was observed if this is intended to benchmark that path.

@gavinchou
gavinchou merged commit 53f055d into apache:master Sep 28, 2026
36 checks passed
github-actions Bot pushed a commit that referenced this pull request Sep 28, 2026
Problem Summary:

Add comprehensive recycler rowset benchmarks covering legacy and new
rowset formats, transaction aborts, delete bitmap variants, packed
files, missing schemas, and mixed workloads.

Treat legacy rowsets with empty resource IDs as successfully queued for
KV deletion instead of reporting a recycling failure.

**The current statistical logic has a bug; there's no need to worry
about recycled_num and recycled_bytes.**

The performance check watermark can be controlled via the environment
variable `recycler_benchmark_duration_tolerance_ratio`.


```
recycler benchmark: operation=recycle_rowsets
  branch                                           total_ms   recycled_num    recycled_bytes      get_keys      put_keys      del_keys    total_keys
  compacted_empty                                   1708.36          30000          46080000         30000             0         30000         60000
  compacted_with_data/data_only                     3489.12          30000          46080000         30001             0         30000         60001
  compacted_with_data/delete_bitmap_v1              4084.44          30000          46080000         30000             0         30000         60000
  compacted_with_data/delete_bitmap_v2              3869.88          30000          46080000         60000             0         60000        120000
  compacted_with_packed_data/data_only              9444.14              0                 0         63000         30000         33000        126000
  compacted_with_packed_data/delete_bitmap_v1       9465.94              0                 0         63000         30000         33000        126000
  compacted_with_packed_data/delete_bitmap_v2      10366.38          30000          46080000         93000         30000         63000        186000
  compacted_without_schema                          6544.83          30000          46080000         30000             0         30000         60000
  legacy_empty_resource                             1657.66              0                 0         30000             0         30000         60000
  legacy_with_resource                              5227.31          30000                 0         60000             0         60000        120000
  mixed                                            46285.68          90000          92160000        600000        120000        360000       1080000
  prepare_abort                                    22566.18              0                 0        270000         90000         90000        450000
  prepare_direct                                    5841.44              0                 0         60000             0         60000        120000
  prepare_mark                                      8208.94              0                 0        120000         30000         60000        210000
  total                                           138760.29         300000         368640000       1539001        330000        969000       2838001
```
yiguolei pushed a commit that referenced this pull request Sep 30, 2026
yiguolei pushed a commit that referenced this pull request Oct 8, 2026
liaoxin01 pushed a commit that referenced this pull request Oct 10, 2026
…68622)

### What problem does this PR solve?

Related PR: #68043

Problem Summary: The recycler benchmark ran as part of recycler_test and
used fixed elapsed-time thresholds, making default test runs slower and
timing-dependent. Move it into a standalone recycler_benchmark_test
binary and skip it during default Cloud test discovery while preserving
explicit selection with --test. Reduce the workload to 5,000 rowsets per
branch, update all 14 observed KV count baselines, and remove
elapsed-time failure thresholds. Timings remain in the benchmark report.
wyxxxcat added a commit to wyxxxcat/doris that referenced this pull request Oct 13, 2026
…pache#68622)

### What problem does this PR solve?

Related PR: apache#68043

Problem Summary: The recycler benchmark ran as part of recycler_test and
used fixed elapsed-time thresholds, making default test runs slower and
timing-dependent. Move it into a standalone recycler_benchmark_test
binary and skip it during default Cloud test discovery while preserving
explicit selection with --test. Reduce the workload to 5,000 rowsets per
branch, update all 14 observed KV count baselines, and remove
elapsed-time failure thresholds. Timings remain in the benchmark report.
github-actions Bot pushed a commit that referenced this pull request Oct 13, 2026
…68622)

### What problem does this PR solve?

Related PR: #68043

Problem Summary: The recycler benchmark ran as part of recycler_test and
used fixed elapsed-time thresholds, making default test runs slower and
timing-dependent. Move it into a standalone recycler_benchmark_test
binary and skip it during default Cloud test discovery while preserving
explicit selection with --test. Reduce the workload to 5,000 rowsets per
branch, update all 14 observed KV count baselines, and remove
elapsed-time failure thresholds. Timings remain in the benchmark report.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants