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

   ### Background
   
   MySQL CDC reads column metadata from `TABLE_MAP` events before decoding 
binlog row changes. Native MySQL uses optional metadata tag 12 for column 
visibility and tag 13 for VECTOR dimensions.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Bugfix
   
   Problem Summary:
   
   PolarDB writes VECTOR dimensions under tag 12. Interpreting those bytes as a 
visibility bitmap can cause incremental synchronization to fail with EOF on 
wide tables, while narrow tables can continue with incorrect metadata. Detect 
PolarDB once per reader and decode tag 12 as packed VECTOR dimensions for that 
source, preserving native MySQL decoding. Most added lines cover parser, 
reader, and integration tests.
   
   For three VECTOR columns with dimensions `[4, 4, 2]`, PolarDB supplies three 
metadata bytes:
   
   | Table width | Before | After |
   | --- | --- | --- |
   | 9 columns | Dimensions are missing although row values may match | 
Dimensions decode as `[4, 4, 2]` |
   | 25 columns | Decoder expects four visibility bytes and encounters EOF | 
Dimensions decode as `[4, 4, 2]` |
   
   ### Details
   
   - **Frequency:** Always when PolarDB tag-12 VECTOR metadata is shorter than 
the expected visibility bitmap. Runtime reproduction was not repeated on this 
master-based branch.
   - **Root cause:** `TableMapEventMetadataDeserializer` interprets tag 12 as 
column visibility regardless of the source metadata format.
   - **Why existing tests missed it:** `MySqlVectorITCase` exercises native 
MySQL metadata. The existing `test_streaming_mysql_job_vector` regression used 
a narrow table and checked row values, which could still match with missing 
VECTOR dimensions. Added parser tests check dimensions directly, and the 
regression now uses a wider table.
   - **Fix:** Probe `polardb_version` once per source reader and pass the 
detected format into TABLE_MAP decoding. This requires no new user setting or 
data source type.
   - **Other paths and branches:** Snapshot backfill and incremental reading 
share format selection. Native MySQL retains visibility and tag-13 decoding. 
Release branches 3.1, 4.0, 4.1, and 4.2 were not checked in this transfer.
   
   ### Testing
   
   - Cherry-pick applied without conflicts; stable patch-id matches the source 
commit.
   - `git diff --check upstream/master...HEAD`: passed locally; worktree is 
clean.
   - Includes `PolarDbTableMapEventDataDeserializerTest`, reader unit coverage, 
and updated VECTOR integration and regression cases. No build, style check, 
unit test, integration test, or regression test was run on this master-based 
branch; test pipeline coverage was not verified.
   
   ### Release note
   
   Fix MySQL CDC synchronization failures caused by PolarDB VECTOR metadata in 
wide tables.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: patch transfer verified; build 
compatibility and runtime behavior on master have not been tested.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: this description; no new code or tests were generated during 
this transfer.
   - Human review: not stated
   


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