void merge(Key key,
             ChangeTrackingValueContainer<Value> valueContainer) throws IOException {
    // Try to accumulate index value calculated for particular key to avoid fragmentation: usually keys are scattered across many files.
    // Note: keys unique for indexed file have their value calculated at once (e.g. key is file id, index calculates something for
    // particular file) and there is no benefit to accumulate values for particular key because only one value exists.
    if (!valueContainer.needsCompacting() && !myKeyIsUniqueForIndexedFile) {
      myPersistentMap.appendData(key, new AppendablePersistentMap.ValueDataAppender() {
        @Override
        public void append(final @NotNull DataOutput out) throws IOException {
          valueContainer.saveDiffTo(out, myValueExternalizer);
        }
      });
    }
    else {//needsCompacting || keyIsUniqueForIndexedFile
      //FIXME RC: here WAS a hack -- this branch processed a case (keyIsUniqueForIndexedFile=true && !needsCompacting)
      //          i.e. with diff and without mergedSnapshot. In this case the diff WAS written, but diff == snapshot
      //          because keyIsUnique.
      //          Currently CTValueContainer.saveTo() always store a merged snapshot -- which in this case creates a useless
      //          overhead, because it involves _reading_ the current content first -- just for it to be entirely overwritten
      //          by the new value.

      //rewrite the value container for defragmentation
      put(key, valueContainer);
    }
  }
void merge(Key key,
             ChangeTrackingValueContainer<Value> valueContainer)