private void writeOneKeyEntryForKRF(byte[] keyBytes, byte userBits, int valueLength,
      long diskRegionId, long oplogKeyId, long valueOffset, VersionHolder tag) throws IOException {
    if (getParent().isValidating()) {
      return;
    }

    if (!getParent().isOfflineCompacting()) {
      assert (krf.dos != null);
    } else {
      if (krf.dos == null) {
        // krf already exist, thus not re-opened for write
        return;
      }
    }
    DataSerializer.writeByteArray(keyBytes, krf.dos);
    krf.dos.writeByte(EntryBits.getPersistentBits(userBits));
    InternalDataSerializer.writeArrayLength(valueLength, krf.dos);
    DiskInitFile.writeDiskRegionID(krf.dos, diskRegionId);
    if (EntryBits.isWithVersions(userBits) && tag != null) {
      serializeVersionTag(tag, krf.dos);
    }
    InternalDataSerializer.writeVLOld(oplogKeyId, krf.dos);
    // skip the invalid entries, theire valueOffset is -1
    if (!EntryBits.isAnyInvalid(userBits) && !EntryBits.isTombstone(userBits)) {
      InternalDataSerializer.writeVLOld((valueOffset - krf.lastOffset), krf.dos);
      // save the lastOffset in krf object
      krf.lastOffset = valueOffset;
    }
    krf.keyNum++;
  }
Schedule a task to create a krf asynchronously
geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java