Skip to content

Refactor/cpp client sdk#17767

Closed
hongzhi-gao wants to merge 31 commits into
apache:masterfrom
hongzhi-gao:refactor/cpp-client-sdk
Closed

Refactor/cpp client sdk#17767
hongzhi-gao wants to merge 31 commits into
apache:masterfrom
hongzhi-gao:refactor/cpp-client-sdk

Conversation

@hongzhi-gao
Copy link
Copy Markdown
Contributor

@hongzhi-gao hongzhi-gao commented May 26, 2026

Summary

Refactor the C++ Session client: a single CMake entry point, CI release packaging, and a smaller SDK surface for integrators.


1. User-friendly release layout

Release zips are intentionally minimal. Each package contains only what application code needs at link/run time:

  • Headers — public IoTDB Session API under include/ (e.g. Session.h, SessionBuilder.h, SessionC.h, Common.h, …)
  • One shared librarylibiotdb_session.so / libiotdb_session.dylib / iotdb_session.dll (plus the Windows import .lib where applicable)

Not shipped in the zip (and not required on the consumer side):

  • Apache Thrift headers, libraries, or generated IDL artifacts
  • Boost headers or libraries

Example artifact: client-cpp-<version>-<classifier>.zipclient-cpp-<version>-<classifier>/{include,lib}.


2. Ops-friendly CI: prebuilt packages and source-build checks

Release packaging (client-cpp-package.yml)

