This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch force_ci/object_type in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit d0ad830cc5c34aabdbe65cbbb3b80f0f2754455d Author: Caideyipi <[email protected]> AuthorDate: Tue Dec 16 17:17:04 2025 +0800 Fixed the warn log of internal/MQTT session's close session method (#16909) * remove-warn * must (cherry picked from commit 79e10af5fd18c9f69505ad1c35076a1959eea593) --- .../iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java | 4 ++-- .../apache/iotdb/db/protocol/session/InternalClientSession.java | 4 ++-- .../org/apache/iotdb/db/protocol/session/MqttClientSession.java | 3 +-- .../org/apache/iotdb/db/protocol/session/SessionManager.java | 9 +++++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java index 225616e88fa..7c5c4ec9284 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java @@ -369,10 +369,10 @@ public class WriteBackSink implements PipeConnector { @Override public void close() throws Exception { if (session != null) { - SESSION_MANAGER.closeSession(session, COORDINATOR::cleanupQueryExecution); + SESSION_MANAGER.closeSession(session, COORDINATOR::cleanupQueryExecution, false); } if (treeSession != null) { - SESSION_MANAGER.closeSession(treeSession, COORDINATOR::cleanupQueryExecution); + SESSION_MANAGER.closeSession(treeSession, COORDINATOR::cleanupQueryExecution, false); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/InternalClientSession.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/InternalClientSession.java index ed87d0b0ee3..975cbb09437 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/InternalClientSession.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/InternalClientSession.java @@ -21,6 +21,7 @@ package org.apache.iotdb.db.protocol.session; import org.apache.iotdb.service.rpc.thrift.TSConnectionType; +import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -109,7 +110,6 @@ public class InternalClientSession extends IClientSession { @Override public Set<String> getPreparedStatementNames() { - throw new UnsupportedOperationException( - "InternalClientSession should never call PREPARE statement methods."); + return Collections.emptySet(); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/MqttClientSession.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/MqttClientSession.java index c0b68e885a1..41fc6447c23 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/MqttClientSession.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/MqttClientSession.java @@ -97,7 +97,6 @@ public class MqttClientSession extends IClientSession { @Override public Set<String> getPreparedStatementNames() { - throw new UnsupportedOperationException( - "MQTT client session does not support PREPARE statement."); + return Collections.emptySet(); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java index db6955f6dc7..ee00655211f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java @@ -255,6 +255,11 @@ public class SessionManager implements SessionManagerMBean { } public boolean closeSession(IClientSession session, LongConsumer releaseByQueryId) { + return closeSession(session, releaseByQueryId, true); + } + + public boolean closeSession( + IClientSession session, LongConsumer releaseByQueryId, boolean mustCurrent) { releaseSessionResource(session, releaseByQueryId); MetricService.getInstance() .remove( @@ -264,11 +269,11 @@ public class SessionManager implements SessionManagerMBean { String.valueOf(session.getId())); // TODO we only need to do so when query is killed by time out close the socket. IClientSession session1 = currSession.get(); - if (session1 != null && session != session1) { + if (mustCurrent && session1 != null && session != session1) { LOGGER.info( String.format( "The client-%s is trying to close another session %s, pls check if it's a bug", - session, session1)); + session1, session)); return false; } else { LOGGER.info(String.format("Session-%s is closing", session));
