eldenmoon opened a new pull request, #71145: URL: https://github.com/apache/doris/pull/71145
### Background Group Commit can acknowledge an asynchronous insert after writing its data to the backend WAL. After a restart the backend replays pending WAL records, then reads and compacts the committed rowsets. ### What problem does this PR solve? Issue Number: None Related PR: #71029 (master compatibility and WAL fixtures) PR Type: Bugfix Problem Summary: Upgrading a backend with a pending Variant V1 WAL from Doris 4.0 prevents records from being replayed. Read the historical wire layout and restore the Variant values so the records become visible after upgrade. ### Details - **Change map:** Two production files change 24 lines. The added fixture tests and scanner tests account for most of the patch. - **Frequency:** Always with the reproduced 4.0 Group Commit WAL on the tested unfixed backend. - **Root cause:** The old plan can omit the scanner option, so the dispatch falls through to the legacy file scanner. The V1 deserializer also rejects a header without the doc-value flag. - **Why existing tests missed it:** BlockVariantWireFormatTest exercised in-memory metadata. test_group_commit_variant restarted after the inserted data was already visible. Neither proved that a pending WAL from an older backend restored its values after upgrade. - **Fix:** Always route internal WAL scans to FileScannerV2. Decode the V1 sparse map and initialize an empty doc-value map for blocks that predate that field. - **Other paths and branches:** 4.2 and master have independently verified fixes. Routing is scoped to the internal WAL format. Other file loads keep their existing routing. - **Behavior change:** An upgraded BE restores pending legacy Variant WALs and their structured values. ### Testing - Red on branch-4.1 on dev-x. FileScannerV2Test.RoutesWalReplayWithoutScannerOption rejects the old routing, and WalReaderV2Test.ReplaysLegacyVariantAcrossProjectedBlocks fails on legacy decoding. The real upgrade reports that external VARIANT columns require FileScannerV2. - Green on dev-x. 161 ASAN BE unit tests passed. - A real Doris 4.0.8-rc02 FE and BE left three committed rows and a WAL with four pending rows. After replacing only the BE, all four rows became visible and the WAL was removed. Full compaction combined [0-1], [2-2], [3-3] and [4-4] into [0-4]. All nine query rows matched before and after, including nested Variant values, arrays and nulls. - The branch-specific insert_p0/test_group_commit_variant regression passed in an isolated cluster. ### Release note Backends can replay pending Variant V1 WALs from Doris 4.0 after an upgrade and compact the recovered data with existing rowsets. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Partially verified: GitHub CI is pending. ### AI Disclosure - Tool: OpenAI Codex - Generated: Compatibility code, test automation, and this description - Human review: Pending maintainer review -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
