Repository navigation
[IoTConsensus] Preserve WAL needed by reconstructed peers - #19268
Open
hongzhi-gao wants to merge 1 commit into
Open
hongzhi-gao wants to merge 1 commit into
hongzhi-gao wants to merge 1 commit into
Conversation
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.
Description
Reconstructing a replica in a two-replica IoTConsensus region temporarily leaves one replica. That transition permits WAL reclamation, but registering the replacement channel does not immediately restore its retention boundary. Cleanup can also keep using the file boundary calculated before registration. Incremental WAL needed after the snapshot can therefore disappear. The dispatcher currently skips missing indexes, allowing replication progress to advance across the hole.
For example, the new regression scenario pauses snapshot transmission, acknowledges 12,000 more writes, and runs WAL cleanup. With the original production code at
ed9504f3ae, isolating the reconstructed replica returns only the snapshot's 1 row instead of the expected 12,001 rows. With this fix, each isolated replica returns all 12,001 timestamps and values.Changes
No on-disk or RPC format changes are introduced. Validation targets two data replicas; the catch-up wait checks the coordinator's outbound channel.
Validation
IoTConsensusServerImplTest: 5 tests passed, including immediate retention publication, catch-up timeout, and failure on a WAL gap. Re-run after the localization change.WALNodeTest: 3 tests passed, including a deterministic cleanup-initialization / boundary-lowering / deletion sequence and listener notifications.LoadTsFileManagerTest: 30 tests passed.IoTDBRegionReconstructWALIT: passed with 1 ConfigNode and 3 DataNodes, data RF=2. Uses the existing debugger fixture to pause only snapshot transmission, exceeds the dispatcher queue capacity, invokes real WAL cleanup, and verifies both replicas separately by stopping the other replica. The old-code regression run failed with 1/12,001 rows.mvn test-compile -o -DskipTests -Ddevelocity.off=trueand the same full-reactor command with-Pwith-zh-locale: passed after localization. Compiled Chinese constants and the missing-WAL exception were inspected.git diff --check: passed.The WAL/LOAD tests and IT ran before the final message-only localization change. Process-kill crash tests, I/O fault injection, and cross-host performance tests were not run.
Focused test commands
Performance observations
Compared the previous correctness-fix implementation (per-file binary search / unconditional listener notification) with the optimized implementation, not with unfixed upstream. Three alternating repetitions per version used a shared HDD host, colocated 1C2D with RF=2, ASYNC WAL, 8 clients, and 10-row tablets with 3 INT64 measurements per row. Each run used fresh directories, a 10-second warmup, a 30-second steady window, and a 60-second reconstruction window. All six runs checked acknowledged write counts and confirmed reconstruction success before the window ended.
Throughput medians changed by -0.39% and -0.53%; steady P99 increased by 3.27%. These measurements do not establish zero regression. Existing approximately 30-second remove-channel stalls occurred in five runs and are outside this change.
A separate synthetic-metadata benchmark of the real eligibility predicate reduced the median 100,000-file scan at a stable finite boundary from 307.45 ms to 0.391 ms; the MAX_VALUE fast branch remained about 1.65 ms versus 1.62 ms. This excludes file deletion and lock contention and is not an end-to-end speedup claim.
This PR has: