Apache Lucene open-source search software
obtain(long) never really waited for the lock to go away (#33799)
Daniel Naber5edb98e537ea
diff --git a/CHANGES.txt b/CHANGES.txtindex 7ece32b7635..5061f725c1e 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -155,6 +155,10 @@ Bug fixeson such automatically generated queries are no longer penalizedfor not matching all terms. (Doug Cutting, Patch #33472)+ 7. Getting a lock file with Lock.obtain(long) was supposed to wait for+ a given amount of milliseconds, but this didn't work.+ (John Wang via Daniel Naber, Bug #33799)+Optimizations1. Disk usage (peak requirements during indexing and optimization)diff --git a/src/java/org/apache/lucene/store/Lock.java b/src/java/org/apache/lucene/store/Lock.javaindex 05dd7d29a09..27ce1e4ce21 100644--- a/src/java/org/apache/lucene/store/Lock.java+++ b/src/java/org/apache/lucene/store/Lock.java@@ -54,7 +54,7 @@ public abstract class Lock {int maxSleepCount = (int)(lockWaitTimeout / LOCK_POLL_INTERVAL);int sleepCount = 0;while (!locked) {- if (++sleepCount == maxSleepCount) {+ if (sleepCount++ == maxSleepCount) {throw new IOException("Lock obtain timed out: " + this.toString());}try {