This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 3d436b93802 [IOTDB-6342] Clear
FragmentInstanceManager.dataNodeQueryContextMap while encountering
MemoryNotEnough Exception (#12762)
3d436b93802 is described below
commit 3d436b93802e33a3f3467572d98673f0506ddefa
Author: Jackie Tien <[email protected]>
AuthorDate: Wed Jun 19 14:56:28 2024 +0800
[IOTDB-6342] Clear FragmentInstanceManager.dataNodeQueryContextMap while
encountering MemoryNotEnough Exception (#12762)
---
.../execution/fragment/FragmentInstanceContext.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
index 3748372c4f6..a109fe84963 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
@@ -265,6 +265,14 @@ public class FragmentInstanceContext extends QueryContext {
// 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;
}
}
@@ -596,9 +604,7 @@ public class FragmentInstanceContext extends QueryContext {
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();
@@ -659,7 +665,7 @@ public class FragmentInstanceContext extends QueryContext {
.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;