jgit/org.eclipse.jgit
Dave Borowitz 9c33f7364d RefDirectory: Throw exception if CAS of packed ref list fails
The contents of the packedRefList AtomicReference should never differ
from what we expect prior to writing, because this segment of the code
is protected by the packed-refs lock file on disk. If it does happen,
whether due to programmer error or a rogue process not respecting the
locking protocol, it's better to let the caller know than to silently
drop the whole commit operation on the floor.

The existing concurrentOnlyOneWritesPackedRefs test is inherently
nondeterministic as written, and was already about 6% flaky as measured
by bazel:

  $ bazel test --runs_per_test=200 //org.eclipse.jgit.test:org_eclipse_jgit_internal_storage_file_GcPackRefsTest
  ...
  INFO: Elapsed time: 42.608s, Critical Path: 10.35s
  //org.eclipse.jgit.test:org_eclipse_jgit_internal_storage_file_GcPackRefsTest FAILED in 12 out of 200 in 1.6s
    Stats over 200 runs: max = 1.6s, min = 1.1s, avg = 1.3s, dev = 0.1s

This flakiness was caused by the assumption that exactly one of the 2
threads would fail, when both might actually succeed in practice due to
racing on the compare-and-swap.

For whatever reason, this change affected the interleaving behavior in
such a way that the flakiness jumped to around 50%. Making the
interleaving of the test fully deterministic is beyond the scope of this
change, but a simple tweak to the assertion is enough to make it pass
consistently 200+ times both before and after this change.

Change-Id: I5ff4dc39ee05bda88d47909acb70118f3d0c8f74
2017-07-17 11:56:35 -04:00
..
.settings Support -merge attribute in binary macro 2017-06-27 10:33:50 +02:00
META-INF Merge branch 'stable-4.8' 2017-06-11 20:24:12 +09:00
findBugs [findBugs] Silence warning about Transport initialization 2012-09-14 00:01:47 +02:00
resources/org/eclipse/jgit ReceiveCommand: Explicitly check constructor preconditions 2017-07-17 11:56:35 -04:00
src/org/eclipse/jgit RefDirectory: Throw exception if CAS of packed ref list fails 2017-07-17 11:56:35 -04: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: Restrict src globs to Java source files 2017-04-13 14:14:55 +09: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 JGit v4.7.1.201706071930-r 2017-06-08 01:19:38 +02:00