fix(core): fix degradation into 1 by 1 wal transaction application when queue is big#5725
Merged
bluestreak01 merged 6 commits intomasterfrom Jun 12, 2025
Merged
fix(core): fix degradation into 1 by 1 wal transaction application when queue is big#5725bluestreak01 merged 6 commits intomasterfrom
bluestreak01 merged 6 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where WAL application degrades into 1-by-1 commits when the queue is large by correcting the back-fill logic in WalTxnDetails, adding coverage for the incremental scenario in tests, and introducing a new getCommitLatency configuration property.
- Adjusted the transaction metadata loading and back-fill loops in
WalTxnDetailsto handle newly loaded entries correctly. - Added
testLastCommitToTimestampIncrementalinWalTxnDetailsFuzzTestto cover the incremental commit-to-timestamp behavior. - Introduced
getCommitLatencyin the configuration interfaces and provided implementations in default and wrapper classes.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| core/src/test/java/io/questdb/test/cairo/wal/WalTxnDetailsFuzzTest.java | Added new incremental commit-to-timestamp test and updated package/import |
| core/src/test/java/io/questdb/test/cairo/wal/TableTransactionLogFuzzTest.java | Updated test package path |
| core/src/main/java/io/questdb/cairo/wal/WalTxnDetails.java | Refined metadata read loops, added early exit for no-load case |
| core/src/main/java/io/questdb/cairo/DefaultCairoConfiguration.java | Added getCommitLatency() override with default value |
| core/src/main/java/io/questdb/cairo/CairoConfigurationWrapper.java | Delegated new getCommitLatency() method |
| core/src/main/java/io/questdb/cairo/CairoConfiguration.java | Made getCommitLatency() abstract (removed default implementation) |
Comments suppressed due to low confidence (4)
core/src/main/java/io/questdb/cairo/CairoConfiguration.java:145
- Changing
getCommitLatencyto an abstract method is a breaking API change that impacts any customCairoConfigurationimplementations. Consider providing a default implementation or bumping the major version to avoid regressions.
long getCommitLatency();
core/src/main/java/io/questdb/cairo/CairoConfiguration.java:145
- The
getCommitLatencymethod lacks JavaDoc specifying the time unit (e.g., nanoseconds). Adding documentation will help callers understand what the returned value represents.
long getCommitLatency();
core/src/main/java/io/questdb/cairo/wal/WalTxnDetails.java:516
- Returning early when no transactions are loaded prevents the following loop from resetting
commitToTimestamptoLong.MIN_VALUEfor existing entries, potentially leaving stale values. Verify that skipping the second loop is intended.
if (transactionMeta.size() == initialSize) {
core/src/main/java/io/questdb/cairo/wal/WalTxnDetails.java:463
- The condition was relaxed from
< loadFromSeqTxnto<= loadFromSeqTxn, which may introduce an off-by-one shift in transaction indexing. Please add or update tests for the scenario wherestartSeqTxn == loadFromSeqTxnto confirm correct behavior.
if (lastLoadedSeqTxn >= loadFromSeqTxn && startSeqTxn <= loadFromSeqTxn) {
Member
|
we have segfault galore on this PR and master (not sure if they are the same) |
bluestreak01
approved these changes
Jun 11, 2025
Contributor
[PR Coverage check]😍 pass : 7 / 8 (87.50%) file detail
|
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.
Pull Request Overview
This PR fixes an issue where WAL application degrades into 1-by-1 commits when the queue is large by correcting the back-fill logic in WalTxnDetails, adding coverage for the incremental scenario in tests, and introducing a new getCommitLatency configuration property.
Adjusted the transaction metadata loading and back-fill loops in WalTxnDetails to handle newly loaded entries correctly.
Added testLastCommitToTimestampIncremental in WalTxnDetailsFuzzTest to cover the incremental commit-to-timestamp behavior.
Introduced getCommitLatency in the configuration interfaces and provided implementations in default and wrapper classes.
This manifests into something like:
And from some point on
commitToTsis set to294247-01-10T04:00:54.775807Z, which means that a full commit is to be performed after every transaction.