mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not mark FSRecords as dirty upon opening or successful find of
existing root
This commit is contained in:
+10
-4
@@ -283,7 +283,9 @@ public class FSRecords {
|
||||
myRecords = new ResizeableMappedFile(recordsFile, 20 * 1024, storageLockContext,
|
||||
PagedFileStorage.BUFFER_SIZE, aligned, IOUtil.ourByteBuffersUseNativeByteOrder);
|
||||
|
||||
if (myRecords.length() == 0) {
|
||||
boolean initial = myRecords.length() == 0;
|
||||
|
||||
if (initial) {
|
||||
cleanRecord(0); // Clean header
|
||||
cleanRecord(1); // Create root record
|
||||
setCurrentVersion();
|
||||
@@ -296,7 +298,7 @@ public class FSRecords {
|
||||
if (myRecords.getInt(HEADER_CONNECTION_STATUS_OFFSET) != SAFELY_CLOSED_MAGIC) {
|
||||
throw new IOException("FS repository wasn't safely shut down");
|
||||
}
|
||||
markDirty();
|
||||
if (initial) markDirty();
|
||||
scanFreeRecords();
|
||||
}
|
||||
catch (Exception e) { // IOException, IllegalArgumentException
|
||||
@@ -809,7 +811,6 @@ public class FSRecords {
|
||||
w.lock();
|
||||
|
||||
try {
|
||||
DbConnection.markDirty();
|
||||
if (ourStoreRootsSeparately) {
|
||||
try {
|
||||
try (LineNumberReader stream = new LineNumberReader(new BufferedReader(new InputStreamReader(new FileInputStream(DbConnection.myRootsFile))))) {
|
||||
@@ -823,6 +824,8 @@ public class FSRecords {
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException ignored) {}
|
||||
|
||||
DbConnection.markDirty();
|
||||
try (Writer stream = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(DbConnection.myRootsFile, true)))) {
|
||||
int id = createRecord();
|
||||
stream.write(id + " " + rootUrl + "\n");
|
||||
@@ -830,7 +833,7 @@ public class FSRecords {
|
||||
}
|
||||
}
|
||||
|
||||
final int root = getNames().enumerate(rootUrl);
|
||||
int root = getNames().tryEnumerate(rootUrl);
|
||||
|
||||
final DataInputStream input = readAttribute(ROOT_RECORD_ID, ourChildrenAttr);
|
||||
int[] names = ArrayUtil.EMPTY_INT_ARRAY;
|
||||
@@ -860,6 +863,9 @@ public class FSRecords {
|
||||
}
|
||||
}
|
||||
|
||||
DbConnection.markDirty();
|
||||
root = getNames().enumerate(rootUrl);
|
||||
|
||||
int id;
|
||||
try (DataOutputStream output = writeAttribute(ROOT_RECORD_ID, ourChildrenAttr)) {
|
||||
id = createRecord();
|
||||
|
||||
Reference in New Issue
Block a user