Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions .github/workflows/client-cpp-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,32 @@ jobs:
steps:
- uses: actions/checkout@v5
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/rc/')
- uses: dorny/paths-filter@v3
with:
fetch-depth: 0
- name: Detect C++ package changes
id: filter
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/rc/')
with:
filters: |
cpp:
- 'iotdb-client/client-cpp/**'
- 'iotdb-client/pom.xml'
- 'iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift'
- 'iotdb-protocol/thrift-commons/src/main/thrift/common.thrift'
- '.github/workflows/client-cpp-package.yml'
- '.github/scripts/package-client-cpp-*.sh'
shell: bash
run: |
set -euo pipefail

BASE="${{ github.event.before }}"
HEAD="${{ github.sha }}"
if [[ "$BASE" =~ ^0+$ ]]; then
BASE="$(git hash-object -t tree /dev/null)"
fi

cpp=false
while IFS= read -r file; do
case "$file" in
iotdb-client/client-cpp/*|iotdb-client/pom.xml|iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift|iotdb-protocol/thrift-commons/src/main/thrift/common.thrift|.github/workflows/client-cpp-package.yml|.github/scripts/package-client-cpp-*.sh)
cpp=true
break
;;
esac
done < <(git diff --name-only "$BASE" "$HEAD")
Comment thread
HTHou marked this conversation as resolved.

echo "cpp=${cpp}" >> "$GITHUB_OUTPUT"
- id: result
shell: bash
run: |
Expand Down
79 changes: 49 additions & 30 deletions .github/workflows/multi-language-client.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Shared client CI: run only affected language jobs via paths-filter.
# Shared client CI: run only affected language jobs via changed path detection.
name: Multi-Language Client
on:
push:
Expand Down Expand Up @@ -50,36 +50,55 @@ jobs:
go: ${{ steps.filter.outputs.go }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
cpp:
- 'iotdb-client/pom.xml'
- 'iotdb-client/client-cpp/**'
- 'iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift'
- 'iotdb-protocol/thrift-commons/src/main/thrift/common.thrift'
- '.github/workflows/multi-language-client.yml'
- '.github/workflows/client-cpp-package.yml'
- '.github/scripts/package-client-cpp-*.sh'
python:
- 'pom.xml'
- 'iotdb-client/pom.xml'
- 'iotdb-client/client-py/**'
- 'docker/src/main/Dockerfile-1c1d'
- '.github/workflows/multi-language-client.yml'
go:
- 'pom.xml'
- 'iotdb-core/**'
- 'iotdb-api/**'
- 'iotdb-protocol/**'
- 'distribution/**'
- 'integration-test/**'
- 'iotdb-client/session/**'
- 'iotdb-client/jdbc/**'
- 'iotdb-client/cli/**'
- 'iotdb-client/service-rpc/**'
- '.github/workflows/multi-language-client.yml'
fetch-depth: 0
- name: Detect changed client paths
id: filter
shell: bash
run: |
set -euo pipefail

if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.sha }}"
elif [[ "${{ github.event_name }}" == "push" ]]; then
BASE="${{ github.event.before }}"
HEAD="${{ github.sha }}"
else
echo "cpp=true" >> "$GITHUB_OUTPUT"
echo "python=true" >> "$GITHUB_OUTPUT"
echo "go=true" >> "$GITHUB_OUTPUT"
exit 0
fi

if [[ "$BASE" =~ ^0+$ ]]; then
BASE="$(git hash-object -t tree /dev/null)"
fi

cpp=false
python=false
go=false
while IFS= read -r file; do
case "$file" in
iotdb-client/pom.xml|iotdb-client/client-cpp/*|iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift|iotdb-protocol/thrift-commons/src/main/thrift/common.thrift|.github/workflows/multi-language-client.yml|.github/workflows/client-cpp-package.yml|.github/scripts/package-client-cpp-*.sh)
cpp=true
;;
esac
case "$file" in
pom.xml|iotdb-client/pom.xml|iotdb-client/client-py/*|docker/src/main/Dockerfile-1c1d|.github/workflows/multi-language-client.yml)
python=true
;;
esac
case "$file" in
pom.xml|iotdb-core/*|iotdb-api/*|iotdb-protocol/*|distribution/*|integration-test/*|iotdb-client/session/*|iotdb-client/jdbc/*|iotdb-client/cli/*|iotdb-client/service-rpc/*|.github/workflows/multi-language-client.yml)
go=true
;;
esac
done < <(git diff --name-only "$BASE" "$HEAD")
Comment thread
HTHou marked this conversation as resolved.

echo "cpp=${cpp}" >> "$GITHUB_OUTPUT"
echo "python=${python}" >> "$GITHUB_OUTPUT"
echo "go=${go}" >> "$GITHUB_OUTPUT"

cpp:
needs: changes
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-binary
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ org.eclipse.jetty.ee10:jetty-ee10-servlet:12.0.36
org.eclipse.jetty:jetty-util:12.0.36
com.google.code.findbugs:jsr305:3.0.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

libthrift:0.23.0 now brings org.apache.commons:commons-lang3:3.18.0 as a runtime transitive dependency (iotdb-server -> libthrift -> commons-lang3), and the server/confignode assemblies include module dependencies under lib. Since the binary LICENSE only updates the libthrift entry and does not list commons-lang3, the released binary would contain an Apache-2.0 dependency that is not disclosed here. Please add org.apache.commons:commons-lang3:3.18.0 to this section, or otherwise exclude it and verify Thrift does not require it at runtime.

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.

Addressed in 1eba3b7d4e by excluding org.apache.commons:commons-lang3 from the managed libthrift dependency. I also verified that iotdb-core/datanode and iotdb-core/confignode no longer resolve commons-lang3 via mvn dependency:tree -Dincludes=org.apache.commons:commons-lang3, and confirmed IoTDB does not use org.apache.thrift.partial APIs.

com.librato.metrics:librato-java:2.1.0
org.apache.thrift:libthrift:0.14.1
org.apache.thrift:libthrift:0.23.0
io.dropwizard.metrics:metrics-core:4.2.19
io.dropwizard.metrics:metrics-jvm:3.2.2
com.librato.metrics:metrics-librato:5.1.0
Expand Down
2 changes: 1 addition & 1 deletion iotdb-client/jdbc/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<bundle>mvn:org.apache.iotdb/service-rpc/${project.version}</bundle>
<bundle>mvn:org.apache.iotdb/iotdb-thrift/${project.version}</bundle>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This placeholder can be published literally in the JDBC Karaf features artifact. The resources step filters src/main/feature into target/classes/feature, but iotdb-client/jdbc/pom.xml still attaches src/main/feature/feature.xml directly as the features classifier. After this change, the attached *-features.xml would contain mvn:org.apache.thrift/libthrift/${thrift.version}, which Karaf cannot resolve. Please attach the filtered file instead, or keep a concrete 0.23.0 version here.

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.

Addressed in 1eba3b7d4e by keeping the source feature descriptor publishable directly: the Karaf feature now uses the concrete mvn:org.apache.thrift/libthrift/0.23.0 coordinate. Verified with mvn process-resources -pl iotdb-client/jdbc -DskipTests; both the source and filtered feature descriptors contain 0.23.0 rather than ${thrift.version}.

<bundle>mvn:org.apache.iotdb/hadoop-tsfile/${project.version}</bundle>
<bundle>mvn:org.apache.thrift/libthrift/0.14.1</bundle>
<bundle>mvn:org.apache.thrift/libthrift/0.23.0</bundle>
<bundle>mvn:org.xerial.snappy/snappy-java/1.1.8.4</bundle>
<bundle>mvn:commons-io/commons-io/2.5</bundle>
<bundle>wrap:mvn:org.apache.hadoop/hadoop-core/1.2.1</bundle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import java.nio.channels.SocketChannel;

/**
* In Thrift 0.14.1, TNonblockingSocket's constructor throws a never-happened exception. So, we
* screen the exception https://issues.apache.org/jira/browse/THRIFT-5412
* TNonblockingSocket's constructor declares a TTransportException for compatibility, but this code
* path is not expected to throw one. See https://issues.apache.org/jira/browse/THRIFT-5412.
*/
Comment on lines 29 to 32

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.

