Skip to content

Commit 5c0cb57

Browse files
committed
must
1 parent 7f84a21 commit 5c0cb57

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,10 @@ private void doTransfer(final PipeStatementInsertionEvent pipeStatementInsertion
369369
@Override
370370
public void close() throws Exception {
371371
if (session != null) {
372-
SESSION_MANAGER.closeSession(session, COORDINATOR::cleanupQueryExecution);
372+
SESSION_MANAGER.closeSession(session, COORDINATOR::cleanupQueryExecution, false);
373373
}
374374
if (treeSession != null) {
375-
SESSION_MANAGER.closeSession(treeSession, COORDINATOR::cleanupQueryExecution);
375+
SESSION_MANAGER.closeSession(treeSession, COORDINATOR::cleanupQueryExecution, false);
376376
}
377377
}
378378

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ public BasicOpenSessionResp login(
255255
}
256256

257257
public boolean closeSession(IClientSession session, LongConsumer releaseByQueryId) {
258+
return closeSession(session, releaseByQueryId, true);
259+
}
260+
261+
public boolean closeSession(
262+
IClientSession session, LongConsumer releaseByQueryId, boolean mustCurrent) {
258263
releaseSessionResource(session, releaseByQueryId);
259264
MetricService.getInstance()
260265
.remove(
@@ -264,11 +269,11 @@ public boolean closeSession(IClientSession session, LongConsumer releaseByQueryI
264269
String.valueOf(session.getId()));
265270
// TODO we only need to do so when query is killed by time out close the socket.
266271
IClientSession session1 = currSession.get();
267-
if (session1 != null && session != session1) {
272+
if (mustCurrent && session1 != null && session != session1) {
268273
LOGGER.info(
269274
String.format(
270275
"The client-%s is trying to close another session %s, pls check if it's a bug",
271-
session, session1));
276+
session1, session));
272277
return false;
273278
} else {
274279
LOGGER.info(String.format("Session-%s is closing", session));

0 commit comments

Comments
 (0)