shizy818 commented on code in PR #14616:
URL: https://github.com/apache/iotdb/pull/14616#discussion_r1909644299
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java:
##########
@@ -649,6 +650,40 @@ public void releaseResourceWhenAllDriversAreClosed() {
releaseResource();
}
+ /**
+ * It checks all referenced TVList by the query: 1. If current is not the
owner, just remove
+ * itself from query context list 2. If current query is the owner and no
other query use it now,
+ * release the TVList 3. If current query is the owner and other queries
still use it, set the
+ * next query as owner
+ */
+ private void releaseTVListOwnedByQuery() {
+ for (TVList tvList : tvListSet) {
+ tvList.lockQueryList();
+ List<QueryContext> queryContextList = tvList.getQueryContextList();
+ try {
+ queryContextList.remove(this);
+ if (tvList.getOwnerQuery() == this) {
+ if (queryContextList.isEmpty()) {
+ LOGGER.debug(
+ "TVList {} is released by the query, FragmentInstance Id is
{}",
+ tvList,
+ this.getId());
+ tvList.clear();
+
memoryReservationManager.releaseMemoryCumulatively(tvList.calculateRamSize());
Review Comment:
Should clear tvlist after releaseMemoryCumulatively. By the way, if there
any test cases for memory control now?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]