You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2022/08/18 16:49:22 UTC
[ratis] branch master updated: RATIS-1680. TestLeaderInstallSnapshot creates untracked files (#719)
This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new 971e547ac RATIS-1680. TestLeaderInstallSnapshot creates untracked files (#719)
971e547ac is described below
commit 971e547acb6e5c623bb0e60cc243a77eb75c64c6
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Thu Aug 18 18:49:17 2022 +0200
RATIS-1680. TestLeaderInstallSnapshot creates untracked files (#719)
---
.../ratis/InstallSnapshotFromLeaderTests.java | 24 ++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotFromLeaderTests.java b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotFromLeaderTests.java
index 98be1e64c..bc4de2ff4 100644
--- a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotFromLeaderTests.java
+++ b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotFromLeaderTests.java
@@ -20,6 +20,7 @@ package org.apache.ratis;
import org.apache.ratis.client.RaftClient;
import org.apache.ratis.conf.RaftProperties;
import org.apache.ratis.protocol.RaftClientReply;
+import org.apache.ratis.protocol.RaftGroupId;
import org.apache.ratis.protocol.RaftPeerId;
import org.apache.ratis.server.RaftServer;
import org.apache.ratis.server.RaftServerConfigKeys;
@@ -28,6 +29,7 @@ import org.apache.ratis.server.impl.RaftServerTestUtil;
import org.apache.ratis.server.protocol.TermIndex;
import org.apache.ratis.server.raftlog.RaftLog;
import org.apache.ratis.server.storage.FileInfo;
+import org.apache.ratis.server.storage.RaftStorage;
import org.apache.ratis.statemachine.SimpleStateMachine4Testing;
import org.apache.ratis.statemachine.SnapshotInfo;
import org.apache.ratis.statemachine.StateMachine;
@@ -106,12 +108,22 @@ public abstract class InstallSnapshotFromLeaderTests<CLUSTER extends MiniRaftClu
}
private static class StateMachineWithMultiNestedSnapshotFile extends SimpleStateMachine4Testing {
- // contains two snapshot files
- // sm/snapshot/1.bin
- // sm/snapshot/sub/2.bin
- final File snapshotRoot = new File(getSMdir(), "snapshot");
- final File file1 = new File(snapshotRoot, "1.bin");
- final File file2 = new File(new File(snapshotRoot, "sub"), "2.bin");
+
+ File snapshotRoot;
+ File file1;
+ File file2;
+
+ @Override
+ public synchronized void initialize(RaftServer server, RaftGroupId groupId, RaftStorage raftStorage) throws IOException {
+ super.initialize(server, groupId, raftStorage);
+
+ // contains two snapshot files
+ // sm/snapshot/1.bin
+ // sm/snapshot/sub/2.bin
+ snapshotRoot = new File(getSMdir(), "snapshot");
+ file1 = new File(snapshotRoot, "1.bin");
+ file2 = new File(new File(snapshotRoot, "sub"), "2.bin");
+ }
@Override
public synchronized void pause() {