36
36
import org .apache .lucene .index .LeafReader ;
37
37
import org .apache .lucene .index .LeafReaderContext ;
38
38
import org .apache .lucene .index .NumericDocValues ;
39
- import org .apache .lucene .index .Term ;
40
39
import org .apache .lucene .search .BooleanClause ;
41
40
import org .apache .lucene .search .BooleanQuery ;
42
41
import org .apache .lucene .search .DocValuesFieldExistsQuery ;
51
50
import org .opensearch .common .lucene .Lucene ;
52
51
import org .opensearch .core .internal .io .IOUtils ;
53
52
import org .opensearch .index .fieldvisitor .FieldsVisitor ;
54
- import org .opensearch .index .mapper .IdFieldMapper ;
55
- import org .opensearch .index .mapper .MapperService ;
56
53
import org .opensearch .index .mapper .SeqNoFieldMapper ;
57
54
import org .opensearch .index .mapper .SourceFieldMapper ;
58
- import org .opensearch .index .mapper .Uid ;
59
55
import org .opensearch .index .translog .Translog ;
60
56
61
57
import java .io .Closeable ;
@@ -77,7 +73,6 @@ final class LuceneChangesSnapshot implements Translog.Snapshot {
77
73
private final boolean requiredFullRange ;
78
74
79
75
private final IndexSearcher indexSearcher ;
80
- private final MapperService mapperService ;
81
76
private int docIndex = 0 ;
82
77
private final int totalHits ;
83
78
private ScoreDoc [] scoreDocs ;
@@ -88,20 +83,13 @@ final class LuceneChangesSnapshot implements Translog.Snapshot {
88
83
* Creates a new "translog" snapshot from Lucene for reading operations whose seq# in the specified range.
89
84
*
90
85
* @param engineSearcher the internal engine searcher which will be taken over if the snapshot is opened successfully
91
- * @param mapperService the mapper service which will be mainly used to resolve the document's type and uid
92
86
* @param searchBatchSize the number of documents should be returned by each search
93
87
* @param fromSeqNo the min requesting seq# - inclusive
94
88
* @param toSeqNo the maximum requesting seq# - inclusive
95
89
* @param requiredFullRange if true, the snapshot will strictly check for the existence of operations between fromSeqNo and toSeqNo
96
90
*/
97
- LuceneChangesSnapshot (
98
- Engine .Searcher engineSearcher ,
99
- MapperService mapperService ,
100
- int searchBatchSize ,
101
- long fromSeqNo ,
102
- long toSeqNo ,
103
- boolean requiredFullRange
104
- ) throws IOException {
91
+ LuceneChangesSnapshot (Engine .Searcher engineSearcher , int searchBatchSize , long fromSeqNo , long toSeqNo , boolean requiredFullRange )
92
+ throws IOException {
105
93
if (fromSeqNo < 0 || toSeqNo < 0 || fromSeqNo > toSeqNo ) {
106
94
throw new IllegalArgumentException ("Invalid range; from_seqno [" + fromSeqNo + "], to_seqno [" + toSeqNo + "]" );
107
95
}
@@ -114,7 +102,6 @@ final class LuceneChangesSnapshot implements Translog.Snapshot {
114
102
IOUtils .close (engineSearcher );
115
103
}
116
104
};
117
- this .mapperService = mapperService ;
118
105
final long requestingSize = (toSeqNo - fromSeqNo ) == Long .MAX_VALUE ? Long .MAX_VALUE : (toSeqNo - fromSeqNo + 1L );
119
106
this .searchBatchSize = requestingSize < searchBatchSize ? Math .toIntExact (requestingSize ) : searchBatchSize ;
120
107
this .fromSeqNo = fromSeqNo ;
@@ -278,19 +265,17 @@ private Translog.Operation readDocAsOp(int docIndex) throws IOException {
278
265
: SourceFieldMapper .NAME ;
279
266
final FieldsVisitor fields = new FieldsVisitor (true , sourceField );
280
267
leaf .reader ().document (segmentDocID , fields );
281
- fields .postProcess (mapperService );
282
268
283
269
final Translog .Operation op ;
284
270
final boolean isTombstone = parallelArray .isTombStone [docIndex ];
285
- if (isTombstone && fields .uid () == null ) {
271
+ if (isTombstone && fields .id () == null ) {
286
272
op = new Translog .NoOp (seqNo , primaryTerm , fields .source ().utf8ToString ());
287
273
assert version == 1L : "Noop tombstone should have version 1L; actual version [" + version + "]" ;
288
274
assert assertDocSoftDeleted (leaf .reader (), segmentDocID ) : "Noop but soft_deletes field is not set [" + op + "]" ;
289
275
} else {
290
- final String id = fields .uid ().id ();
291
- final Term uid = new Term (IdFieldMapper .NAME , Uid .encodeId (id ));
276
+ final String id = fields .id ();
292
277
if (isTombstone ) {
293
- op = new Translog .Delete (id , uid , seqNo , primaryTerm , version );
278
+ op = new Translog .Delete (id , seqNo , primaryTerm , version );
294
279
assert assertDocSoftDeleted (leaf .reader (), segmentDocID ) : "Delete op but soft_deletes field is not set [" + op + "]" ;
295
280
} else {
296
281
final BytesReference source = fields .source ();
0 commit comments