You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by lt...@apache.org on 2021/05/14 03:51:20 UTC

[iotdb] branch cluster_scalability updated: fix a bug of update last cache and wait for setting sg when installing snapshots

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

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


The following commit(s) were added to refs/heads/cluster_scalability by this push:
     new 0792dea  fix a bug of update last cache and wait for setting sg when installing snapshots
0792dea is described below

commit 0792dea07f83f71ce0a545bfee59a7580a44a75d
Author: lta <li...@163.com>
AuthorDate: Fri May 14 11:50:51 2021 +0800

    fix a bug of update last cache and wait for setting sg when installing snapshots
---
 .../src/main/java/org/apache/iotdb/cluster/log/LogParser.java  |  2 +-
 .../org/apache/iotdb/cluster/log/snapshot/FileSnapshot.java    |  8 ++++++--
 .../iotdb/db/engine/storagegroup/StorageGroupProcessor.java    | 10 +++++-----
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/log/LogParser.java b/cluster/src/main/java/org/apache/iotdb/cluster/log/LogParser.java
index eeea802..e35943b 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/log/LogParser.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/log/LogParser.java
@@ -65,7 +65,7 @@ public class LogParser {
         AddNodeLog addNodeLog = new AddNodeLog();
         addNodeLog.deserialize(buffer);
         if (logger.isDebugEnabled()) {
-          logger.info(
+          logger.debug(
               "The last meta log index of log {} is {}", addNodeLog, addNodeLog.getMetaLogIndex());
         }
         log = addNodeLog;
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/log/snapshot/FileSnapshot.java b/cluster/src/main/java/org/apache/iotdb/cluster/log/snapshot/FileSnapshot.java
index 5e47a66..49962ac 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/log/snapshot/FileSnapshot.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/log/snapshot/FileSnapshot.java
@@ -215,8 +215,12 @@ public class FileSnapshot extends Snapshot implements TimeseriesSchemaSnapshot {
     private void installSnapshot(Map<Integer, FileSnapshot> snapshotMap)
         throws SnapshotInstallationException {
       // In data migration, meta group member other than new node does not need to synchronize the
-      // leader,
-      // because data migration must be carried out after meta group applied add/remove node log.
+      // leader, because data migration must be carried out after meta group applied add/remove node
+      // log.
+      dataGroupMember
+          .getMetaGroupMember()
+          .syncLocalApply(
+              dataGroupMember.getMetaGroupMember().getPartitionTable().getLastMetaLogIndex() - 1);
       for (Entry<Integer, FileSnapshot> integerSnapshotEntry : snapshotMap.entrySet()) {
         Integer slot = integerSnapshotEntry.getKey();
         FileSnapshot snapshot = integerSnapshotEntry.getValue();
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index 15112e8..3eba00e 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -2136,7 +2136,7 @@ public class StorageGroupProcessor {
           tsfileToBeInserted.getParentFile().getName());
       IoTDBDescriptor.getInstance().getConfig().setReadOnly(true);
       throw new LoadFileException(e);
-    } catch (IllegalPathException | WriteProcessException e) {
+    } catch (IllegalPathException e) {
       logger.error(
           "Failed to reset last cache when loading file {}", newTsFileResource.getTsFilePath());
       throw new LoadFileException(e);
@@ -2146,13 +2146,13 @@ public class StorageGroupProcessor {
   }
 
   private void resetLastCacheWhenLoadingTsfile(TsFileResource newTsFileResource)
-      throws IllegalPathException, WriteProcessException {
+      throws IllegalPathException {
     for (String device : newTsFileResource.getDevices()) {
       tryToDeleteLastCacheByDevice(new PartialPath(device));
     }
   }
 
-  private void tryToDeleteLastCacheByDevice(PartialPath deviceId) throws WriteProcessException {
+  private void tryToDeleteLastCacheByDevice(PartialPath deviceId) {
     if (!IoTDBDescriptor.getInstance().getConfig().isLastCacheEnabled()) {
       return;
     }
@@ -2168,7 +2168,7 @@ public class StorageGroupProcessor {
         }
       }
     } catch (MetadataException e) {
-      throw new WriteProcessException(e);
+      // the path doesn't cache in cluster mode now, ignore
     }
   }
 
@@ -2243,7 +2243,7 @@ public class StorageGroupProcessor {
           tsfileToBeInserted.getParentFile().getName());
       IoTDBDescriptor.getInstance().getConfig().setReadOnly(true);
       throw new LoadFileException(e);
-    } catch (IllegalPathException | WriteProcessException e) {
+    } catch (IllegalPathException e) {
       logger.error(
           "Failed to reset last cache when loading file {}", newTsFileResource.getTsFilePath());
       throw new LoadFileException(e);