-
Notifications
You must be signed in to change notification settings - Fork 439
[kv] Supports compacted row as change log #2108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[kv] Supports compacted row as change log #2108
Conversation
There was a problem hiding this 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 pull request adds support for using compacted row format as a change log in primary key tables. The change enables a new COMPACTED log format option alongside existing ARROW and INDEXED formats, providing a space-optimized row-oriented format that trades CPU for reduced storage.
Key changes:
- Introduces
COMPACTEDas a new log format option for primary key tables withCOMPACTEDkv format - Implements compacted row encoding/decoding infrastructure with variable-length integer encoding (VLQ)
- Refactors existing indexed log builder to extract common functionality into a shared abstract base class
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| fluss-server/src/main/java/org/apache/fluss/server/utils/TableDescriptorValidation.java | Updates validation logic to allow both ARROW and COMPACTED log formats when kv format is COMPACTED |
| fluss-server/src/main/java/org/apache/fluss/server/kv/wal/CompactedWalBuilder.java | New WAL builder implementation for COMPACTED log format with row encoding support |
| fluss-server/src/main/java/org/apache/fluss/server/kv/KvTablet.java | Integrates CompactedWalBuilder into KV tablet for handling COMPACTED log format |
| fluss-common/src/main/java/org/apache/fluss/record/CompactedLogRecord.java | New log record class implementing space-optimized encoding for CompactedRow format |
| fluss-common/src/main/java/org/apache/fluss/record/MemoryLogRecordsCompactedBuilder.java | Builder for creating memory log records in COMPACTED format |
| fluss-common/src/main/java/org/apache/fluss/record/AbstractRowMemoryLogRecordsBuilder.java | New abstract base class extracting common logic from row-based log record builders |
| fluss-common/src/main/java/org/apache/fluss/record/MemoryLogRecordsIndexedBuilder.java | Refactored to extend AbstractRowMemoryLogRecordsBuilder, reducing code duplication |
| fluss-common/src/main/java/org/apache/fluss/record/LogRecordReadContext.java | Adds support for creating read contexts for COMPACTED format with projection validation |
| fluss-common/src/main/java/org/apache/fluss/record/DefaultLogRecordBatch.java | Implements iterator for reading COMPACTED log records from batches |
| fluss-common/src/main/java/org/apache/fluss/metadata/LogFormat.java | Adds COMPACTED enum value and updates documentation |
| fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java | Updates configuration documentation to include COMPACTED format |
| fluss-common/src/test/java/org/apache/fluss/record/MemoryLogRecordsCompactedBuilderTest.java | Comprehensive unit tests for CompactedBuilder including append, abort, and offset semantics |
| fluss-common/src/test/java/org/apache/fluss/record/CompactedLogRecordTest.java | Unit tests for CompactedLogRecord serialization/deserialization |
| fluss-client/src/test/java/org/apache/fluss/client/table/FlussTableITCase.java | Integration tests for COMPACTED log format including upsert, delete, and projection validation |
| fluss-client/src/test/java/org/apache/fluss/client/admin/FlussAdminITCase.java | Updates test assertion to match new validation error message |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import static org.apache.fluss.record.LogRecordBatchFormat.LENGTH_LENGTH; | ||
|
|
||
| /** | ||
| * An immutable log record for @CompactedRow which can be directly persisted. The on-wire schema is |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JavaDoc reference should use {@link CompactedRow} instead of @CompactedRow for proper linking.
| * An immutable log record for @CompactedRow which can be directly persisted. The on-wire schema is | |
| * An immutable log record for {@link CompactedRow} which can be directly persisted. The on-wire schema is |
| if (currentRecordNumber > 0) { | ||
| outputView.writeInt(currentRecordNumber - 1); | ||
| } else { | ||
| // If there is no record, we write 0 for filed lastOffsetDelta, see the comments about |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "filed" should be "field".
| // If there is no record, we write 0 for filed lastOffsetDelta, see the comments about | |
| // If there is no record, we write 0 for field lastOffsetDelta, see the comments about |
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 'equals()' method does not check argument type.
Purpose
Linked issue: close #2107
Brief change log
CP from #1605 , only keep the code of supporting compacted row as change log
Tests
API and Format
Documentation