@@ -76,7 +76,6 @@ public class ReadOnlyEngine extends Engine {
76
76
77
77
protected volatile TranslogStats translogStats ;
78
78
private final String commitId ;
79
- private final Function <DirectoryReader , DirectoryReader > readerWrapperFunction ;
80
79
81
80
/**
82
81
* Creates a new ReadOnlyEngine. This ctor can also be used to open a read-only engine on top of an already opened
@@ -117,8 +116,7 @@ public ReadOnlyEngine(EngineConfig config, SeqNoStats seqNoStats, TranslogStats
117
116
this .seqNoStats = seqNoStats ;
118
117
this .indexCommit = Lucene .getIndexCommit (lastCommittedSegmentInfos , directory );
119
118
this .lazilyLoadSoftDeletes = lazilyLoadSoftDeletes ;
120
- this .readerWrapperFunction = readerWrapperFunction ;
121
- reader = wrapReader (open (indexCommit ));
119
+ reader = wrapReader (open (indexCommit ), readerWrapperFunction );
122
120
readerManager = new ElasticsearchReaderManager (reader );
123
121
assert translogStats != null || obtainLock : "mutiple translogs instances should not be opened at the same time" ;
124
122
this .translogStats = translogStats != null ? translogStats : translogStats (config , lastCommittedSegmentInfos );
@@ -194,7 +192,8 @@ public void verifyEngineBeforeIndexClosing() throws IllegalStateException {
194
192
// reopened as an internal engine, which would be the path to fix the issue.
195
193
}
196
194
197
- protected final ElasticsearchDirectoryReader wrapReader (DirectoryReader reader ) throws IOException {
195
+ protected final ElasticsearchDirectoryReader wrapReader (DirectoryReader reader ,
196
+ Function <DirectoryReader , DirectoryReader > readerWrapperFunction ) throws IOException {
198
197
reader = readerWrapperFunction .apply (reader );
199
198
return ElasticsearchDirectoryReader .wrap (reader , engineConfig .getShardId ());
200
199
}
0 commit comments