private void compactLogs(long compactIndex) {
    raft.getThreadContext().execute(() -> {
      logger.debug("Compacting logs up to index {}", compactIndex);
      try {
        raft.getLog().compact(compactIndex);
      } catch (Exception e) {
        logger.error("An exception occurred during log compaction: {}", e);
      } finally {
        this.compactFuture.complete(null);
        this.compactFuture = null;
        // Immediately attempt to take new snapshots since compaction is already run after a time interval.
        takeSnapshots(false, false);
      }
    });
  }
private void compactLogs ( long compactIndex ) { raft . getThreadContext ( ) . execute ( ( ) -> { logger . debug ( "Compacting logs up to index {}" , compactIndex ) ; try { raft . getLog ( ) . compact ( compactIndex ) ; } catch ( Exception e ) { logger . error ( "An exception occurred during log compaction: {}" , e ) ; } finally { this . compactFuture . complete ( null ) ; this . compactFuture = null ; takeSnapshots ( false , false ) ; } } ) ; }
Compacts logs up to the given index.

@param compactIndex the index to which to compact logs