This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 435c387701e [fix](storage) Fix GCC unity build for row-ID conversion 
(#70736)
435c387701e is described below

commit 435c387701e8698a0f08437ea9fd8832df16b172
Author: bobhan1 <[email protected]>
AuthorDate: Thu Nov 19 15:10:01 2026 +0800

    [fix](storage) Fix GCC unity build for row-ID conversion (#70736)
    
    ### Background
    
    Compaction maps input row IDs to output segment and row IDs for delete
    bitmap conversion and inverted-index merging. The row-ID conversion
    implementation stores its dense, lazy-chunked, and compressed layouts in
    a `std::variant`.
    
    ### What problem does this PR solve?
    
    Issue Number: None
    Related PR: #70350 (introduced the compile failure)
    PR Type: Bugfix
    
    Problem Summary:
    
    The Performance lane's GCC 15.1.0 Release build fails when compiling the
    Storage unity batch. GCC reports `-Werror=subobject-linkage` on
    `RowIdConversion::Storage` at `rowid_conversion.cpp:199`. Give the
    storage alternatives and their destination type external linkage.
    
    ### Details
    
    - **Frequency:** Always when the affected source is compiled as part of
    the Storage unity batch with GCC 15.1.0 and `-Werror`.
    - **Root cause:** The externally linked `RowIdConversion::Storage`
    contains a variant whose three alternatives have internal linkage. The
    dense and lazy-chunked alternatives also store an anonymous-namespace
    destination type.
    - **Why existing tests missed it:**
    `CompressedRowIdMapTest.StorageAlternativesReleaseAllTrackedMemory`
    checks all three layouts and their memory accounting.
    `test_mow_compaction_and_read_stale` checks visible rows after
    compaction. Both exercise runtime results after BE has compiled. The
    failing condition is specific to the compiler and unity build.
    - **Fix:** Close the anonymous namespace before the storage types and
    their shared destination type. Their definitions stay in the
    implementation file.
    - **Other paths and branches:** Local and cloud compaction share the
    Storage target. The affected Apache Doris branch is `master`, where
    #70350 added this implementation. The checked `branch-3.1`,
    `branch-4.0`, `branch-4.1`, and `branch-4.2` tips predate it.
    
    ### Testing
    
    - Compiled the same Storage unity translation unit locally with the GCC
    15.1.0 Release command generated by `build.sh --be`. With unity enabled,
    PCH disabled, and `-Werror` active, the baseline `6e7bea93c53` failed
    with `-Werror=subobject-linkage` and the fix produced the object file
    successfully.
    - Compiled the patched Storage unity translation unit locally with Clang
    20.1.8 in the Release BE configuration with unity enabled, PCH disabled,
    and coverage enabled.
    - Built, linked, and packaged `doris_be` locally with `build.sh --be -j
    32` using GCC 15.1.0 Release, `-O3`, unity enabled, PCH disabled,
    jemalloc enabled, Azure disabled, and BE tests disabled.
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Behavior changed: No
    - Does this need documentation: No
    - Pre-submission status: Ready
    
    ### AI Disclosure
    
    - Tool: Codex (GPT-6)
    - Generated: Code change and PR description
    - Human review: not stated
---
 be/src/storage/rowid_conversion.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/be/src/storage/rowid_conversion.cpp 
b/be/src/storage/rowid_conversion.cpp
index 88fa6e6eb5c..682b1b94911 100644
--- a/be/src/storage/rowid_conversion.cpp
+++ b/be/src/storage/rowid_conversion.cpp
@@ -42,6 +42,10 @@ Status check_rowid_memory_limit(size_t reserved_memory) {
             GlobalMemoryArbitrator::process_mem_log_str(), tracker->label(),
             tracker->peak_consumption(), tracker->consumption()));
 }
+} // namespace
+
+// Storage's variant alternatives and their member types need external linkage
+// for GCC's -Wsubobject-linkage check in unity builds.
 
 // Both uncompressed layouts store segment/row pairs as the writer advances.
 struct RowIdDestination {
@@ -194,7 +198,6 @@ struct CompressedRowIdStorage {
     uint64_t next_global_row = 0;
     bool finalized = false;
 };
-} // namespace
 
 struct RowIdConversion::Storage {
     explicit Storage(Mode mode) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to