Fix RUN_GTEST/RUN_GBENCH leak into pax.so build#1591
Open
zhangyue1818 wants to merge 1 commit intoapache:mainfrom
Open
Fix RUN_GTEST/RUN_GBENCH leak into pax.so build#1591zhangyue1818 wants to merge 1 commit intoapache:mainfrom
zhangyue1818 wants to merge 1 commit intoapache:mainfrom
Conversation
my-ship-it
approved these changes
Mar 2, 2026
gfphoenix78
approved these changes
Mar 3, 2026
ADD_DEFINITIONS(-DRUN_GTEST) and ADD_DEFINITIONS(-DRUN_GBENCH)
are directory-scoped CMake commands that apply to ALL targets,
including the production pax shared library. This caused test-
only macros to be defined in production builds.
In pax_porc_adpater.cc, the leaked RUN_GTEST activates:
expect_hdr = rel_tuple_desc_->attrs[index].attlen == -1 &&
rel_tuple_desc_->attrs[index].attbyval == false;
#ifdef RUN_GTEST
expect_hdr = false;
#endif
This forces expect_hdr to false in production, skipping the
stripping of PostgreSQL varlena headers from dictionary
entries. As a result, dictionary-encoded string columns
return garbled data (varlena header bytes are included as
part of the string content).
Replace ADD_DEFINITIONS with target_compile_definitions
scoped to test_main and bench_main targets only, so
RUN_GTEST and RUN_GBENCH are no longer defined when
building pax.so.
28ee7dd to
eb5c16b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADD_DEFINITIONS(-DRUN_GTEST) and ADD_DEFINITIONS(-DRUN_GBENCH) are directory-scoped CMake commands that apply to ALL targets, including the production pax shared library. This caused test- only macros to be defined in production builds.
In pax_porc_adpater.cc, the leaked RUN_GTEST activates:
This forces expect_hdr to false in production, skipping the stripping of PostgreSQL varlena headers from dictionary entries. As a result, dictionary-encoded string columns return garbled data (varlena header bytes are included as part of the string content).
Replace ADD_DEFINITIONS with target_compile_definitions scoped to test_main and bench_main targets only, so RUN_GTEST and RUN_GBENCH are no longer defined when building pax.so.
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions