This is an automated email from the ASF dual-hosted git repository. kturner pushed a commit to branch elasticity in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/elasticity by this push: new 7767e9ad6f adds missing sync in fate code (#4181) 7767e9ad6f is described below commit 7767e9ad6fcbf48498d58e88194b147bc365faef Author: Keith Turner <ktur...@apache.org> AuthorDate: Sat Jan 20 15:35:12 2024 -0500 adds missing sync in fate code (#4181) --- .../org/apache/accumulo/core/fate/AbstractFateStore.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java b/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java index 396f30b474..89eca7cbf6 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java @@ -98,7 +98,7 @@ public abstract class AbstractFateStore<T> implements FateStore<T> { */ @Override public Optional<FateTxStore<T>> tryReserve(long tid) { - synchronized (this) { + synchronized (AbstractFateStore.this) { if (!reserved.contains(tid)) { return Optional.of(reserve(tid)); } @@ -154,11 +154,13 @@ public abstract class AbstractFateStore<T> implements FateStore<T> { if (seen.get() == 0) { if (beforeCount == unreservedRunnableCount.getCount()) { long waitTime = 5000; - if (!deferred.isEmpty()) { - long currTime = System.nanoTime(); - long minWait = - deferred.values().stream().mapToLong(l -> l - currTime).min().getAsLong(); - waitTime = TimeUnit.MILLISECONDS.convert(minWait, TimeUnit.NANOSECONDS); + synchronized (AbstractFateStore.this) { + if (!deferred.isEmpty()) { + long currTime = System.nanoTime(); + long minWait = + deferred.values().stream().mapToLong(l -> l - currTime).min().getAsLong(); + waitTime = TimeUnit.MILLISECONDS.convert(minWait, TimeUnit.NANOSECONDS); + } } if (waitTime > 0) {