docs: private void takeSnapshotIfCommitIndexAdvanced() {
          long commitIndex = state.commitIndex();
          if ((commitIndex - state.log().snapshotIndex()) < commitIndexAdvanceCountToSnapshot) {
              return;
          }
  
          if (isTerminatedOrSteppedDown()) {
              // If the status is UPDATING_MEMBER_LIST or TERMINATING, it means the status is normally ACTIVE
              // and there is an appended but not committed RaftGroupCmd.
              // If the status is TERMINATED or STEPPED_DOWN, then there will not be any new appends.
              return;
          }
  
          RaftLog log = state.log();
          Object snapshot = raftIntegration.takeSnapshot(commitIndex);
          if (snapshot instanceof Throwable) {
              Throwable t = (Throwable) snapshot;
              logger.severe("Could not take snapshot at commit index: " + commitIndex, t);
              return;
          }
  
          int snapshotTerm = log.getLogEntry(commitIndex).term();
          RaftGroupMembers members = state.committedGroupMembers();
          SnapshotEntry snapshotEntry = new SnapshotEntry(snapshotTerm, commitIndex, snapshot, members.index(), members.members());
  
          long minMatchIndex = 0L;
          LeaderState leaderState = state.leaderState();
          if (leaderState != null) {
              long[] indices = leaderState.matchIndices();
              // Last slot is reserved for leader index,
              // and always zero. That's why we are skipping it.
              Arrays.sort(indices, 0, indices.length - 1);
              minMatchIndex = indices[0];
          }
  
          long truncateLogsUpToIndex = max(commitIndex - maxNumberOfLogsToKeepAfterSnapshot, minMatchIndex);
          int truncated = log.setSnapshot(snapshotEntry, truncateLogsUpToIndex);
  
          if (logger.isFineEnabled()) {
              logger.fine(snapshotEntry + " is taken, " + truncated + " entries are truncated.");
          }
      }