import com.google.common.io.ByteSource;
import com.google.common.util.concurrent.Uninterruptibles;
import com.google.protobuf.ByteString;
+import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
-1, null, null), ByteSource.wrap(bs.toByteArray())));
LeaderInstallSnapshotState fts = new LeaderInstallSnapshotState(
actorContext.getConfigParams().getSnapshotChunkSize(), leader.logName());
- fts.setSnapshotBytes(bs);
+ fts.setSnapshotBytes(ByteSource.wrap(bs.toByteArray()));
leader.getFollower(FOLLOWER_ID).setLeaderInstallSnapshotState(fts);
//send first chunk and no InstallSnapshotReply received yet
-1, null, null), ByteSource.wrap(bs.toByteArray())));
LeaderInstallSnapshotState fts = new LeaderInstallSnapshotState(
actorContext.getConfigParams().getSnapshotChunkSize(), leader.logName());
- fts.setSnapshotBytes(bs);
+ fts.setSnapshotBytes(ByteSource.wrap(bs.toByteArray()));
leader.getFollower(FOLLOWER_ID).setLeaderInstallSnapshotState(fts);
while (!fts.isLastChunk(fts.getChunkIndex())) {
fts.getNextChunk();
}
@Test
- public void testLeaderInstallSnapshotState() {
+ public void testLeaderInstallSnapshotState() throws IOException {
logStart("testLeaderInstallSnapshotState");
Map<String, String> leadersSnapshot = new HashMap<>();
byte[] barray = bs.toByteArray();
LeaderInstallSnapshotState fts = new LeaderInstallSnapshotState(50, "test");
- fts.setSnapshotBytes(bs);
+ fts.setSnapshotBytes(ByteSource.wrap(barray));
assertEquals(bs.size(), barray.length);
}
assertEquals("totalChunks not matching", chunkIndex, fts.getTotalChunks());
+ fts.close();
}
@Override