eldenmoon opened a new pull request, #71144:
URL: https://github.com/apache/doris/pull/71144

   ### 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:** One production file changes 18 lines. The real WAL and 
segment fixtures and their 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 V1 deserializer treats the absence of the doc-value 
marker as an unsupported format, although the older block ends immediately 
after its sparse map.
   - **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:** Decode the legacy layout using the marker to determine whether 
the doc-value map is present. Initialize an empty map for the older layout.
   - **Other paths and branches:** 4.1 and master have independently verified 
fixes. The existing V1 layout with a doc-value map continues to decode.
   
   - **Behavior change:** An upgraded BE restores pending legacy Variant WALs 
and their structured values.
   
   ### Testing
   
   - Red on branch-4.2 on dev-x. 
WalReaderV2Test.ReplaysLegacyVariantAcrossProjectedBlocks and real replay fail 
with legacy Variant V1 block lacks doc-value data before the fix.
   - Green on dev-x. 118 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]

Reply via email to