Repository navigation
Fetch yyjson at build time instead of vendoring it - #1383
Conversation
|
Hi @tuhaihe ! I reviewed your PR and wanted to share an alternative implementation that eliminates the need for git submodules entirely. This approach uses CMake's Alternative: CMake FetchContentI've implemented this on branch Key change: Replace the git submodule with automatic dependency fetching during CMake configuration. Implementation
if(USE_MANIFEST_API AND NOT USE_PAX_CATALOG)
include(FetchContent)
# Try system package first
find_package(yyjson QUIET)
if(NOT yyjson_FOUND)
message(STATUS "yyjson not found in system, fetching from GitHub...")
FetchContent_Declare(
yyjson
GIT_REPOSITORY https://github.com/ibireme/yyjson.git
GIT_TAG 0.12.0
GIT_SHALLOW TRUE
)
set(SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS ON)
FetchContent_MakeAvailable(yyjson)
set(BUILD_SHARED_LIBS ${SAVED_BUILD_SHARED_LIBS})
else()
message(STATUS "Using system yyjson package")
endif()
endif()
# Update include path to use FetchContent variable
set(pax_target_include ${pax_target_include} ${yyjson_SOURCE_DIR}/src)Remove from Benefits
Important NoteDuring my review, I noticed that yyjson is only used when both
TestingTo verify this works when yyjson IS needed: cd contrib/pax_storage/build
cmake .. -DUSE_MANIFEST_API=ON -DUSE_PAX_CATALOG=OFF
# Should see: "yyjson not found in system, fetching from GitHub..."
makeRecommendationYour PR's organizational improvement is valuable regardless. This FetchContent approach is simply an alternative that:
Both approaches work - this is just offered as food for thought. Happy to discuss! Branch for reference: |
|
Hi @edespino, thanks for your great idea. There are other submodules needed for PAX building, such as tabulate. I prefer to keep the same behavior across yyjson and the other submodules so that users can download all required submodules with |
|
More: I searched and found that |
|
Would like to have more voices from the core PAX developers on this. cc @gfphoenix78 @jiaqizho @gongxun0928 At least, it's not good to place the |
Subject: Release Engineering View – Using EPEL vs. Building from SourceWhen building on Rocky Linux 9, EPEL can be convenient for missing dependencies, but it introduces several trade-offs worth noting: Key Issues
Recommended Approach
Bottom LineEPEL is fine for development convenience, but from a release-engineering and ASF-compliance standpoint, source builds give stronger reproducibility, auditability, and long-term stability. |
One thing I'm curious about is why the selected submodule commit shas were used. It is not important for the relocation work. But it wasn't obvious at all why the yyjson submodule commit sha was used. |
The reason why @gfphoenix78 do you still have any context about this module? |
Thanks @jiaqizho for your reply. I remember our private conversation on this topic. ❤️ Now, from the open-source side, I believe we can move the |
8070548 to
ba4573e
Compare
|
I have repushed this PR with a different approach: instead of relocating the The reason for the change of direction is the 2.2.0 release. What prompted thisDuring the 2.2.0-rc1 IPMC vote, Justin Mclean raised several LICENSE That is accurate, and there is slightly more of it than reported. The
The last group was not in Justin's list. It is worth noting that these are We could declare all five in the root LICENSE. But before doing that it is yyjson is not built by anything we shipThis also answers the question @jiaqizho raised earlier in this thread:
It does not. Searching There is no second consumer, in PAX or anywhere else. Beyond that, even PAX does not compile it in any configuration we build. Checked against an actual release-configuration build on Rocky 9:
So we ship a submodule that no released binary contains. What it costs to keep it
The changeFetching on demand removes the components rather than documenting them, This also matches what we already do elsewhere in the tree: psutil, PyYAML The version is now a release tag rather than a submodule pointer. Ed asked Removed along with the submodule: the One deviation from Ed's draftEd's branch tries a system yyjson through
None of our build images can reach that branch either (yyjson is not in VerificationOn Rocky 9:
A separate finding for the PAX maintainersWhile testing the second configuration I found that it does not build on That is the PostgreSQL 16 rename of Fixing it is more than those two lines — Backpatch2.2.0 is cut from |
4f12640 to
23c2974
Compare
yyjson sits in a top-level dependency/ directory as a git submodule, and
it is the only thing in there. It does not need to be in the source
tree at all:
- Nothing outside contrib/pax_storage/src/cpp/manifest/manifest.c uses
it. Cloudberry core does not depend on yyjson, which answers the
question raised on this PR about why it sat at the top level.
- It is compiled only when USE_MANIFEST_API is ON and USE_PAX_CATALOG
is OFF. Both default the other way and nothing in the tree turns
them on, so no build we ship compiles yyjson: pax.so and
libpaxformat.so contain no yyjson symbols and manifest.c produces no
object file.
Carrying it anyway is not free. dependency/yyjson is 9.3 MB across 804
files, of which 3.0 MB and 201 files are generated doxygen output, and
pom.xml needs 249 RAT exclusions to cope with it, 200 of them for the
docs alone. That doxygen output also bundles jQuery, jQuery UI, jQuery
UI Touch Punch, doxygen-awesome-css and Doxygen's own helper scripts,
none of which the root LICENSE accounts for. Justin Mclean raised the
LICENSE gap during the 2.2.0-rc1 IPMC vote; fetching yyjson on demand
removes the components rather than documenting them.
CMake now fetches the dependency during configuration, as suggested by
Ed Espino on this PR. This follows what gpMgmt/bin/Makefile already
does for psutil, PyYAML and PyGreSQL, which are downloaded at build time
for the same reason. The version is a release tag rather than the
previous submodule pointer, which was 61c03f6 "Try fix github action",
not a release at all.
Ed's draft also tried a system yyjson through find_package first. That
path is left out: it sets neither yyjson_SOURCE_DIR, which the include
path needs, nor a target named yyjson, which pax.cmake links, because an
installed yyjson exports yyjson::yyjson. Since the previous behaviour
was always to build yyjson from source, always fetching keeps the change
behaviour-preserving, and a branch no image can exercise would only rot.
The LICENSE entry, licenses/LICENSE-yyjson.txt and all 249 RAT
exclusions go away with the directory. This is rebased on top of the
boost licence fix, apache#1995 on main and apache#1987 on REL_2_STABLE, which
corrected the entry from dependencies/yyjson to dependency/yyjson; the
whole entry is removed either way, and every hunk now applies cleanly to
REL_2_STABLE as well.
Verified on Rocky 9:
- `mvn clean verify -Drat.consoleOutput=true` against a fresh checkout
of main with this applied gives Unapproved: 0, unknown: 0,
generated: 1, approved: 5650 licenses, BUILD SUCCESS, so dropping the
249 exclusions leaves nothing unaccounted for.
- The default PAX build succeeds with no network access at all, which
is the configuration every release build uses.
- With USE_MANIFEST_API=ON USE_PAX_CATALOG=OFF, CMake fetches yyjson
0.12.0, builds libyyjson.so.0.12.0, puts -I.../_deps/yyjson-src/src
on the compile line that manifest.c uses and libyyjson.so.0.12.0 on
the link line.
- That configuration then fails in
micro_partition_iterator_manifest.cc, which still uses the
pre-PostgreSQL-16 rd_node field. An unpatched tree with the
submodule fails at the same two lines with the same error, so the
breakage predates this change and confirms how long the manifest API
path has gone unbuilt.
Assisted-by: Claude Code
Backpatch-through: REL_2_STABLE
23c2974 to
8028db7
Compare
my-ship-it
left a comment
There was a problem hiding this comment.
LGTM. It appears to only change how yyjson is fetched.
Move yyjson from top-level dependency directory to
contrib/pax_storage/src/cpp/contrib/yyjsonsince it's only used by the PAX storage component. Update all references in CMake build files, .gitmodules, and documentation to reflect the new location. This change improves the project structure by keeping PAX-specific dependencies together and removing the unnecessary top-level dependency directory.The move includes:
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