Caideyipi commented on code in PR #15538:
URL: https://github.com/apache/iotdb/pull/15538#discussion_r3689706850


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java:
##########
@@ -253,19 +253,38 @@ private void fetchDatabaseAndUpdateCache(
     }
   }
 
+  public boolean isNeedLastCache(final String database) {
+    Boolean needLastCache = database2NeedLastCacheCache.get(database);
+    if (Objects.nonNull(needLastCache)) {
+      return needLastCache;
+    }
+    try {
+      fetchDatabaseAndUpdateCache(false);
+    } catch (final TException | ClientManagerException e) {
+      logger.warn(
+          "Failed to get need_last_cache info for database {}, will put cache 
anyway, exception: {}",
+          database,
+          e.getMessage());
+      return true;
+    }
+    needLastCache = database2NeedLastCacheCache.get(database);
+    return Objects.isNull(needLastCache) || needLastCache;
+  }

Review Comment:
   Applied in 8a763b40815: `isNeedLastCache` is now annotated with 
`@TreeModel`, and `checkAndAutoCreateDatabase` with `@TableModel`. The private 
fetch helper serves both entry points, so the model annotations are kept on the 
public model-specific methods. Thanks.



-- 
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]

Reply via email to