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

   ### What problem does this PR solve?
   
   Problem Summary: During a mixed-version upgrade, a 4.1 backend can receive a 
Variant V1 block from an older backend. 4.0, for example, reports 
`be_exec_version` 8, which this branch still accepts, and its V1 payload ends 
after the sparse Map. This branch's V1 deserializer reads a trailing doc-value 
Map, so a legacy block makes the decoder read past the Variant payload and can 
crash the receiving backend during a load or an exchange.
   
   Pass the presence of `variant_enable_doc_mode` through the factory's Variant 
V1 branch and reject a V1 block at the Variant deserialization entry when the 
field is absent. Presence, not the field value, is the format marker: this 
branch sets the field even when doc mode is false, and it always writes the 
trailing Map. Variant V2 keeps its own marker and is not affected. Nested 
ARRAY/MAP/STRUCT variant columns use the existing recursive type construction 
and are covered as well. Block, the wire layout and `be_exec_version` are 
unchanged.
   
   The check runs after Block decompression and may run after preceding columns 
or enclosing container headers have been decoded, using the existing 
exception-to-Status handling. It protects updated receivers against decoding a 
legacy Variant V1 payload as the current V1 layout; it does not add sender 
capability negotiation or bounded parsing, validate unrelated malformed 
headers, or protect unpatched old receivers.
   
   ### Release note
   
   Return an explicit error for legacy Variant V1 blocks that do not carry 
doc-value data.
   
   ### Check List (For Author)
   
   - Test: Focused ASAN `BlockVariantWireFormatTest.*:BlockTest.*` run on 
branch-4.1 with `run-be-ut.sh`: 33/33 passed after the fix. Without it, the 
legacy-payload test aborts with an ASAN heap-buffer-overflow reading 8 bytes 
past a 76-byte Variant V1 payload (`DataTypeVariant::deserialize` -> 
`DataTypeMap::deserialize`), and the marker-removal test fails because the 
block is accepted. Temporary focused CMake source selection was restored before 
committing.
   - Validation limit: focused BE test build with a temporary CMake source 
selection (restored before committing); no 4.1 cluster runtime RPC validation 
was performed for this backport. The 4.1 V1 reader keeps accepting 4.1 blocks 
that carry the doc-value marker; only the older layout is rejected.
   - Behavior changed: Yes; legacy Variant V1 blocks fail before Variant 
payload decoding.
   - Does this need documentation: No
   
   cherry-pick #69434. The 4.1 branch keeps a V1 reader, so only V1 blocks 
without the doc-value marker are rejected instead of all V1 blocks.
   


-- 
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