Skip to content

Commit

Permalink
Perform index checking in a caller thread (elastic#82249)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
idegtiarenko committed Jan 5, 2022
1 parent 0caf052 commit 5f57908
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions server/src/main/java/org/elasticsearch/index/store/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ public void renameTempFilesSafe(Map<String, String> tempFileMap) throws IOExcept
public CheckIndex.Status checkIndex(PrintStream out) throws IOException {
metadataLock.writeLock().lock();
try (CheckIndex checkIndex = new CheckIndex(directory)) {
// Since 8.11 lucene performs index checking concurrently using disposable fixed thread pool executor by default.
// Setting thread count to 1 to keep prior behaviour (check is executed in single caller thread).
checkIndex.setThreadCount(1);
checkIndex.setInfoStream(out);
return checkIndex.checkIndex();
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@

public class FrozenSearchableSnapshotsIntegTests extends BaseFrozenSearchableSnapshotsIntegTestCase {

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/81949")
public void testCreateAndRestorePartialSearchableSnapshot() throws Exception {
final String fsRepoName = randomAlphaOfLength(10);
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ protected final boolean assertCurrentThreadMayAccessBlobStore() {
|| threadName.contains('[' + SearchableSnapshots.CACHE_PREWARMING_THREAD_POOL_NAME + ']')

// Unit tests access the blob store on the main test thread; simplest just to permit this rather than have them override this
// method somehow.
|| threadName.startsWith("TEST-")
|| threadName.startsWith("LuceneTestCase") : "current thread [" + Thread.currentThread() + "] may not read " + fileInfo;
return true;
Expand Down

0 comments on commit 5f57908

Please sign in to comment.