Skip to content

fix: avoid shared_ptr::unique for C++20 compatibility - #482

Merged
lxy-9602 merged 1 commit into
apache:mainfrom
wgtmac:codex/fix-cpp20-shared-ptr-unique
Oct 30, 2026
Merged

lxy-9602 merged 1 commit into
apache:mainfrom
wgtmac:codex/fix-cpp20-shared-ptr-unique

Conversation

@wgtmac

@wgtmac wgtmac commented Oct 30, 2026

Copy link
Copy Markdown
Member

Purpose

Linked issue: N/A

Replace std::shared_ptr::unique() with the equivalent use_count() checks in the real-time deduplication and key-offset index code.

unique() is deprecated since C++17 and removed from libc++ in C++20. Although paimon-cpp itself currently builds as C++17, downstream projects can compile against its sources or headers in C++20 or newer. That currently fails because these two call sites use an API that is no longer available. The replacement has identical semantics and keeps the code compatible with C++17 and newer standards.

Tests

  • Ran pre-commit on both changed files; all hooks passed, including clang-format, codespell, and cpplint.
  • Compiled both changed translation units with the parent project's C++23/libc++ flags after removing its temporary _LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE compatibility macro. Both compilations passed.
  • No behavior-specific UT/IT was added because this is a mechanical API replacement with unchanged ownership semantics.

API and Format

No public API, storage format, or protocol changes.

Documentation

No documentation changes are required; this fixes downstream C++20+ compatibility without changing user-facing behavior.

Generative AI tooling

Generated-by: OpenAI Codex 0.162.1

Replace the deprecated and C++20-removed shared_ptr::unique() API with equivalent use_count() checks so paimon-cpp remains usable by consumers building with newer C++ standards.
@wgtmac wgtmac changed the title fix(realtime): avoid shared_ptr::unique for C++20 compatibility fix: avoid shared_ptr::unique for C++20 compatibility Oct 30, 2026

@lxy-9602 lxy-9602 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@wgtmac

wgtmac commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Thanks @lxy-9602 for the quick review! CI failure is due to timeout. Could you please retrigger it or simply merge this?

@SteNicholas SteNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@lxy-9602
lxy-9602 merged commit b270be3 into apache:main Oct 30, 2026
28 of 29 checks passed
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.

3 participants