private void openRAF2() {
    try {
      ifRAF = new RandomAccessFile(ifFile, getFileMode());
      long len = ifRAF.length();
      if (len != 0) {
        // this.ifRAF.seek(len);
        if (gotEOF) {
          ifRAF.seek(nextSeekPosition - 1);
        } else {
          ifRAF.seek(nextSeekPosition);
        }
      } else {
        // pre-allocate the if file using some percentage of max Oplog size but
        // with max of 10M and min of 1M
        long maxSizeInMB = Math.min(Math.max(parent.getMaxOplogSize() / 200L, 1L), 10L);
        byte[] buffer = new byte[(1024 * 1024)];
        for (int i = 0; i < maxSizeInMB; i++) {
          ifRAF.write(buffer);
        }
        ifRAF.seek(0L);
      }
    } catch (IOException ex) {
      throw new DiskAccessException(
          String.format("Could not open %s.", ifFile.getPath()), ex,
          parent);
    }
  }
If the ratio of live vs. dead is not less than this constant then no need to compact.
geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java