Skip to content

[tests] Add DynamicWriteBatchSizeEstimator integration tests#643

Open
Prajwal-banakar wants to merge 2 commits into
apache:mainfrom
Prajwal-banakar:integration-tests
Open

[tests] Add DynamicWriteBatchSizeEstimator integration tests#643
Prajwal-banakar wants to merge 2 commits into
apache:mainfrom
Prajwal-banakar:integration-tests

Conversation

@Prajwal-banakar

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #539

Adds integration tests for DynamicWriteBatchSizeEstimator to verify end-to-end write correctness through a real cluster for all four scenarios described in the issue.

Brief change log

  • Added crates/fluss/tests/integration/dynamic_batch_size.rs with 4 integration tests covering:
    • Many small rows cause the estimator to shrink batch size toward min
    • Rows close to batch size cause the estimator to grow toward max
    • Disabled config keeps the static writer_batch_size unchanged
    • Concurrent writers from separate connections don't corrupt estimator state
  • Registered the new module in crates/fluss/tests/test_fluss.rs

Tests

  • small_rows_shrink_batch_size — writes 200 tiny rows with dynamic sizing enabled; verifies all writes succeed
  • large_rows_grow_batch_size — writes rows filling >80% of batch capacity; verifies all writes succeed
  • disabled_keeps_static_batch_size — writes with writer_dynamic_batch_size_enabled = false; verifies all writes succeed
  • concurrent_writers_dont_corrupt_state — spawns 4 concurrent writer tasks each with its own connection; verifies all writes succeed without errors

API and Format

No changes to API or storage format.

Documentation

No new feature introduced. This PR only adds integration tests for an existing feature.

@Prajwal-banakar Prajwal-banakar changed the title Integration tests [tests] Add DynamicWriteBatchSizeEstimator integration tests Jun 27, 2026
@Prajwal-banakar

Copy link
Copy Markdown
Contributor Author

Hi @charlesdong1991 @fresh-borzoni could you please help review this!? The failing Elixir check appears to be unrelated to this PR's changes, PTAL.

@charlesdong1991 charlesdong1991 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.

Thanks for the PR! Left some comments, PTAL

let row = make_row(i, "x");
writer.append(&row).expect("Failed to append row");
}
writer.flush().await.expect("Failed to flush");

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.

i doubt this test will do the job (based on the comment and test func name) 🤔 since it only asserts flush succeeds, but don't observe estimated batch size, if a regression happens which disables shrinking, that will still pass i guess

so effectively, it is more like checking if dynamic write craches, but not end-to-end test that checks shrinking batch size towards min IMHO

let row = make_row(i, &large_payload);
writer.append(&row).expect("Failed to append row");
}
writer.flush().await.expect("Failed to flush");

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.

similar here, i don't think in this case (starting with above 80% of max) will observe growth, i think we should rework it to shrink-then-grow with a read back assertion for an actual end-to-end test

/// Multiple concurrent writers to the same table should not corrupt the estimator.
/// Each writer uses its own connection; all writes must succeed.
#[tokio::test]
async fn concurrent_writers_dont_corrupt_state() {

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.

as mentioned in comment and in spawning below, these will be 4 independent connections/estimators, so there will be no shared state to corrupt, so i wonder if this func name is intended or not? Or what actually do we intend to test?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust][tests] Add DynamicWriteBatchSizeEstimator integration tests

2 participants