Skip to content
Merged
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 @@ -265,6 +265,14 @@ private void updateStatsIfDone(FragmentInstanceState newState) {
// were a duplicate notification, which shouldn't happen
executionEndTime.compareAndSet(END_TIME_INITIAL_VALUE, now);
endNanos.compareAndSet(0, System.nanoTime());

// release some query resource in FragmentInstanceContext
// why not release them in releaseResourceWhenAllDriversAreClosed() together?
// because we may have no chane to run the releaseResourceWhenAllDriversAreClosed which is
// called in callback of FragmentInstanceExecution
// FragmentInstanceExecution won't be created if we meet some errors like MemoryNotEnough
releaseDataNodeQueryContext();
sourcePaths = null;
}
}

Expand Down Expand Up @@ -596,9 +604,7 @@ public synchronized void releaseResource() {

dataRegion = null;
globalTimeFilter = null;
sourcePaths = null;
sharedQueryDataSource = null;
releaseDataNodeQueryContext();

// record fragment instance execution time and metadata get time to metrics
long durationTime = System.currentTimeMillis() - executionStartTime.get();
Expand Down Expand Up @@ -659,7 +665,7 @@ public synchronized void releaseResource() {
.updatePageReaderMemoryUsage(getQueryStatistics().pageReaderMaxUsedMemorySize.get());
}

private void releaseDataNodeQueryContext() {
private synchronized void releaseDataNodeQueryContext() {
if (dataNodeQueryContextMap == null) {
// this process is in fetch schema, nothing need to release
return;
Expand Down