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

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


The following commit(s) were added to refs/heads/master by this push:
     new 517dc13a63 [IOTDB-4090] Add getLatestSnapshotFiles interface in 
consensus (#6948)
517dc13a63 is described below

commit 517dc13a637bbccc231f37199ee42630ab346252
Author: William Song <[email protected]>
AuthorDate: Wed Aug 10 19:00:38 2022 +0800

    [IOTDB-4090] Add getLatestSnapshotFiles interface in consensus (#6948)
---
 .../java/org/apache/iotdb/consensus/IStateMachine.java    | 15 +++++++++++++++
 .../db/consensus/statemachine/DataRegionStateMachine.java |  6 ++++++
 2 files changed, 21 insertions(+)

diff --git 
a/consensus/src/main/java/org/apache/iotdb/consensus/IStateMachine.java 
b/consensus/src/main/java/org/apache/iotdb/consensus/IStateMachine.java
index 203b7d2a6b..18004f084c 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/IStateMachine.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/IStateMachine.java
@@ -71,6 +71,21 @@ public interface IStateMachine {
    */
   void loadSnapshot(File latestSnapshotRootDir);
 
+  /**
+   * given a snapshot dir, ask statemachine to provide all snapshot files.
+   *
+   * <p>DataRegion may take snapshot at a different disk and only store a log 
file containing file
+   * paths. So statemachine is required to read the log file and provide the 
real snapshot file
+   * paths.
+   *
+   * @param latestSnapshotRootDir dir where the latest snapshot sits
+   * @return List of real snapshot files. If the returned list is null, 
consensus implementations
+   *     will visit and add all files under this give latestSnapshotRootDir.
+   */
+  default List<File> getSnapshotFiles(File latestSnapshotRootDir) {
+    return null;
+  }
+
   /** An optional API for event notifications. */
   interface EventApi {
     /**
diff --git 
a/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
 
b/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
index 285ad31d74..818a09ab2e 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
@@ -104,6 +104,12 @@ public class DataRegionStateMachine extends 
BaseStateMachine {
     }
   }
 
+  @Override
+  public List<File> getSnapshotFiles(File latestSnapshotRootDir) {
+    // TODO: implement this method
+    return super.getSnapshotFiles(latestSnapshotRootDir);
+  }
+
   @Override
   public TSStatus write(IConsensusRequest request) {
     PlanNode planNode;

Reply via email to