eldenmoon opened a new pull request, #71194: URL: https://github.com/apache/doris/pull/71194
### Background Group Commit can acknowledge an asynchronous insert once the backend writes its data to a write-ahead log (WAL). After a restart, the backend replays pending WAL records before they become visible and can be compacted. ### What problem does this PR solve? Issue Number: None Related PR: #71029 (superseded), #71144 (4.2), #71145 (4.1) PR Type: Bugfix Problem Summary: Upgrading a backend with a pending Variant V1 WAL from Doris 4.0 can prevent replay when the backend only produces Variant V2 columns. Read the original wire layout and restore the values in Variant V2. Group Commit can also defer JSON parsing by storing the input as a String root, so eligible columns are parsed with the existing V2 JSON encoder during decode. ### Details - **Change map:** Move six shared assembly files in a separate commit. The compatibility change adds a V1 wire decoder, its type dispatch, and tests with historical WAL and segment fixtures. - **Frequency:** Always with the reproduced 4.0 Group Commit WAL on the tested original backend. - **Root cause:** The original V2 reader rejects V1 metadata. A historical Group Commit writer can also leave unparsed JSON in a V1 String root, which must be interpreted to restore its structured value. - **Why existing tests missed it:** BlockVariantWireFormatTest covered synthetic metadata, and the existing Group Commit SQL suite queried rows already committed before any restart. Neither exercised this pending WAL from an old backend. - **Fix:** Validate the V1 column and read its sparse and optional doc maps. Reparse a single logical String root when both maps have no entries. Reuse the shared assembler for the other V1 columns and use the original nullable framing. - **Other paths and branches:** Release branches 4.1 and 4.2 select the requested V1 or V2 execution type. Native V2 blocks keep their current decoding path. - **Behavior change:** A valid JSON document in an eligible old String root can be interpreted as a Variant value when decoded into V2. ### Testing - The original master implementation failed the historical WAL replay test on the V1 wire format. The V2 conversion restores the structured values from the fixture. - 206 focused ASAN BE tests passed on this revision, including historical WAL fixtures, projection and reordering, Nullable, and native V2 round trips. - The prior #71029 head passed a real 4.0.8-rc02 upgrade. Four pending WAL rows became visible and the WAL was removed. Full compaction merged four rowsets into one and all nine query rows matched. That full-cluster run was on the prior revision. ### Notes for Reviewers - This revision restores the target branch's existing shared JSON parser. The WAL decoder still uses that encoder for eligible V1 roots. - The [previous review](https://github.com/apache/doris/pull/71029#pullrequestreview-6116851395) reported three cases for follow-up verification involving doc-map markers, materialized keys containing literal dots, and typed STRUCT roots. ### 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: Not ready: three compatibility findings from the prior review remain open. ### AI Disclosure - Tool: OpenAI Codex - Generated: Compatibility code, tests, and PR 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]
