You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xu...@apache.org on 2020/12/14 08:43:54 UTC

[iotdb] branch virtual_partition_2_merge updated: refactor

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 710f7d5  refactor
710f7d5 is described below

commit 710f7d58565f79391d57c0bf6c168fc6ed392810
Author: 151250176 <15...@smail.nju.edu.cn>
AuthorDate: Mon Dec 14 16:43:29 2020 +0800

    refactor
---
 .../org/apache/iotdb/db/engine/StorageEngine.java  | 30 +++++++++++-----------
 .../virtualSg/VirtualStorageGroupManager.java      | 25 ++++++++++++++++--
 2 files changed, 38 insertions(+), 17 deletions(-)

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 28b929e..82cc286 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
@@ -542,7 +542,7 @@ public class StorageEngine implements IService {
     }
 
     VirtualStorageGroupManager virtualStorageGroupManager = processorMap.get(storageGroupPath);
-    for (StorageGroupProcessor processor : virtualStorageGroupManager.getAllPartition()) {
+    for (StorageGroupProcessor processor : virtualStorageGroupManager.getAllVirutalStorageGroupProcessor()) {
       if (processor == null) {
         continue;
       }
@@ -598,7 +598,7 @@ public class StorageEngine implements IService {
     }
 
     VirtualStorageGroupManager virtualStorageGroupManager = processorMap.get(storageGroupPath);
-    for (StorageGroupProcessor processor : virtualStorageGroupManager.getAllPartition()) {
+    for (StorageGroupProcessor processor : virtualStorageGroupManager.getAllVirutalStorageGroupProcessor()) {
       if (processor != null) {
         logger
             .info("async closing sg processor is called for closing {}, seq = {}, partitionId = {}",
@@ -646,7 +646,7 @@ public class StorageEngine implements IService {
 
         PartialPath newPath = path.alterPrefixPath(storageGroupPath);
         for (StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroupPath)
-            .getAllPartition()) {
+            .getAllVirutalStorageGroupProcessor()) {
           if(storageGroupProcessor != null){
             storageGroupProcessor.delete(newPath, startTime, endTime, planIndex);
           }
@@ -672,7 +672,7 @@ public class StorageEngine implements IService {
 
         PartialPath newPath = path.alterPrefixPath(storageGroupPath);
         for (StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroupPath)
-            .getAllPartition()) {
+            .getAllVirutalStorageGroupProcessor()) {
           if(storageGroupProcessor != null){
             storageGroupProcessor.delete(newPath, Long.MIN_VALUE, Long.MAX_VALUE, planIndex);
           }
@@ -705,7 +705,7 @@ public class StorageEngine implements IService {
   public int countUpgradeFiles() {
     int totalUpgradeFileNum = 0;
     for (VirtualStorageGroupManager virtualStorageGroupManager : processorMap.values()) {
-      for (StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllPartition()) {
+      for (StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllVirutalStorageGroupProcessor()) {
         if (storageGroupProcessor != null) {
           totalUpgradeFileNum += storageGroupProcessor.countUpgradeFiles();
         }
@@ -725,7 +725,7 @@ public class StorageEngine implements IService {
           "Current system mode is read only, does not support file upgrade");
     }
     for (VirtualStorageGroupManager virtualStorageGroupManager : processorMap.values()) {
-      for (StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllPartition()) {
+      for (StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllVirutalStorageGroupProcessor()) {
         if (storageGroupProcessor != null) {
           storageGroupProcessor.upgrade();
         }
@@ -744,7 +744,7 @@ public class StorageEngine implements IService {
     }
 
     for (VirtualStorageGroupManager virtualStorageGroupManager : processorMap.values()) {
-      for (StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllPartition()) {
+      for (StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllVirutalStorageGroupProcessor()) {
         if (storageGroupProcessor != null) {
           storageGroupProcessor.merge(fullMerge);
         }
@@ -766,7 +766,7 @@ public class StorageEngine implements IService {
     logger.info("Force to delete the data in storage group processor {}", storageGroupPath);
 
     for (StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroupPath)
-        .getAllPartition()) {
+        .getAllVirutalStorageGroupProcessor()) {
       if (storageGroupProcessor != null) {
         storageGroupProcessor.syncDeleteDataFiles();
       }
@@ -791,7 +791,7 @@ public class StorageEngine implements IService {
       return;
     }
 
-    for(StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroup).getAllPartition()){
+    for(StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroup).getAllVirutalStorageGroupProcessor()){
       if(storageGroupProcessor != null){
         storageGroupProcessor.setDataTTL(dataTTL);
       }
@@ -805,7 +805,7 @@ public class StorageEngine implements IService {
 
     deleteAllDataFilesInOneStorageGroup(storageGroupPath);
     VirtualStorageGroupManager virtualStorageGroupManager = processorMap.remove(storageGroupPath);
-    for (StorageGroupProcessor processor : virtualStorageGroupManager.getAllPartition()) {
+    for (StorageGroupProcessor processor : virtualStorageGroupManager.getAllVirutalStorageGroupProcessor()) {
       if (processor != null) {
         processor.deleteFolder(systemDir + File.pathSeparator + storageGroupPath);
       }
@@ -865,7 +865,7 @@ public class StorageEngine implements IService {
   public Map<PartialPath, Map<Long, List<TsFileResource>>> getAllClosedStorageGroupTsFile() {
     Map<PartialPath, Map<Long, List<TsFileResource>>> ret = new HashMap<>();
     for (Entry<PartialPath, VirtualStorageGroupManager> entry : processorMap.entrySet()) {
-      for(StorageGroupProcessor storageGroupProcessor : entry.getValue().getAllPartition()){
+      for(StorageGroupProcessor storageGroupProcessor : entry.getValue().getAllVirutalStorageGroupProcessor()){
         if(storageGroupProcessor != null){
           List<TsFileResource> allResources = storageGroupProcessor.getSequenceFileTreeSet();
           allResources.addAll(storageGroupProcessor.getUnSequenceFileList());
@@ -895,7 +895,7 @@ public class StorageEngine implements IService {
       return false;
     }
 
-    for(StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllPartition()){
+    for(StorageGroupProcessor storageGroupProcessor : virtualStorageGroupManager.getAllVirutalStorageGroupProcessor()){
       if(storageGroupProcessor != null && storageGroupProcessor.isFileAlreadyExist(tsFileResource, partitionNum)){
         return true;
       }
@@ -913,7 +913,7 @@ public class StorageEngine implements IService {
   public void setPartitionVersionToMax(PartialPath storageGroup, long partitionId,
       long newMaxVersion)
       throws StorageEngineException {
-    for(StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroup).getAllPartition()){
+    for(StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroup).getAllVirutalStorageGroupProcessor()){
       if(storageGroupProcessor != null){
         storageGroupProcessor.setPartitionFileVersionToMax(partitionId, newMaxVersion);
       }
@@ -922,7 +922,7 @@ public class StorageEngine implements IService {
 
   public void removePartitions(PartialPath storageGroupPath, TimePartitionFilter filter)
       throws StorageEngineException {
-    for(StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroupPath).getAllPartition()){
+    for(StorageGroupProcessor storageGroupProcessor : processorMap.get(storageGroupPath).getAllVirutalStorageGroupProcessor()){
       if(storageGroupProcessor != null){
         storageGroupProcessor.removePartitions(filter);
       }
@@ -942,7 +942,7 @@ public class StorageEngine implements IService {
   public Map<String, List<Pair<Long, Boolean>>> getWorkingStorageGroupPartitions() {
     Map<String, List<Pair<Long, Boolean>>> res = new ConcurrentHashMap<>();
     for (Entry<PartialPath, VirtualStorageGroupManager> entry : processorMap.entrySet()) {
-      for(StorageGroupProcessor storageGroupProcessor : entry.getValue().getAllPartition()) {
+      for(StorageGroupProcessor storageGroupProcessor : entry.getValue().getAllVirutalStorageGroupProcessor()) {
         if (storageGroupProcessor != null) {
           List<Pair<Long, Boolean>> partitionIdList = new ArrayList<>();
           for (TsFileProcessor tsFileProcessor : storageGroupProcessor.getWorkSequenceTsFileProcessors()) {
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
index 46f75c3..7112fa8 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.iotdb.db.engine.storagegroup.virtualSg;
 
 import org.apache.iotdb.db.engine.StorageEngine;
@@ -25,8 +43,11 @@ public class VirtualStorageGroupManager {
    */
   StorageGroupProcessor[] virtualStorageGroupProcessor;
 
-
-  public StorageGroupProcessor[] getAllPartition(){
+  /**
+   * get all virtual storage group Processor
+   * @return all virtual storage group Processor
+   */
+  public StorageGroupProcessor[] getAllVirutalStorageGroupProcessor(){
     return virtualStorageGroupProcessor;
   }