Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public AutoCloseConnectContext(ConnectContext connectContext) {

@Override
public void close() {
ConnectContext.remove();
connectContext.cleanup();
if (previousContext != null) {
previousContext.setThreadLocalInfo();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public synchronized void run() {
} finally {
if (Config.isCloudMode()) {
LOG.debug("remove context from job");
ConnectContext.remove();
ConnectContext.get().cleanup();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ public TPipelineFragmentParams plan(NereidsStreamLoadPlanner planner, TUniqueId
return planParams;
} finally {
if (needCleanCtx) {
ConnectContext.remove();
ConnectContext.get().cleanup();
}
table.readUnlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void call() {
@Override
public void close() {
connectContext.clear();
ConnectContext.remove();
connectContext.cleanup();
if (previousContext != null) {
previousContext.setThreadLocalInfo();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ public static ConnectContext get() {
return MoreFieldsThread.getConnectContext();
}

// This method is used to remove ConnectContext from current thread, but do not clean up resource used.
// if you finish the whole job, should call cleanup method directly. Call this remove method
// only in the tmp state during job.
public static void remove() {
MoreFieldsThread.removeConnectContext();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ public TMasterOpResult forward(TMasterOpRequest params) throws TException {
} else {
context.getState().setOk();
}
ConnectContext.remove();
context.cleanup();
clearCallback.run();
return result;
}
Expand Down Expand Up @@ -3255,7 +3255,7 @@ private TRestoreSnapshotResult restoreSnapshotImpl(TRestoreSnapshotRequest reque
status.setStatusCode(TStatusCode.INTERNAL_ERROR);
status.addToErrorMsgs(Strings.nullToEmpty(e.getMessage()) + ", command: " + restoreCommand);
} finally {
ConnectContext.remove();
ConnectContext.get().cleanup();
}

return result;
Expand Down Expand Up @@ -4447,7 +4447,7 @@ public TFetchLoadJobResult fetchLoadJob(TFetchLoadJobRequest request) {

return result;
} finally {
ConnectContext.remove();
ctx.cleanup();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,6 @@ public void close() throws Exception {
returnResultFromRemoteExecutor.clear();
executor.finalizeQuery();
ctx.clear();
ConnectContext.remove();
ctx.cleanup();
}
}