[kv] Treat full-schema partial writes as full row for DefaultRowMerger#3325
Open
zuston wants to merge 2 commits into
Open
[kv] Treat full-schema partial writes as full row for DefaultRowMerger#3325zuston wants to merge 2 commits into
zuston wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
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 returnthiswhen targets cover all fields (same asnulltargets). - 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #xxx
Upper-layer frameworks sometimes route every upsert through
UpsertWriterpartial-update APIs even when all columns are provided. That forced thePartialUpdateRowMergerpath 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