Skip to content

feat(fs): add OSS file system - #205

Open
mrdrivingduck wants to merge 1 commit into
apache:mainfrom
mrdrivingduck:codex/feat_object_store_oss
Open

feat(fs): add OSS file system#205
mrdrivingduck wants to merge 1 commit into
apache:mainfrom
mrdrivingduck:codex/feat_object_store_oss

Conversation

@mrdrivingduck

Copy link
Copy Markdown
Contributor

Purpose

This PR adds a native, read-only OSS filesystem backed by Alibaba Cloud OSS SDK V2.

Motivation

Static linking and distribution

Some integration scenarios require Paimon-cpp to be linked statically into another library, such as a DuckDB extension. JindoSDK is delivered as a separate dynamic library, which makes this integration and distribution model less flexible.

Shutdown reliability in PostgreSQL processes

While integrating PostgreSQL with DuckDB, we observed an intermittent shutdown hang along the PostgreSQL → DuckDB → duckdb-paimon → paimon-cpp path when JindoSDK was loaded through the Paimon filesystem. The captured shutdown stack was:

PostgreSQL backend process

proc_exit()
  → exit()
    → C++ atexit/static destructor
      → bvar::PassiveStatus::~PassiveStatus()
        → bvar::detail::Sampler::destroy()
          → pthread_mutex_lock()   ← waits indefinitely

The process also had a bvar_sampler thread running. This points to a fork/exit lifecycle issue in JindoSDK's embedded bRPC/bvar dependencies. Since JindoSDK is closed source and brings a relatively large dependency set, it is difficult to investigate or address from Paimon-cpp.

An open-source OSS filesystem

Given that OSS SDK V2 is open source, adding an OSS implementation to Paimon-cpp would provide an open and self-contained option for OSS access. The existing object-store abstraction introduced for S3 keeps this addition small and avoids duplicated filesystem logic.

Benchmark

The benchmark directly reads a 133 MiB Parquet data file belonging to a Paimon table in a real OSS environment. Both filesystems were built in a clean Release build, and each workload was run six times. Values are medians.

Workload OSS Median Jindo Median
Open(path) 10.63 ms (-8.3%) 11.59 ms
Open(known status) 0.73 ms (-94.9%) 14.25 ms
1 MiB range read 47.37 ms (-27.3%) 65.13 ms
Single 8 MiB sequential read 96.83 ms (-20.4%) 121.70 ms

Open(known status) reopens a file with previously obtained metadata. It avoids an extra metadata request through the status propagation introduced in #189. The range and sequential workloads each issue a single read request.

Add read-only Alibaba Cloud OSS access through OSS SDK v2 while reusing
shared object-store semantics and input streams.

Support endpoint and region settings, credentials, session tokens,
path-style addressing, and signature versions.

Register OSS at the top-level build alongside the existing object-store
file systems.

Co-authored-by: GPT-5.6 Terra <codex@users.noreply.github.com>
@mrdrivingduck

Copy link
Copy Markdown
Contributor Author

I identified an OSS SDK v2 issue where a retried request can retain a stale Authorization header after its timestamp is regenerated, causing SignatureDoesNotMatch.

This PR temporarily applies a small build-time patch to overwrite the header on retry. The issue has been reported to the OSS SDK maintainers, and they will address it upstream soon.

@@ -0,0 +1,35 @@
/*
* Copyright 2026-present Alibaba Inc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use ASF license

Comment thread CMakeLists.txt
if(PAIMON_ENABLE_JINDO)
add_definitions(-DPAIMON_ENABLE_JINDO)
endif()
if(PAIMON_ENABLE_OSS)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add oss and s3 options in the docs (docs/source/building.rst and docs/source/build_system.rst)

@zjw1111
zjw1111 requested a review from lucasfang August 14, 2026 08:58
Comment on lines +1450 to +1460
PATCH_COMMAND bash -c
"perl -0pi -e 's/\"-Wall\"\\s+\"-Werror\"\\s+\"-pedantic\"\\s+\"-Wextra\"/\"-Wall\" \"-pedantic\" \"-Wextra\"/g' <SOURCE_DIR>/sdk/CMakeLists.txt"
COMMAND bash -c
"perl -0pi -e 's/#if LIBCURL_VERSION_NUM >= 0x074400/#if 0/g' <SOURCE_DIR>/sdk/src/transport/curl/CurlMultiTransport.cpp"
COMMAND bash -c
"perl -0pi -e 's/#if LIBCURL_VERSION_NUM >= 0x074200/#if 0/g' <SOURCE_DIR>/sdk/src/transport/curl/CurlMultiTransport.cpp"
COMMAND bash -c
"perl -0pi -e 's/request->headers\\.emplace\\(\"Authorization\", credentialHeader\\)\\x3b/request->headers.insert_or_assign(\"Authorization\", credentialHeader)\\x3b/g' <SOURCE_DIR>/sdk/src/signer/SignerV1.cpp"
COMMAND bash -c
"perl -0pi -e 's/request->headers\\.emplace\\(\"Authorization\", ss\\.str\\(\\)\\)\\x3b/request->headers.insert_or_assign(\"Authorization\", ss.str())\\x3b/g' <SOURCE_DIR>/sdk/src/signer/SignerV4.cpp"
${THIRDPARTY_LOG_OPTIONS}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you make the patch as a diff file (like cmake_modules/jieba.diff), and add the diff file in LICENSE file like ↓

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be removed once the fix aliyun/alibabacloud-oss-cpp-sdk-v2@fe7d847 is merged. I plan not to involve the patch in this commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants