fanhualta commented on a change in pull request #372: 
[IOTDB-198]Reimplementation sync module
URL: https://github.com/apache/incubator-iotdb/pull/372#discussion_r324504238
 
 

 ##########
 File path: 
server/src/test/java/org/apache/iotdb/db/sync/receiver/recover/SyncReceiverLogAnalyzerTest.java
 ##########
 @@ -0,0 +1,205 @@
+/**
+ * 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.sync.receiver.recover;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import org.apache.iotdb.db.conf.IoTDBConstant;
+import org.apache.iotdb.db.conf.directories.DirectoryManager;
+import org.apache.iotdb.db.engine.StorageEngine;
+import org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor;
+import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
+import org.apache.iotdb.db.exception.DiskSpaceInsufficientException;
+import org.apache.iotdb.db.exception.MetadataErrorException;
+import org.apache.iotdb.db.exception.StartupException;
+import org.apache.iotdb.db.exception.StorageEngineException;
+import org.apache.iotdb.db.metadata.MManager;
+import org.apache.iotdb.db.service.IoTDB;
+import org.apache.iotdb.db.sync.receiver.load.FileLoader;
+import org.apache.iotdb.db.sync.receiver.load.FileLoaderManager;
+import org.apache.iotdb.db.sync.receiver.load.FileLoaderTest;
+import org.apache.iotdb.db.sync.sender.conf.SyncConstant;
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SyncReceiverLogAnalyzerTest {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(FileLoaderTest.class);
+  private static final String SG_NAME = "root.sg";
+  private static IoTDB daemon;
+  private String dataDir;
+  private FileLoader fileLoader;
+  private SyncReceiverLogAnalyzer logAnalyze;
+  private SyncReceiverLogger receiverLogger;
+
+  @Before
+  public void setUp()
+      throws IOException, InterruptedException, StartupException, 
DiskSpaceInsufficientException, MetadataErrorException {
+    EnvironmentUtils.closeStatMonitor();
+    daemon = IoTDB.getInstance();
+    daemon.active();
+    EnvironmentUtils.envSetUp();
+    dataDir = new 
File(DirectoryManager.getInstance().getNextFolderForSequenceFile())
+        .getParentFile().getAbsolutePath();
+    logAnalyze = SyncReceiverLogAnalyzer.getInstance();
+    initMetadata();
+  }
+
+  private void initMetadata() throws MetadataErrorException {
+    MManager mmanager = MManager.getInstance();
+    mmanager.init();
+    mmanager.clear();
+    mmanager.setStorageLevelToMTree("root.sg0");
+    mmanager.setStorageLevelToMTree("root.sg1");
+    mmanager.setStorageLevelToMTree("root.sg2");
+  }
+
+  @After
+  public void tearDown() throws InterruptedException, IOException, 
StorageEngineException {
+    daemon.stop();
+    EnvironmentUtils.cleanEnv();
+  }
+
+  @Test
+  public void recover() throws IOException, StorageEngineException {
+    receiverLogger = new SyncReceiverLogger(
+        new File(getReceiverFolderFile(), SyncConstant.SYNC_LOG_NAME));
+    fileLoader = FileLoader.createFileLoader(getReceiverFolderFile());
+    Map<String, Set<File>> allFileList = new HashMap<>();
+    Map<String, Set<File>> correctSequenceLoadedFileMap = new HashMap<>();
+
+    // add some new tsfiles
 
 Review comment:
   The number of sync tests is small, so I think it's ok.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to