Skip to content

Commit

Permalink
Fix slowness in SearchableSnapshotsIntegTests
Browse files Browse the repository at this point in the history
  • Loading branch information
ywelsch committed Feb 23, 2021
1 parent e243e4d commit 3e5b9f0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ private synchronized ElasticsearchDirectoryReader getOrOpenReader() throws IOExc
}

@SuppressForbidden(reason = "we manage references explicitly here")
private synchronized ElasticsearchDirectoryReader getReader() {
if (lastOpenedReader != null && lastOpenedReader.tryIncRef()) {
return lastOpenedReader;
private ElasticsearchDirectoryReader getReader() {
final ElasticsearchDirectoryReader readerRef = lastOpenedReader; // volatile read
if (readerRef != null && readerRef.tryIncRef()) {
return readerRef;
}
return null;
}
Expand Down

0 comments on commit 3e5b9f0

Please sign in to comment.