Skip to content

Commit 62e9e4c

Browse files
authored
Perform index checking in a caller thread (#82249) (#82252)
Since 8.11 lucene performs index checking concurrently using disposable fixed thread pool executor by default. Setting thread count to 1 to keep prior behavior (check is executed in single caller thread).
1 parent ce699ee commit 62e9e4c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

server/src/main/java/org/elasticsearch/index/store/Store.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ public void renameTempFilesSafe(Map<String, String> tempFileMap) throws IOExcept
328328
public CheckIndex.Status checkIndex(PrintStream out) throws IOException {
329329
metadataLock.writeLock().lock();
330330
try (CheckIndex checkIndex = new CheckIndex(directory)) {
331+
// Since 8.11 lucene performs index checking concurrently using disposable fixed thread pool executor by default.
332+
// Setting thread count to 1 to keep prior behaviour (check is executed in single caller thread).
333+
checkIndex.setThreadCount(1);
331334
checkIndex.setInfoStream(out);
332335
return checkIndex.checkIndex();
333336
} finally {

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/BaseSearchableSnapshotIndexInput.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,8 @@ protected final boolean assertCurrentThreadMayAccessBlobStore() {
300300
// Cache prewarming also runs on a dedicated thread pool.
301301
|| threadName.contains('[' + SearchableSnapshots.CACHE_PREWARMING_THREAD_POOL_NAME + ']')
302302

303-
// Unit tests access the blob store on the main test thread, or via an asynchronous
304-
// checkindex call;
305-
// simplest just to permit this rather than have them override this
306-
// method somehow.
303+
// Unit tests access the blob store on the main test thread; simplest just to permit this rather than have them override this
307304
|| threadName.startsWith("TEST-")
308-
|| threadName.startsWith("async-check-index")
309305
|| threadName.startsWith("LuceneTestCase") : "current thread [" + Thread.currentThread() + "] may not read " + fileInfo;
310306
return true;
311307
}

0 commit comments

Comments
 (0)