New workflow builds one zip per supported platform/toolchain (manual dispatch, release:published, v* tags, and rc/** when C++ paths change):

Target Zip classifier Notes
Windows x64 + VS 2017 windows-x86_64-vs2017 Default x64 (-A x64 / PE verification in CI)
Windows x64 + VS 2019 windows-x86_64-vs2019
Windows x64 + VS 2022 windows-x86_64-vs2022
Windows x64 + VS 2026 windows-x86_64-vs2026
Linux x86_64, glibc ≥ 2.17 linux-x86_64-glibc217 Built in manylinux2014; objdump asserts max GLIBC_* ≤ 2.17
Linux aarch64, glibc ≥ 2.17 linux-aarch64-glibc217 Same manylinux + symbol check on arm64
macOS x86_64 mac-x86_64
macOS arm64 mac-aarch64

Deployment guidance (common enterprise Linux):

  • Kylin V10 (Phytium / aarch64) with typical glibc 2.28 / 2.31 → use linux-aarch64-glibc217 (built against glibc 2.17; forward-compatible on newer glibc).
  • Kylin V10 (x86_64) with typical glibc 2.28 / 2.31 → use linux-x86_64-glibc217 (same rationale).

Not covered by CI packages today (build from source if needed):

  • 32-bit Windows/Linux
  • Kylin V4 and other very old baselines — often workable if target glibc ≥ 2.17 (same class of host as glibc217 builds); not validated in the release matrix
  • Visual Studio 2015 — not in the packaging matrix (VS 2017–2026 only)

Source-build CI (client-cpp-source-build.yml)

Complementary workflow on master / rc/* (and matching PR paths) verifies that from a clean checkout the client can fetch dependencies and build on:

  • Linux (Ubuntu runner)
  • macOS
  • Windows (VS 2022 and VS 2026)

This gives fast feedback that the CMake/third-party bootstrap still works; it does not replace the full release packaging matrix above.


3. Developer-friendly: one CMake entry point

All client logic is driven from a single iotdb-client/client-cpp/CMakeLists.txt:

  • Resolves/builds third-party deps via cmake/ modules (FetchBoost, FetchBuildTools, FetchThrift, GenerateThriftSources, optional FetchOpenSSL)
  • Generates Thrift sources from iotdb-protocol IDL
  • Builds iotdb_session from src/session/ (public API) and src/rpc/ (internal Thrift layer)
  • Installs only public headers from src/include/
  • Optional ITs under test/ (BUILD_TESTING)

Maven (pom.xml) is a thin wrapper: cmake configure → build/install → ctest → assembly zip. You can also build standalone:

cmake -S iotdb-client/client-cpp -B build && cmake --build build --target install

Other developer-facing changes:

  • C Session examples merged into example/client-cpp-example (removed standalone example/client-c-example)
  • Updated README.md with layout, classifiers, and local build examples

…arty cache

Move C++ client dependency resolution and compilation into one top-level
CMakeLists with Fetch* modules, cache tarballs under third-party/<os>/ for
offline copy-the-repo workflows, and slim the Maven POM to a CMake wrapper.
Skip server CI when only client-cpp changes; gate multi-language-client jobs
by language via paths-filter.
Install Homebrew bison on macOS package/IT runners so Thrift 0.21.0 builds
(%code requires Bison 2.4+). Add client-cpp-source-build workflow that uses a
minimal toolchain and online CMake fetch to verify zero-to-build compilation.
Align Linux/macOS/Windows toolchain setup with client-cpp-package so
Spotless clang-format check during mvn package succeeds.
Source-build workflow focuses on minimal-toolchain CMake fetch; pass
-Dspotless.skip=true instead of installing clang-format on runners.
Reorganize sources into include/session/rpc with PIMPL so public headers no longer pull in Thrift or Boost. Embed Thrift in iotdb_session on all platforms; on Windows build a /MD shared library with import lib. Update examples, CI verification, and documentation for the slimmer SDK layout.
Fixes Linux CI build where convertToTimestamp/int32ToDate declarations require std::tm from <ctime> (C++11).
Pass CMAKE_POLICY_VERSION_MINIMUM=3.5 when configuring Thrift 0.21 on CMake 4.x (VS2026 CI). Include <cstring> in Session.cpp for memcpy/strlen/strstr on strict Linux builds.
Drop --whole-archive on Linux to avoid libgcc morestack duplicate symbols; build Thrift with -fno-split-stack. Bump default Boost to 1.84.0 for modern Clang on macOS CI.
Linux: keep --whole-archive for Thrift in libiotdb_session.so but add --allow-multiple-definition to avoid libgcc morestack duplicate symbols. macOS: default BOOST_VERSION to 1.84.0 for modern Clang enum checks (other platforms stay on 1.60.0).
Add per-classifier SDK packages (glibc 2.17 on CentOS 7, Windows VS2015-2026), workflow_dispatch variant filter, and documentation for choosing the right zip.
- paths-ignore C++ workflows/scripts on Java IT jobs; narrow C++ path filters (no root pom.xml)

- aarch64 package on Ubuntu 20.04 container (linux-aarch64-glibc231)

- CentOS7 script: vault repos, Adoptium API JDK, devtoolset deps

- VS2015/2017: pin boost-msvc-14.2/14.1 versions instead of missing boost-msvc-14.0
- glibc217/aarch64: checkout on host, build inside docker (fixes CentOS7 + Node 24)

- aarch64: install Kitware CMake 3.28 (ARCHIVE_EXTRACT needs 3.18+)

- Remove VS2015 package matrix and related docs
- Zip: client-cpp-<version>-<classifier>.zip (remove redundant -cpp- segment)

- Root folder client-cpp-<version>-<classifier>/ with include/ and lib/ inside

- Update examples (strip one dir on unpack), distribution assembly, CI artifact paths

- CentOS7 SCLo vault mirror fix; chown workspace after docker builds
centos-sclo-sclo baseurl with releasever=7 404s on vault; rewrite SCLo repo files and refresh yum cache before devtoolset-8 install.
Replace docker run on ubuntu-22.04 with job-level container quay.io/pypa/manylinux2014_x86_64 and checkout@v4, matching PyPA manylinux CI style.
Job container cannot run Node-based actions on glibc 2.17. Run checkout/cache on ubuntu-latest and build inside manylinux2014 via docker run; use preinstalled devtoolset-10 in the image.
Replace ldd | head -1 with sed -n 1p and find | head -1 with find -quit so glibc checks do not fail after a successful build.
VS2017 generator defaults to Win32; pass -DCMAKE_GENERATOR_PLATFORM=x64 on Windows via Maven profile. Add CI PE check that iotdb_session.dll is x64.
Use manylinux2014_aarch64 and the shared packaging script instead of Ubuntu 20.04 glibc231. Extend the script for aarch64 CMake/JDK arch and classifier auto-detection. Update docs and remove the obsolete ubuntu20-arm script.
Guard checkTemplateExists against a null dataset, document DataIterator lifetime, correct README Maven vs CMake option names, drop unused IotdbResolveTarball.cmake, and skip server CI when only multi-language-client workflow changes.
Rename the Linux packaging helper to a manylinux-specific script, drop unused CentOS7 fallback branches, and keep only build plus GLIBC<=2.17 verification steps. Also add concise C++ workflow comments and unify client-cpp CMake minimum version to 3.15.
Rename public Date type from IoTdbDate to IoTDBDate across headers, RPC/session code, and ITs. Move tests from src/test to a top-level test directory and update CMake, Maven, and README paths accordingly.
Move tree_example.c and table_example.c into client-cpp-example, build them from the shared CMake entry, and update EN/ZH docs. Remove the standalone client-c-example module and drop it from the with-cpp profile.
@hongzhi-gao hongzhi-gao force-pushed the refactor/cpp-client-sdk branch from 34dfe07 to 3501aac Compare May 27, 2026 10:54
…X11 ABI

Publish linux-*-glibc224 zips (cxx11 ABI, glibc >= 2.24) alongside existing glibc217 legacy ABI packages. Harden glibc217 script with explicit ABI=0 and link tests.
Resolve gcc from PATH in manylinux containers; use -Diotdb.extra.cxx.flags so ABI applies to iotdb_session and Thrift. Document Linux zip linking in README.
…8 packages

Use manylinux image default gcc/g++ without GLIBCXX macros. glibc228 builds on manylinux_2_28 (glibc max 2.28). Remove IOTDB_EXTRA_CXX_FLAGS wiring.
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.

1 participant