Skip to content

Commit 85b7038

Browse files
authored
[To dev/1.3] refactor client-cpp (#17803)
* refactor(client-cpp): port SDK refactor to dev/1.3 without table model Reorganize the C++ client into include/session/rpc with CMake-driven build, embedded Thrift, Windows DLL packaging, SessionC API, and CI release workflows. Scope excludes 2.x table-model APIs and Thrift fields. * fix(client-cpp): align cmake plugin and clang-format for CI Replace pluginManagement cmake-maven-plugin with io.github 4.2.3-b1 so with-cpp Maven builds resolve the plugin. Pin clang.format.version to 17.0.6 and apply Spotless formatting to C++ sources. * fix(ci): pin clang-format 17 in multi-language-client cpp job ubuntu-latest ships clang-format 18.x which breaks Spotless when clang.format.version is 17.0.6. Install LLVM 17 clang-format on Linux, macOS, and Windows like refactor/cpp-client-sdk. * fix(build): bump Maven wrapper to 3.9.12 for cmake-maven-plugin cmake-maven-plugin 4.2.3-b1 requires Maven 3.9.9+. The wrapper was on 3.9.6, causing with-cpp CI to fail even when using ./mvnw. * fix(client-cpp): include vector in AbstractSessionBuilder.h GCC on Linux CI fails when Session.h includes AbstractSessionBuilder.h before vector; add missing #include <vector> for nodeUrls member. * fix(client-cpp): fix query result parsing and IT on IoTDB 1.3 Apply server columnNameIndexMap for TsBlock reads, align Time column handling with the Java client, and read text types by physical column type. Defer C API session open, disable auto-fetch in tests, and fall back when SHOW AVAILABLE URLS is unsupported. * fix(client-cpp): address PR review items for public API and Catch2 - Revert unrelated .gitignore changes (.run, .claude, relational-grammar) - Remove using namespace std from public headers Session.h and Common.h - Download Catch2 at build time via Maven/CMake instead of vendoring catch.hpp * style(client-cpp): apply clang-format to Session.h * fix(client-cpp): download Catch2 before CMake compile phase Run wget in generate-resources (not generate-test-resources, which runs after compile). CMake also downloads catch.hpp when the header is still missing. * fix(client-cpp): qualify std types for MSVC after removing using namespace std - SessionConnection.h/cpp: std::string, std::vector, std::exception, std::shared_ptr - IoTDBRpcDataSet.cpp: std::exception in catch handlers - Session.h: (std::max) to avoid Windows max macro conflict * fix(client-cpp): use sbin start/stop scripts on Windows Align Windows profile paths with the 1.3 distribution layout (scripts under sbin/, not windows/). * refactor(client-cpp): remove table-model docs and dead code from dev/1.3 port Align example READMEs with the tree-only scope, drop unused table-model API surface, and remove IDeviceID redirect helpers that have no callers. * fix(ci): auto-detect Visual Studio generator for cpp on Windows windows-latest now ships VS 2026 while pom.xml defaults to VS 2022. Use vswhere in the multi-language-client workflow and pass -Dcmake.generator so CMake matches the installed toolchain. * fix(ci): align cpp Windows matrix with refactor/cpp-client-sdk workflow Replace windows-latest and broken vswhere detection with explicit windows-2022 and windows-2025-vs2026 runners; pass Visual Studio 18 2026 generator only on the VS 2026 image. Also match ubuntu/mac matrix and add Spotless check from the refactor branch. * Sync C++ client packaging updates to 1.3 * Fix VS2017 C++ package Boost setup * Fix Windows C++ client CI dependencies * Fix C++ client workflow verification
1 parent 56a0fcc commit 85b7038

101 files changed

Lines changed: 17409 additions & 10385 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env bash
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with this
4+
# work for additional information regarding copyright ownership. The ASF
5+
# licenses this file to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance with the
7+
# License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Build client-cpp in manylinux_2_28 and verify max required GLIBC symbol <= 2.28.
18+
set -euxo pipefail
19+
20+
MACHINE=$(uname -m)
21+
case "${MACHINE}" in
22+
x86_64)
23+
CMAKE_PKG_ARCH=linux-x86_64
24+
JDK_API_ARCH=linux/x64
25+
DEFAULT_CLASSIFIER=linux-x86_64-glibc2.28
26+
;;
27+
aarch64)
28+
CMAKE_PKG_ARCH=linux-aarch64
29+
JDK_API_ARCH=linux/aarch64
30+
DEFAULT_CLASSIFIER=linux-aarch64-glibc2.28
31+
;;
32+
*)
33+
echo "Unsupported architecture: ${MACHINE}" >&2
34+
exit 1
35+
;;
36+
esac
37+
38+
PACKAGE_CLASSIFIER="${PACKAGE_CLASSIFIER:-${DEFAULT_CLASSIFIER}}"
39+
40+
CMAKE_VERSION=3.28.4
41+
CMAKE_DIR="/opt/cmake-${CMAKE_VERSION}"
42+
if [[ ! -x "${CMAKE_DIR}/bin/cmake" ]]; then
43+
curl -fsSL -o /tmp/cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-${CMAKE_PKG_ARCH}.tar.gz"
44+
rm -rf "${CMAKE_DIR}"
45+
mkdir -p /opt
46+
tar xf /tmp/cmake.tar.gz -C /opt
47+
mv "/opt/cmake-${CMAKE_VERSION}-${CMAKE_PKG_ARCH}" "${CMAKE_DIR}"
48+
fi
49+
50+
JAVA_HOME=/opt/jdk-17
51+
if [[ ! -x "${JAVA_HOME}/bin/java" ]]; then
52+
curl -fsSL -o /tmp/jdk17.tar.gz "https://api.adoptium.net/v3/binary/latest/17/ga/${JDK_API_ARCH}/jdk/hotspot/normal/eclipse?project=jdk"
53+
rm -rf /opt/jdk-17*
54+
mkdir -p /opt
55+
tar xf /tmp/jdk17.tar.gz -C /opt
56+
JAVA_HOME=$(find /opt -maxdepth 1 -type d -name 'jdk-17*' -print -quit)
57+
ln -sfn "${JAVA_HOME}" /opt/jdk-17
58+
JAVA_HOME=/opt/jdk-17
59+
fi
60+
61+
export PATH="${CMAKE_DIR}/bin:${JAVA_HOME}/bin:${PATH}"
62+
export JAVA_HOME
63+
64+
gcc --version
65+
c++ --version
66+
gcc_major=$(gcc -dumpversion | cut -d. -f1)
67+
if (( gcc_major < 14 )); then
68+
echo "ERROR: GCC >= 14 is required; got $(gcc -dumpversion)"
69+
exit 1
70+
fi
71+
cmake --version
72+
java -version
73+
74+
cd "${GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}"
75+
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
76+
-Dspotless.skip=true \
77+
-Dclient.cpp.package.classifier="${PACKAGE_CLASSIFIER}"
78+
79+
SO="iotdb-client/client-cpp/target/install/lib/libiotdb_session.so"
80+
test -f "${SO}"
81+
82+
echo "=== Build host glibc ==="
83+
ldd --version 2>&1 | sed -n '1p'
84+
85+
echo "=== Highest GLIBC_* symbols in libiotdb_session.so ==="
86+
objdump -T "${SO}" | grep GLIBC_ | sed "s/.*GLIBC_/GLIBC_/" | sort -Vu | tail -10
87+
88+
max_glibc=$(objdump -T "${SO}" | grep -oE "GLIBC_[0-9.]+" | sed "s/GLIBC_//" | sort -t. -k1,1n -k2,2n -k3,3n | tail -1)
89+
echo "max_glibc=${max_glibc}"
90+
91+
if [[ -z "${max_glibc}" ]]; then
92+
echo "ERROR: could not determine max GLIBC version from ${SO}"
93+
exit 1
94+
fi
95+
96+
if awk -v max="${max_glibc}" "BEGIN { exit !(max > 2.28) }"; then
97+
echo "ERROR: libiotdb_session.so requires glibc > 2.28 (max=${max_glibc})"
98+
exit 1
99+
fi
100+
101+
echo "glibc compatibility check passed (max=${max_glibc} <= 2.28)"

0 commit comments

Comments
 (0)