Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RATIS-1680. TestLeaderInstallSnapshot creates untracked files #719

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand All @@ -28,6 +29,7 @@
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;
Expand Down Expand Up @@ -106,12 +108,22 @@ private void testMultiFileInstallSnapshot(CLUSTER cluster) throws Exception {
}

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() {
Expand Down