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

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


The following commit(s) were added to refs/heads/virtual_partition_2_merge by 
this push:
     new 9c2c80d  fix bugs
9c2c80d is described below

commit 9c2c80d37d60bbdefc37fa66fecb2d44c799ec24
Author: 151250176 <[email protected]>
AuthorDate: Mon Dec 14 10:22:07 2020 +0800

    fix bugs
---
 .../org/apache/iotdb/cluster/query/filter/SlotTsFileFilter.java   | 4 ++--
 .../src/main/java/org/apache/iotdb/db/engine/StorageEngine.java   | 8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/cluster/src/main/java/org/apache/iotdb/cluster/query/filter/SlotTsFileFilter.java
 
b/cluster/src/main/java/org/apache/iotdb/cluster/query/filter/SlotTsFileFilter.java
index 8c0f762..188fa44 100644
--- 
a/cluster/src/main/java/org/apache/iotdb/cluster/query/filter/SlotTsFileFilter.java
+++ 
b/cluster/src/main/java/org/apache/iotdb/cluster/query/filter/SlotTsFileFilter.java
@@ -43,9 +43,9 @@ public class SlotTsFileFilter implements TsFileFilter {
   }
 
   private static boolean fileNotInSlots(TsFileResource res, List<Integer> 
nodeSlots) {
-    // <storageGroupName>/<partitionNum>/<fileName>
+    // <storageGroupName>/<virtualStorageGroupNumber>/<partitionNum>/<fileName>
     String[] pathSegments = FilePathUtils.splitTsFilePath(res);
-    String storageGroupName = pathSegments[pathSegments.length - 3];
+    String storageGroupName = pathSegments[pathSegments.length - 4];
     int partitionNum = Integer.parseInt(pathSegments[pathSegments.length - 2]);
     int slot = SlotPartitionTable.getSlotStrategy()
         .calculateSlotByPartitionNum(storageGroupName, partitionNum,
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java 
b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
index 71290f5..28b929e 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
@@ -594,7 +594,7 @@ public class StorageEngine implements IService {
       boolean isSync)
       throws StorageGroupNotSetException {
     if(!processorMap.containsKey(storageGroupPath)){
-      return;
+      throw new StorageGroupNotSetException(storageGroupPath.getFullPath());
     }
 
     VirtualStorageGroupManager virtualStorageGroupManager = 
processorMap.get(storageGroupPath);
@@ -622,8 +622,6 @@ public class StorageEngine implements IService {
         } finally {
           processor.writeUnlock();
         }
-      } else {
-        throw new StorageGroupNotSetException(storageGroupPath.getFullPath());
       }
     }
   }
@@ -893,6 +891,10 @@ public class StorageEngine implements IService {
   public boolean isFileAlreadyExist(TsFileResource tsFileResource, PartialPath 
storageGroup,
       long partitionNum) {
     VirtualStorageGroupManager virtualStorageGroupManager = 
processorMap.get(storageGroup);
+    if(virtualStorageGroupManager == null){
+      return false;
+    }
+
     for(StorageGroupProcessor storageGroupProcessor : 
virtualStorageGroupManager.getAllPartition()){
       if(storageGroupProcessor != null && 
storageGroupProcessor.isFileAlreadyExist(tsFileResource, partitionNum)){
         return true;

Reply via email to