@@ -185,7 +185,7 @@ public InternalEngine(EngineConfig engineConfig) {
185
185
new CombinedDeletionPolicy (logger , translogDeletionPolicy , translog ::getLastSyncedGlobalCheckpoint );
186
186
writer = createWriter ();
187
187
bootstrapAppendOnlyInfoFromWriter (writer );
188
- historyUUID = Objects . requireNonNull ( loadOrGenerateHistoryUUID ( writer ), "history uuid should not be null" );
188
+ historyUUID = loadHistoryUUID ( writer );
189
189
indexWriter = writer ;
190
190
} catch (IOException | TranslogCorruptedException e ) {
191
191
throw new EngineCreationFailureException (shardId , "failed to create engine" , e );
@@ -275,10 +275,11 @@ protected IndexSearcher refreshIfNeeded(IndexSearcher referenceToRefresh) throws
275
275
// steal it by calling incRef on the "stolen" reader
276
276
internalSearcherManager .maybeRefreshBlocking ();
277
277
IndexSearcher acquire = internalSearcherManager .acquire ();
278
- final IndexReader previousReader = referenceToRefresh .getIndexReader ();
279
- assert previousReader instanceof ElasticsearchDirectoryReader :
280
- "searcher's IndexReader should be an ElasticsearchDirectoryReader, but got " + previousReader ;
281
278
try {
279
+ final IndexReader previousReader = referenceToRefresh .getIndexReader ();
280
+ assert previousReader instanceof ElasticsearchDirectoryReader :
281
+ "searcher's IndexReader should be an ElasticsearchDirectoryReader, but got " + previousReader ;
282
+
282
283
final IndexReader newReader = acquire .getIndexReader ();
283
284
if (newReader == previousReader ) {
284
285
// nothing has changed - both ref managers share the same instance so we can use reference equality
@@ -481,7 +482,7 @@ private String loadTranslogUUIDFromLastCommit() throws IOException {
481
482
/**
482
483
* Reads the current stored history ID from the IW commit data.
483
484
*/
484
- private String loadOrGenerateHistoryUUID (final IndexWriter writer ) throws IOException {
485
+ private String loadHistoryUUID (final IndexWriter writer ) throws IOException {
485
486
final String uuid = commitDataAsMap (writer ).get (HISTORY_UUID_KEY );
486
487
if (uuid == null ) {
487
488
throw new IllegalStateException ("commit doesn't contain history uuid" );
0 commit comments