aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2019-07-31 17:27:47 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-07 13:56:08 +0200
commite60b9e1879f8774e1afe07be4224605045f49eec (patch)
treeb56529d6a10505c3b94980b4fd3e7d35e8d9d900 /org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java
parent3b368d5578db13b52b2485b11bf3da1e24ccffd2 (diff)
downloadjgit-e60b9e1879f8774e1afe07be4224605045f49eec.tar.gz
jgit-e60b9e1879f8774e1afe07be4224605045f49eec.zip
FileSnapshot: fix bug with timestamp thresholding
Increase the safety factor to 2.5x for extra safety if max of measured timestamp resolution and measured minimal racy threshold is < 100ms, use 1.25 otherwise since for large filesystem resolution values the influence of finite resolution of the system clock should be negligible. Before, not yet using the newly introduced minRacyThreshold measurement, the threshold was 1.1x FS resolution, and we could issue the following sequence of events, start create-file read-file (currentTime) end which had the following timestamps: create-file 1564589081998 start 1564589082002 read 1564589082003 end 1564589082004 In this case, the difference between create-file and read is 5ms, which exceeded the 4ms FS resolution, even though the events together took just 2ms of runtime. Reproduce with: bazel test --runs_per_test=100 \ //org.eclipse.jgit.test:org_eclipse_jgit_internal_storage_file_FileSnapshotTest The file system timestamp resolution is 4ms in this case. This code assumes that the kernel and the JVM use the same clock that is synchronized with the file system clock. This seems plausible, given the resolution of System.currentTimeMillis() and the latency for a gettimeofday system call (typically ~1us), but it would be good to justify this with specifications. Also cover a source of flakiness: if the test runs under extreme load, then we could have start create-file <long delay> read end which would register as an unmodified file. Avoid this by skipping the test if end-start is too big. [msohn]: - downported from master to stable-5.1 - skip test if resolution is below 10ms - adjust safety factor to 1.25 for resolutions above 100ms Change-Id: I87d2cf035e01c44b7ba8364c410a860aa8e312ef Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java')
0 files changed, 0 insertions, 0 deletions