@@ -42,15 +42,6 @@ public abstract class MultiLevelSkipListReader implements Closeable {
42
42
/** number of levels in this skip list */
43
43
protected int numberOfSkipLevels ;
44
44
45
- // Expert: defines the number of top skip levels to buffer in memory.
46
- // Reducing this number results in less memory usage, but possibly
47
- // slower performance due to more random I/Os.
48
- // Please notice that the space each level occupies is limited by
49
- // the skipInterval. The top level can not contain more than
50
- // skipLevel entries, the second top level can not contain more
51
- // than skipLevel^2 entries and so forth.
52
- private int numberOfLevelsToBuffer = 1 ;
53
-
54
45
private int docCount ;
55
46
56
47
/** skipStream for each level. */
@@ -219,25 +210,18 @@ private void loadSkipLevels() throws IOException {
219
210
220
211
skipStream [0 ].seek (skipPointer [0 ]);
221
212
222
- int toBuffer = numberOfLevelsToBuffer ;
223
-
224
213
for (int i = numberOfSkipLevels - 1 ; i > 0 ; i --) {
225
214
// the length of the current level
226
215
long length = readLevelLength (skipStream [0 ]);
227
216
228
217
// the start pointer of the current level
229
218
skipPointer [i ] = skipStream [0 ].getFilePointer ();
230
- if (toBuffer > 0 ) {
231
- // buffer this level
232
- skipStream [i ] = new SkipBuffer (skipStream [0 ], (int ) length );
233
- toBuffer --;
234
- } else {
235
- // clone this stream, it is already at the start of the current level
236
- skipStream [i ] = skipStream [0 ].clone ();
237
219
238
- // move base stream beyond the current level
239
- skipStream [0 ].seek (skipStream [0 ].getFilePointer () + length );
240
- }
220
+ // clone this stream, it is already at the start of the current level
221
+ skipStream [i ] = skipStream [0 ].clone ();
222
+
223
+ // move base stream beyond the current level
224
+ skipStream [0 ].seek (skipStream [0 ].getFilePointer () + length );
241
225
}
242
226
243
227
// use base stream for the lowest level
@@ -279,54 +263,4 @@ protected void setLastSkipData(int level) {
279
263
lastDoc = skipDoc [level ];
280
264
lastChildPointer = childPointer [level ];
281
265
}
282
-
283
- /** used to buffer the top skip levels */
284
- private static final class SkipBuffer extends IndexInput {
285
- private byte [] data ;
286
- private long pointer ;
287
- private int pos ;
288
-
289
- SkipBuffer (IndexInput input , int length ) throws IOException {
290
- super ("SkipBuffer on " + input );
291
- data = new byte [length ];
292
- pointer = input .getFilePointer ();
293
- input .readBytes (data , 0 , length );
294
- }
295
-
296
- @ Override
297
- public void close () {
298
- data = null ;
299
- }
300
-
301
- @ Override
302
- public long getFilePointer () {
303
- return pointer + pos ;
304
- }
305
-
306
- @ Override
307
- public long length () {
308
- return data .length ;
309
- }
310
-
311
- @ Override
312
- public byte readByte () {
313
- return data [pos ++];
314
- }
315
-
316
- @ Override
317
- public void readBytes (byte [] b , int offset , int len ) {
318
- System .arraycopy (data , pos , b , offset , len );
319
- pos += len ;
320
- }
321
-
322
- @ Override
323
- public void seek (long pos ) {
324
- this .pos = (int ) (pos - pointer );
325
- }
326
-
327
- @ Override
328
- public IndexInput slice (String sliceDescription , long offset , long length ) throws IOException {
329
- throw new UnsupportedOperationException ();
330
- }
331
- }
332
266
}
0 commit comments