This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch PartitionCacheBug
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 6afb2d8ec06def46ca4e9b52f8322fd9eeb99076
Author: JackieTien97 <[email protected]>
AuthorDate: Mon Nov 27 14:42:02 2023 +0800

    init
---
 .../queryengine/plan/analyze/cache/partition/PartitionCache.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
index 308d7ea221b..c8b2a11196f 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
@@ -187,13 +187,15 @@ public class PartitionCache {
    *
    * @param result the result of get database cache
    * @param devicePaths the devices that need to hit
+   *
+   * @return
    */
-  private void fetchStorageGroupAndUpdateCache(
+  private Set<String> fetchStorageGroupAndUpdateCache(
       StorageGroupCacheResult<?> result, List<String> devicePaths)
       throws ClientManagerException, TException {
+    storageGroupCacheLock.writeLock().lock();
     try (ConfigNodeClient client =
         configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) 
{
-      storageGroupCacheLock.writeLock().lock();
       result.reset();
       getStorageGroupMap(result, devicePaths, true);
       if (!result.isSuccess()) {
@@ -204,6 +206,7 @@ public class PartitionCache {
           Set<String> storageGroupNames = 
storageGroupSchemaResp.getDatabaseSchemaMap().keySet();
           // update all database into cache
           updateStorageCache(storageGroupNames);
+          return storageGroupNames;
         }
       }
     } finally {

Reply via email to