Index: src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java =================================================================== --- src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java (revision 1712730) +++ src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java (working copy) @@ -90,7 +90,7 @@ * Only a single local commit is allowed at a time. When such * a commit is in progress, no external updates will be seen. */ - private final Semaphore commitSemaphore = new Semaphore(1); + private final Semaphore commitSemaphore; private long maximumBackoff = MILLISECONDS.convert(10, SECONDS); @@ -101,6 +101,12 @@ private int checkpointsLockWaitTime = Integer.getInteger( "oak.checkpoints.lockWaitTime", 10); + /** + * Flag controlling the commit lock fairness + */ + private boolean commitFairLock = Boolean + .getBoolean("oak.SegmentNodeStore.commitFairLock"); + @Nonnull public static SegmentNodeStoreBuilder newSegmentNodeStore( @Nonnull SegmentStore store) { @@ -117,6 +123,7 @@ } SegmentNodeStore(SegmentStore store, boolean internal) { + this.commitSemaphore = new Semaphore(1, commitFairLock); this.store = store; this.head = new AtomicReference(store.getHead()); this.changeDispatcher = new ChangeDispatcher(getRoot());