if(snapshot.getSize() < 1L){ this.logger.error("invalid snapshot, this usually means a bug from state machine implementation, stop the system to prevent further errors"); System.exit(-1); long sizeLeft = snapshot.getSize() - offset; int blockSize = this.getSnapshotSyncBlockSize(); byte[] data = new byte[sizeLeft > blockSize ? blockSize : (int)sizeLeft]; return null; SnapshotSyncRequest syncRequest = new SnapshotSyncRequest(snapshot, offset, data, (offset + data.length) >= snapshot.getSize()); RaftRequestMessage requestMessage = new RaftRequestMessage(); requestMessage.setMessageType(RaftMessageType.InstallSnapshotRequest);
if(snapshot.getSize() < 1L){ this.logger.error("invalid snapshot, this usually means a bug from state machine implementation, stop the system to prevent further errors"); this.stateMachine.exit(-1); long sizeLeft = snapshot.getSize() - offset; int blockSize = this.getSnapshotSyncBlockSize(); byte[] data = new byte[sizeLeft > blockSize ? blockSize : (int)sizeLeft]; return null; SnapshotSyncRequest syncRequest = new SnapshotSyncRequest(snapshot, offset, data, (offset + data.length) >= snapshot.getSize()); RaftRequestMessage requestMessage = new RaftRequestMessage(); requestMessage.setMessageType(RaftMessageType.InstallSnapshotRequest);
if(snapshot.getSize() < 1L){ this.logger.error("invalid snapshot, this usually means a bug from state machine implementation, stop the system to prevent further errors"); this.stateMachine.exit(-1); long sizeLeft = snapshot.getSize() - offset; int blockSize = this.getSnapshotSyncBlockSize(); byte[] data = new byte[sizeLeft > blockSize ? blockSize : (int)sizeLeft]; return null; SnapshotSyncRequest syncRequest = new SnapshotSyncRequest(snapshot, offset, data, (offset + data.length) >= snapshot.getSize()); RaftRequestMessage requestMessage = new RaftRequestMessage(); requestMessage.setMessageType(RaftMessageType.InstallSnapshotRequest);
needToCatchup = false; }else{ if(response.getNextIndex() >= context.getSnapshot().getSize()){ this.logger.debug("snapshot sync is done"); peer.setNextLogIndex(context.getSnapshot().getLastLogIndex() + 1);
needToCatchup = false; }else{ if(response.getNextIndex() >= context.getSnapshot().getSize()){ this.logger.debug("snapshot sync is done"); peer.setNextLogIndex(context.getSnapshot().getLastLogIndex() + 1);
needToCatchup = false; }else{ if(response.getNextIndex() >= context.getSnapshot().getSize()){ this.logger.debug("snapshot sync is done"); peer.setNextLogIndex(context.getSnapshot().getLastLogIndex() + 1);
if(response.getNextIndex() >= context.getSnapshot().getSize()){
if(response.getNextIndex() >= context.getSnapshot().getSize()){
if(response.getNextIndex() >= context.getSnapshot().getSize()){