core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALSegmentCache.java
void truncate(long pageIndex) throws IOException {
    synchronized (lockObject) {
      lastAccessTime = System.nanoTime();

      flushBuffer();

      lastWrittenPageIndex = -1;
      lastWrittenPage = null;

      segChannel.truncate(pageIndex * OWALPage.PAGE_SIZE);
    }
  }
void truncate(long pageIndex) throws IOException {
    synchronized (lockObject) {
      lastAccessTime = System.nanoTime();

      flushBuffer();

      lastWrittenPageIndex = -1;
      lastWrittenPage = null;

      segChannel.truncate(pageIndex * OWALPage.PAGE_SIZE);
    }
  }
Flushes all buffered pages and truncates file till passed in page index