Skip to content

Commit 3e0de6d

Browse files
committed
Update after review
1 parent 2ca8a9f commit 3e0de6d

File tree

3 files changed

+6
-57
lines changed

3 files changed

+6
-57
lines changed

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene60/MetadataOnlyBKDReader.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,10 @@ public MetadataOnlyBKDReader(IndexInput metaIn) throws IOException {
9090
pointCount = metaIn.readVLong();
9191
docCount = metaIn.readVInt();
9292

93+
// This code has been introduced to process IndexInput created with Lucene86Codec+
9394
numIndexBytes = metaIn.readVInt();
94-
if (version >= VERSION_META_FILE) {
95-
minLeafBlockFP = metaIn.readLong();
96-
indexStartPointer = metaIn.readLong();
97-
} else {
98-
indexStartPointer = metaIn.getFilePointer();
99-
minLeafBlockFP = metaIn.readVLong();
100-
metaIn.seek(indexStartPointer);
101-
}
95+
minLeafBlockFP = metaIn.readLong();
96+
indexStartPointer = metaIn.readLong();
10297
}
10398

10499
@Override

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene86/Lucene86MetadataOnlyPointsFormat.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,8 @@
3232
**/
3333
public class Lucene86MetadataOnlyPointsFormat extends PointsFormat {
3434

35-
static final String DATA_CODEC_NAME = "Lucene86PointsFormatData";
36-
static final String INDEX_CODEC_NAME = "Lucene86PointsFormatIndex";
3735
static final String META_CODEC_NAME = "Lucene86PointsFormatMeta";
3836

39-
/** Filename extension for the leaf blocks */
40-
public static final String DATA_EXTENSION = "kdd";
41-
42-
/** Filename extension for the index per field */
43-
public static final String INDEX_EXTENSION = "kdi";
44-
4537
/** Filename extension for the meta per field */
4638
public static final String META_EXTENSION = "kdm";
4739

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene86/Lucene86MetadataOnlyPointsReader.java

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.apache.lucene.index.PointValues;
2929
import org.apache.lucene.index.SegmentReadState;
3030
import org.apache.lucene.store.ChecksumIndexInput;
31-
import org.apache.lucene.store.IndexInput;
3231
import org.elasticsearch.core.IOUtils;
3332
import org.elasticsearch.xpack.lucene.bwc.codecs.lucene60.MetadataOnlyBKDReader;
3433

@@ -38,11 +37,9 @@
3837

3938
/** Reads the metadata of point values previously written with Lucene86PointsWriter */
4039
public final class Lucene86MetadataOnlyPointsReader extends PointsReader {
41-
final IndexInput indexIn, dataIn;
4240
final SegmentReadState readState;
4341
final Map<Integer, PointValues> readers = new HashMap<>();
4442

45-
/** Sole constructor */
4643
public Lucene86MetadataOnlyPointsReader(SegmentReadState readState) throws IOException {
4744
this.readState = readState;
4845

@@ -51,39 +48,9 @@ public Lucene86MetadataOnlyPointsReader(SegmentReadState readState) throws IOExc
5148
readState.segmentSuffix,
5249
Lucene86MetadataOnlyPointsFormat.META_EXTENSION
5350
);
54-
String indexFileName = IndexFileNames.segmentFileName(
55-
readState.segmentInfo.name,
56-
readState.segmentSuffix,
57-
Lucene86MetadataOnlyPointsFormat.INDEX_EXTENSION
58-
);
59-
String dataFileName = IndexFileNames.segmentFileName(
60-
readState.segmentInfo.name,
61-
readState.segmentSuffix,
62-
Lucene86MetadataOnlyPointsFormat.DATA_EXTENSION
63-
);
6451

6552
boolean success = false;
6653
try {
67-
indexIn = EndiannessReverserUtil.openInput(readState.directory, indexFileName, readState.context);
68-
CodecUtil.checkIndexHeader(
69-
indexIn,
70-
Lucene86MetadataOnlyPointsFormat.INDEX_CODEC_NAME,
71-
Lucene86MetadataOnlyPointsFormat.VERSION_START,
72-
Lucene86MetadataOnlyPointsFormat.VERSION_CURRENT,
73-
readState.segmentInfo.getId(),
74-
readState.segmentSuffix
75-
);
76-
77-
dataIn = EndiannessReverserUtil.openInput(readState.directory, dataFileName, readState.context);
78-
CodecUtil.checkIndexHeader(
79-
dataIn,
80-
Lucene86MetadataOnlyPointsFormat.DATA_CODEC_NAME,
81-
Lucene86MetadataOnlyPointsFormat.VERSION_START,
82-
Lucene86MetadataOnlyPointsFormat.VERSION_CURRENT,
83-
readState.segmentInfo.getId(),
84-
readState.segmentSuffix
85-
);
86-
8754
long indexLength = -1, dataLength = -1;
8855
try (
8956
ChecksumIndexInput metaIn = EndiannessReverserUtil.openChecksumInput(readState.directory, metaFileName, readState.context)
@@ -117,10 +84,7 @@ public Lucene86MetadataOnlyPointsReader(SegmentReadState readState) throws IOExc
11784
CodecUtil.checkFooter(metaIn, priorE);
11885
}
11986
}
120-
// At this point, checksums of the meta file have been validated so we
121-
// know that indexLength and dataLength are very likely correct.
122-
CodecUtil.retrieveChecksum(indexIn, indexLength);
123-
CodecUtil.retrieveChecksum(dataIn, dataLength);
87+
12488
success = true;
12589
} finally {
12690
if (success == false) {
@@ -143,14 +107,12 @@ public PointValues getValues(String fieldName) {
143107
}
144108

145109
@Override
146-
public void checkIntegrity() throws IOException {
147-
CodecUtil.checksumEntireFile(indexIn);
148-
CodecUtil.checksumEntireFile(dataIn);
110+
public void checkIntegrity() {
111+
;
149112
}
150113

151114
@Override
152115
public void close() throws IOException {
153-
IOUtils.close(indexIn, dataIn);
154116
// Free up heap:
155117
readers.clear();
156118
}

0 commit comments

Comments
 (0)