diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSRecordsLockFreeOverMMappedFile.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSRecordsLockFreeOverMMappedFile.java index 433c4766bc4e..b1a10c535c6a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSRecordsLockFreeOverMMappedFile.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSRecordsLockFreeOverMMappedFile.java @@ -17,7 +17,6 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.lang.invoke.VarHandle; import java.nio.ByteBuffer; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import static com.intellij.openapi.vfs.newvfs.persistent.PersistentFSHeaders.*; @@ -91,9 +90,15 @@ public final class PersistentFSRecordsLockFreeOverMMappedFile implements Persist /** * Incremented on each update of anything in the storage -- header, record. Hence be seen as 'version' - * of storage content -- not storage format version, but current storage content. + * of storage content -- not a storage _format_ version, but current storage _content_. * Stored in {@link PersistentFSHeaders#HEADER_GLOBAL_MOD_COUNT_OFFSET} header field. * If a record is updated -> current value of globalModCount is 'stamped' into a record MOD_COUNT field. + *
+ * In the current implementation almost all fields are read/write straight from/to the mmapped buffer -- which means
+ * they are always 'saved', and no need to flush them explicitly => no need to update .dirty status. The only exception
+ * is globalModCount which _should_ be flushed explicitly -- which is why difference between globalModCount and apt
+ * header field {@link PersistentFSHeaders#HEADER_GLOBAL_MOD_COUNT_OFFSET} is used as sign of storage being 'dirty',
+ * i.e. ask for {@link #force()}
*/
private final AtomicInteger globalModCount = new AtomicInteger(0);
//MAYBE RC: if we increment .globalModCount on _each_ modification -- this rises interesting possibility to
@@ -104,15 +109,6 @@ public final class PersistentFSRecordsLockFreeOverMMappedFile implements Persist
// we find a record(s) with modCount>globalModCount => there were writes unfinished on app crush, and
// likely at least those records are corrupted.
- /**
- * In the current implementation almost all fields are read/write straight from/to the mmapped buffer -- which means
- * they are always 'saved', and no need to flush them explicitly => no need to update .dirty status. The only exception
- * is {@link #globalModCount} which _should_ be flushed explicitly-- which is why the only modifications that must be
- * followed by dirty=true are the {@link #globalModCount}'s modifications.
- * MAYBE RC: instead of dirty flag -> just compare .globalModCount != getIntHeaderField(HEADER_GLOBAL_MOD_COUNT_OFFSET)
- */
- private final AtomicBoolean dirty = new AtomicBoolean(false);
-
//cached for faster access:
private final transient int pageSize;
private final transient int recordsPerPage;
@@ -203,8 +199,7 @@ public final class PersistentFSRecordsLockFreeOverMMappedFile implements Persist
@Override
public