jgit/org.eclipse.jgit
Matthias Sohn b513b77477 Measure file timestamp resolution used in FileSnapshot
FileSnapshot.notRacyClean() assumed a worst case filesystem timestamp
resolution of 2.5 sec (FAT has a resolution of 2 sec). Instead measure
timestamp resolution to avoid unnecessary IO caused by false positives
in detecting the racy git problem caused by finite filesystem timestamp
resolution [1].

Cache the measured resolution per FileStore since timestamp resolution
depends on the respective filesystem type. If timestamp resolution
cannot be measured or fails due to an exception fallback to the worst
case FAT timestamp resolution and avoid caching this value.

Add a 10% safety margin in FileSnapshot.notRacyClean(), though running
FsTest.testFsTimestampResolution() 1000 times which is not using a
safety margin didn't fail on Mac using APFS and Java 8, 11, 12.

Measured Java file timestamp resolution: [2]

[1] https://github.com/git/git/blob/master/Documentation/technical/racy-git.txt
[2] https://docs.google.com/spreadsheets/d/1imy0y6WmRqBf0kjCxzxj2X7M50eIVfa7oaUIzEOHmjo

Bug: 546891
Change-Id: I493f3b57b6b306285ffa7d392339d253e5966ab8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 08:13:22 +02:00
..
.settings Measure file timestamp resolution used in FileSnapshot 2019-05-22 08:13:22 +02:00
META-INF Prepare 5.1.8-SNAPSHOT builds 2019-04-20 10:51:17 +02:00
findBugs [findBugs] Silence warning about Transport initialization 2012-09-14 00:01:47 +02:00
resources/org/eclipse/jgit Merge branch 'stable-4.11' into stable-5.0 2019-03-06 14:15:36 +09:00
src/org/eclipse/jgit Measure file timestamp resolution used in FileSnapshot 2019-05-22 08:13:22 +02:00
.classpath Change JGit minimum execution environment to JavaSE-1.8 2016-09-20 11:32:36 +02:00
.fbprefs Initial JGit contribution to eclipse.org 2009-09-29 16:47:03 -07:00
.gitignore Finish removing Apache Felix maven-bundle-plugin 2010-01-12 11:46:55 -08:00
.project Revert "Hide Maven target directories from Eclipse" 2010-08-28 09:50:50 +02:00
BUILD Bazel: Support building with Java 9 2018-02-07 17:51:35 -05:00
about.html SHA-1: collision detection support 2017-02-28 16:38:43 -08:00
build.properties Add "resources/" as a source folder 2010-06-05 14:39:27 +02:00
plugin.properties Remove incubation marker 2011-05-31 22:53:53 +02:00
pom.xml Prepare 5.1.8-SNAPSHOT builds 2019-04-20 10:51:17 +02:00