private void commitPositionOnSingleNode() { final long commitPosition = logStream.getLogStorageAppender().getCurrentAppenderPosition() - 1; if (initialEventPosition >= 0 && commitPosition >= initialEventPosition && logStream.getCommitPosition() < commitPosition) { logStream.setCommitPosition(commitPosition); } }
private void commitPositionOnSingleNode() { final long commitPosition = logStream.getLogStorageAppender().getCurrentAppenderPosition() - 1; if (initialEventPosition >= 0 && commitPosition >= initialEventPosition && logStream.getCommitPosition() < commitPosition) { logStream.setCommitPosition(commitPosition); } }
private void commit() { final List<RaftMember> memberList = raftMembers.getMemberList(); final int memberSize = memberList.size(); final long[] positions = new long[memberSize + 1]; for (int i = 0; i < memberSize; i++) { positions[i] = memberList.get(i).getMatchPosition(); } // TODO(menski): `raft.getLogStream().getCurrentAppenderPosition()` is wrong as the current // appender // position is the next position which is written. This means in a single node cluster the log // already committed an event which will be written in the future. `- 1` is a hotfix for this. // see https://github.com/zeebe-io/zeebe/issues/501 positions[memberSize] = logStream.getLogStorageAppender().getCurrentAppenderPosition() - 1; Arrays.sort(positions); final long commitPosition = positions[memberSize + 1 - raft.requiredQuorum()]; final LogStream logStream = raft.getLogStream(); if (initialEventPosition >= 0 && commitPosition >= initialEventPosition && logStream.getCommitPosition() < commitPosition) { logStream.setCommitPosition(commitPosition); } }
private void commit() { final List<RaftMember> memberList = raftMembers.getMemberList(); final int memberSize = memberList.size(); final long[] positions = new long[memberSize + 1]; for (int i = 0; i < memberSize; i++) { positions[i] = memberList.get(i).getMatchPosition(); } // TODO(menski): `raft.getLogStream().getCurrentAppenderPosition()` is wrong as the current // appender // position is the next position which is written. This means in a single node cluster the log // already committed an event which will be written in the future. `- 1` is a hotfix for this. // see https://github.com/zeebe-io/zeebe/issues/501 positions[memberSize] = logStream.getLogStorageAppender().getCurrentAppenderPosition() - 1; Arrays.sort(positions); final long commitPosition = positions[memberSize + 1 - raft.requiredQuorum()]; final LogStream logStream = raft.getLogStream(); if (initialEventPosition >= 0 && commitPosition >= initialEventPosition && logStream.getCommitPosition() < commitPosition) { logStream.setCommitPosition(commitPosition); } }