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