private void newCompact(@NotNull PersistentHashMapValueStorage newStorage) throws IOException {
    long started = System.currentTimeMillis();
    final List<CompactionRecordInfo> infos = new ArrayList<>(10000);

    myEnumerator.traverseAllRecords(new PersistentEnumeratorBase.RecordsProcessor() {
      @Override
      public boolean process(final int keyId) throws IOException {
        final long record = readValueId(keyId);
        if (record != NULL_ADDR) {
          infos.add(new CompactionRecordInfo(getCurrentKey(), record, keyId));
        }
        return true;
      }
    });

    LOG.info("Loaded mappings:" + (System.currentTimeMillis() - started) + "ms, keys:" + infos.size());
    started = System.currentTimeMillis();
    long fragments = 0;
    if (!infos.isEmpty()) {
      try {
        fragments = myValueStorage.compactValues(infos, newStorage);
      }
      catch (IOException e) {
        throw e;
      }
      catch (Throwable t) {
        throw new IOException("Compaction failed", t);
      }
    }

    LOG.info("Compacted values for:" + (System.currentTimeMillis() - started) + "ms fragments:" +
             (int)fragments + ", new fragments:" + (fragments >> 32));

    started = System.currentTimeMillis();
    myEnumerator.lockStorageWrite();
    try {

      for (CompactionRecordInfo info : infos) {
        updateValueId(info.address, info.newValueAddress, info.valueAddress, null, info.key);
        myLiveAndGarbageKeysCounter += LIVE_KEY_MASK;
      }
    }
    finally {
      myEnumerator.unlockStorageWrite();
    }
    LOG.info("Updated mappings:" + (System.currentTimeMillis() - started) + " ms");
  }
private void newCompact(@NotNull PersistentHashMapValueStorage newStorage)