Add flag for controlling percentile of commit time used in scheduler
@@ -113,6 +113,13 @@ public class LockBasedScheduler implements Scheduler {
private static final boolean COMMIT_FAIR_LOCK = Boolean
.parseBoolean(System.getProperty("oak.segmentNodeStore.commitFairLock", "true"));
+ /**
+ * Flag controlling the commit time percentile to wait for the lock in order
+ * to increase chances of returning an up to date state.
+ */
+ private static final int SCHEDULER_FETCH_COMMIT_DELAY_PERCENTILE = Integer
+ .getInteger("oak.scheduler.fetch.commitDelayPercentile", 50);
+
/**
* Sets the number of seconds to wait for the attempt to grab the lock to
* create a checkpoint
@@ -155,7 +162,7 @@ public class LockBasedScheduler implements Scheduler {
@Override
public NodeState getHeadNodeState() {
- long delay = (long) commitTimeStats.getPercentile(50);
+ long delay = (long) commitTimeStats.getPercentile(SCHEDULER_FETCH_COMMIT_DELAY_PERCENTILE);
try {
if (commitSemaphore.tryAcquire(delay, NANOSECONDS)) {
try {
