Skip to content

[kv] Treat full-schema partial writes as full row for DefaultRowMerger#3325

Open
zuston wants to merge 2 commits into
apache:mainfrom
zuston:kvallcolumns
Open

[kv] Treat full-schema partial writes as full row for DefaultRowMerger#3325
zuston wants to merge 2 commits into
apache:mainfrom
zuston:kvallcolumns

Conversation

@zuston
Copy link
Copy Markdown
Member

@zuston zuston commented May 15, 2026

Purpose

Linked issue: close #xxx

Upper-layer frameworks sometimes route every upsert through UpsertWriter partial-update APIs even when all columns are provided. That forced the PartialUpdateRowMerger path and prevented WAL optimizations that depend on DefaultRowMerger, producing excessive RocksDB gets and slowing tablet RPC.

When targetColumns covers every index of the latest schema, behave like null target columns and keep plain DefaultRowMerger semantics.

Brief change log

Tests

API and Format

Documentation

@zuston zuston marked this pull request as ready for review May 15, 2026 09:27
@luoyuxia luoyuxia requested a review from Copilot May 25, 2026 12:25
Copy link
Copy Markdown
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 improves KV upsert performance by ensuring that when a client passes targetColumns that cover the entire latest schema, the server treats the write as a full-row upsert (equivalent to targetColumns == null) so DefaultRowMerger can keep its plain merge behavior and avoid the partial-update path.

Changes:

  • Add TargetColumns.specifiesAllSchemaFieldIndexes(...) to detect when explicit targets cover the full schema.
  • Update DefaultRowMerger.configureTargetColumns(...) to return this when targets cover all fields (same as null targets).
  • Add/adjust unit tests for the new target-columns interpretation and merger behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
fluss-server/src/main/java/org/apache/fluss/server/kv/TargetColumns.java New helper to detect “full-schema” targetColumns arrays.
fluss-server/src/main/java/org/apache/fluss/server/kv/rowmerger/DefaultRowMerger.java Treat full-schema target columns as full-row to avoid partial updater wrapping.
fluss-server/src/test/java/org/apache/fluss/server/kv/TargetColumnsTest.java Unit tests for the new TargetColumns helper behavior.
fluss-server/src/test/java/org/apache/fluss/server/kv/rowmerger/DefaultRowMergerTest.java Test that explicit full-schema targets return the plain DefaultRowMerger and keep behavior consistent.

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

Comment on lines 94 to 98
void testPartialUpdateRowMergerDeleteBehavior(DeleteBehavior deleteBehavior) {
DefaultRowMerger merger = new DefaultRowMerger(KvFormat.COMPACTED, deleteBehavior);

// Configure for partial update (only name column)
// Explicit full schema ({id, name}) matches plain merger behavior (same as null targets).
RowMerger partialMerger =
int fieldCount = schema.getRowType().getFieldCount();
if (fieldCount == 0) {
return targetColumns.length == 0;
}
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.

2 participants