[fix](test) Fix ODR violation for MockFileReader across test files.#61170
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
Multiple test files defined different MockFileReader classes with the same fully-qualified name doris::MockFileReader but different member layouts and sizes (96 bytes vs 64 bytes). When linked into the single monolithic doris_be_test binary, the linker would deduplicate symbols and arbitrarily pick one version's template instantiations (e.g., make_shared, destructor), causing size mismatches at runtime. This resulted in ASAN errors: - heap-buffer-overflow: allocating 80 bytes but writing 96 bytes - new-delete-type-mismatch: allocated 96 bytes, deallocated 64 bytes The ODR conflict was exposed after apache#61142 removed the vectorized namespace, which moved orc_file_reader_test.cpp's MockFileReader into namespace doris, colliding with file_meta_cache_test.cpp's MockFileReader in the same namespace. Fix: Wrap each MockFileReader class in an anonymous namespace to give them internal linkage, ensuring each translation unit uses its own independent symbols.
1e1b368 to
ba4fb8b
Compare
|
run buildall |
|
/review |
|
PR approved by at least one committer and no changes requested. |
Code Review SummaryVerdict: No issues found. The change is correct, minimal, and well-targeted. Critical Checkpoint Conclusions
Minor Observation (not blocking)
|
TPC-H: Total hot run time: 27697 ms |
TPC-DS: Total hot run time: 153610 ms |
|
skip buildall |
What problem does this PR solve?
Problem Summary:
Release note
Multiple test files defined different MockFileReader classes with the same fully-qualified name doris::MockFileReader but different member layouts and sizes (96 bytes vs 64 bytes). When linked into the single monolithic doris_be_test binary, the linker would deduplicate symbols and arbitrarily pick one version's template instantiations (e.g., make_shared, destructor), causing size mismatches at runtime. This resulted in ASAN errors:
Fix: Wrap each MockFileReader class in an anonymous namespace to give them internal linkage, ensuring each translation unit uses its own independent symbols.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)