Fixed in 1eba3b7d4e by rewording the Javadoc to explain that the constructor declares TTransportException for compatibility, but this code path is not expected to throw it.

public class TNonblockingTransportWrapper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.apache.thrift.transport.TTransportException;

/**
* In Thrift 0.14.1, TSocket's constructor throws a never-happened exception. So, we screen the
* exception https://issues.apache.org/jira/browse/THRIFT-5412
* TSocket's constructor declares a TTransportException for compatibility, but this code path is not
* expected to throw one. See https://issues.apache.org/jira/browse/THRIFT-5412.
*/
Comment on lines 26 to 29

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.

Fixed in 1eba3b7d4e by rewording the Javadoc to explain that the constructor declares TTransportException for compatibility, but this code path is not expected to throw it.

public class TSocketWrapper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.iotdb.confignode.service.thrift;

import org.apache.iotdb.commons.service.NoopServerContext;
import org.apache.iotdb.commons.service.metric.MetricService;

import org.apache.thrift.protocol.TProtocol;
Expand All @@ -37,7 +38,7 @@ public ConfigNodeRPCServiceHandler() {
@Override
public ServerContext createContext(TProtocol input, TProtocol output) {
thriftConnectionNumber.incrementAndGet();
return null;
return NoopServerContext.INSTANCE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package org.apache.iotdb.consensus.iot.service;

import org.apache.iotdb.commons.service.NoopServerContext;

import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.server.ServerContext;
import org.apache.thrift.server.TServerEventHandler;
Expand All @@ -37,7 +39,7 @@ public void preServe() {}

@Override
public ServerContext createContext(TProtocol input, TProtocol output) {
return null;
return NoopServerContext.INSTANCE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package org.apache.iotdb.consensus.pipe.service;

import org.apache.iotdb.commons.service.NoopServerContext;

import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.server.ServerContext;
import org.apache.thrift.server.TServerEventHandler;
Expand All @@ -37,7 +39,7 @@ public void preServe() {}

@Override
public ServerContext createContext(TProtocol input, TProtocol output) {
return null;
return NoopServerContext.INSTANCE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.iotdb.db.protocol.thrift.handler;

import org.apache.iotdb.commons.service.NoopServerContext;
import org.apache.iotdb.db.i18n.DataNodeMiscMessages;
import org.apache.iotdb.db.protocol.session.ClientSession;
import org.apache.iotdb.db.protocol.session.SessionManager;
Expand Down Expand Up @@ -63,17 +64,17 @@
getSessionManager().registerSession(new ClientSession(socket));
if (factory != null) {
context = factory.newServerContext(out, socket);
if (!context.whenConnect()) {
if (context != null && !context.whenConnect()) {
return context;
}
}
return context;
return context == null ? NoopServerContext.INSTANCE : context;
}

public void deleteContext(ServerContext context, TProtocol in, TProtocol out) {
getSessionManager().removeCurrSession();

if (context != null && factory != null) {
if (context instanceof JudgableServerContext) {

Check warning on line 77 in iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/BaseServerContextHandler.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this instanceof check and cast with 'instanceof JudgableServerContext judgableservercontext'

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ7TZXAjz18Z6mKbTToy&open=AZ7TZXAjz18Z6mKbTToy&pullRequest=17945
((JudgableServerContext) context).whenDisconnect();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.iotdb.db.protocol.thrift.handler;

import org.apache.iotdb.commons.service.NoopServerContext;
import org.apache.iotdb.commons.service.metric.MetricService;

import org.apache.thrift.protocol.TProtocol;
Expand All @@ -45,7 +46,7 @@ public void preServe() {
@Override
public ServerContext createContext(TProtocol tProtocol, TProtocol tProtocol1) {
thriftConnectionNumber.incrementAndGet();
return null;
return NoopServerContext.INSTANCE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.iotdb.db.queryengine.execution.exchange;

import org.apache.iotdb.commons.service.NoopServerContext;
import org.apache.iotdb.commons.service.metric.MetricService;

import org.apache.thrift.protocol.TProtocol;
Expand All @@ -44,7 +45,7 @@ public void preServe() {
@Override
public ServerContext createContext(TProtocol input, TProtocol output) {
thriftConnectionNumber.incrementAndGet();
return null;
return NoopServerContext.INSTANCE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.iotdb.commons.service;

import org.apache.thrift.server.ServerContext;

/**
* Shared {@link ServerContext} implementation for Thrift handlers that do not need per-connection
* state.
*
* <p>Thrift 0.23 server implementations expect {@code createContext} to return a non-null context,
* even when the event handler only uses connection lifecycle callbacks. This no-op implementation
* keeps those handlers explicit without adding a custom context object for each connection.
*/
public final class NoopServerContext implements ServerContext {

Check warning on line 32 in iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/NoopServerContext.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A Singleton implementation was detected. Make sure the use of the Singleton pattern is required and the implementation is the right one for the context.

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ7TZW76z18Z6mKbTTox&open=AZ7TZW76z18Z6mKbTTox&pullRequest=17945

/** Singleton instance reused by handlers that do not attach state to the connection. */
public static final NoopServerContext INSTANCE = new NoopServerContext();

private NoopServerContext() {}

@Override
public <T> T unwrap(Class<T> iface) {
return iface.isInstance(this) ? iface.cast(this) : null;
}

@Override
public boolean isWrapperFor(Class<?> iface) {
return iface.isInstance(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.exception.runtime.RPCServiceException;
import org.apache.iotdb.commons.service.NoopServerContext;
import org.apache.iotdb.commons.service.ServiceType;
import org.apache.iotdb.commons.service.ThriftService;
import org.apache.iotdb.commons.service.ThriftServiceThread;
Expand All @@ -30,7 +31,9 @@

import org.apache.thrift.server.TServerEventHandler;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class MockInternalRPCService extends ThriftService implements MockInternalRPCServiceMBean {

Expand Down Expand Up @@ -60,6 +63,8 @@ public void initTProcessor() {
@Override
public void initThriftServiceThread() throws IllegalAccessException {
try {
TServerEventHandler serverEventHandler = mock(TServerEventHandler.class);
when(serverEventHandler.createContext(any(), any())).thenReturn(NoopServerContext.INSTANCE);
thriftServiceThread =
new ThriftServiceThread(
processor,
Expand All @@ -69,7 +74,7 @@ public void initThriftServiceThread() throws IllegalAccessException {
getBindPort(),
65535,
60,
mock(TServerEventHandler.class),
serverEventHandler,
false,
DeepCopyRpcTransportFactory.INSTANCE);
} catch (RPCServiceException e) {
Expand Down
Loading
Loading