APISonar


com.hazelcast.cp.internal.raft.impl.state.RaftState.log

> com > hazelcast > cp > internal > raft > impl > state > RaftState > log
com APIs hazelcast APIs cp APIs internal APIs raft APIs impl APIs state APIs RaftState APIs log APIs

Example 1
private final RaftState state;

    private void appendEntryAfterLeaderElection() {
        Object entry = raftIntegration.getAppendedEntryOnLeaderElection();
        if (entry != null) {
            RaftLog log = state.log();
            log.appendEntries(new LogEntry(state.term(), log.lastLogOrSnapshotIndex() + 1, entry));
        }
    }
Example 2
private void trySendAppendRequest(RaftState state) {
        long followerLastLogIndex = resp.lastLogIndex();
        if (state.log().lastLogOrSnapshotIndex() > followerLastLogIndex || state.commitIndex() == followerLastLogIndex) {
            // If the follower is still missing some log entries or has not learnt the latest commit index yet,
            // then send another append request.
            raftNode.sendAppendRequest(resp.follower());
        }
    }
Example 3
private final RaftState state;

    private void initRestoredState() {
        SnapshotEntry snapshot = state.log().snapshot();
        if (isNonInitial(snapshot)) {
            printMemberState();
            raftIntegration.restoreSnapshot(snapshot.operation(), snapshot.index());
            if (logger.isFineEnabled()) {
                logger.info(snapshot + " is restored.");
            } else {
                logger.info("Snapshot is restored at commitIndex=" + snapshot.index());
            }
        }

        applyRestoredRaftGroupCommands(snapshot);
    }