001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.regionserver;
019
020import static org.apache.hadoop.hbase.regionserver.HStoreFile.BLOOM_FILTER_TYPE_KEY;
021import static org.apache.hadoop.hbase.regionserver.HStoreFile.DELETE_FAMILY_COUNT;
022import static org.apache.hadoop.hbase.regionserver.HStoreFile.LAST_BLOOM_KEY;
023
024import java.io.DataInput;
025import java.io.IOException;
026import java.util.Map;
027import java.util.Optional;
028import java.util.SortedSet;
029import java.util.concurrent.atomic.AtomicInteger;
030
031import org.apache.hadoop.conf.Configuration;
032import org.apache.hadoop.fs.FileSystem;
033import org.apache.hadoop.fs.Path;
034import org.apache.hadoop.hbase.Cell;
035import org.apache.hadoop.hbase.CellComparator;
036import org.apache.hadoop.hbase.HBaseInterfaceAudience;
037import org.apache.hadoop.hbase.HConstants;
038import org.apache.hadoop.hbase.PrivateCellUtil;
039import org.apache.hadoop.hbase.KeyValue;
040import org.apache.hadoop.hbase.client.Scan;
041import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
042import org.apache.hadoop.hbase.io.TimeRange;
043import org.apache.hadoop.hbase.io.hfile.BlockType;
044import org.apache.hadoop.hbase.io.hfile.CacheConfig;
045import org.apache.hadoop.hbase.io.hfile.HFile;
046import org.apache.hadoop.hbase.io.hfile.HFileBlock;
047import org.apache.hadoop.hbase.io.hfile.HFileScanner;
048import org.apache.hadoop.hbase.nio.ByteBuff;
049import org.apache.hadoop.hbase.util.BloomFilter;
050import org.apache.hadoop.hbase.util.BloomFilterFactory;
051import org.apache.hadoop.hbase.util.Bytes;
052import org.apache.yetus.audience.InterfaceAudience;
053import org.apache.yetus.audience.InterfaceStability;
054import org.slf4j.Logger;
055import org.slf4j.LoggerFactory;
056import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
057
058/**
059 * Reader for a StoreFile.
060 */
061@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.PHOENIX)
062@InterfaceStability.Evolving
063public class StoreFileReader {
064  private static final Logger LOG = LoggerFactory.getLogger(StoreFileReader.class.getName());
065
066  protected BloomFilter generalBloomFilter = null;
067  protected BloomFilter deleteFamilyBloomFilter = null;
068  protected BloomType bloomFilterType;
069  private final HFile.Reader reader;
070  protected long sequenceID = -1;
071  protected TimeRange timeRange = null;
072  private byte[] lastBloomKey;
073  private long deleteFamilyCnt = -1;
074  private boolean bulkLoadResult = false;
075  private KeyValue.KeyOnlyKeyValue lastBloomKeyOnlyKV = null;
076  private boolean skipResetSeqId = true;
077
078  // Counter that is incremented every time a scanner is created on the
079  // store file. It is decremented when the scan on the store file is
080  // done. All StoreFileReader for the same StoreFile will share this counter.
081  private final AtomicInteger refCount;
082
083  // indicate that whether this StoreFileReader is shared, i.e., used for pread. If not, we will
084  // close the internal reader when readCompleted is called.
085  @VisibleForTesting
086  final boolean shared;
087
088  private StoreFileReader(HFile.Reader reader, AtomicInteger refCount, boolean shared) {
089    this.reader = reader;
090    bloomFilterType = BloomType.NONE;
091    this.refCount = refCount;
092    this.shared = shared;
093  }
094
095  public StoreFileReader(FileSystem fs, Path path, CacheConfig cacheConf,
096      boolean primaryReplicaStoreFile, AtomicInteger refCount, boolean shared, Configuration conf)
097      throws IOException {
098    this(HFile.createReader(fs, path, cacheConf, primaryReplicaStoreFile, conf), refCount, shared);
099  }
100
101  public StoreFileReader(FileSystem fs, Path path, FSDataInputStreamWrapper in, long size,
102      CacheConfig cacheConf, boolean primaryReplicaStoreFile, AtomicInteger refCount,
103      boolean shared, Configuration conf) throws IOException {
104    this(HFile.createReader(fs, path, in, size, cacheConf, primaryReplicaStoreFile, conf), refCount,
105        shared);
106  }
107
108  void copyFields(StoreFileReader reader) {
109    this.generalBloomFilter = reader.generalBloomFilter;
110    this.deleteFamilyBloomFilter = reader.deleteFamilyBloomFilter;
111    this.bloomFilterType = reader.bloomFilterType;
112    this.sequenceID = reader.sequenceID;
113    this.timeRange = reader.timeRange;
114    this.lastBloomKey = reader.lastBloomKey;
115    this.bulkLoadResult = reader.bulkLoadResult;
116    this.lastBloomKeyOnlyKV = reader.lastBloomKeyOnlyKV;
117    this.skipResetSeqId = reader.skipResetSeqId;
118  }
119
120  public boolean isPrimaryReplicaReader() {
121    return reader.isPrimaryReplicaReader();
122  }
123
124  /**
125   * ONLY USE DEFAULT CONSTRUCTOR FOR UNIT TESTS
126   */
127  @VisibleForTesting
128  StoreFileReader() {
129    this.refCount = new AtomicInteger(0);
130    this.reader = null;
131    this.shared = false;
132  }
133
134  public CellComparator getComparator() {
135    return reader.getComparator();
136  }
137
138  /**
139   * Get a scanner to scan over this StoreFile.
140   * @param cacheBlocks should this scanner cache blocks?
141   * @param pread use pread (for highly concurrent small readers)
142   * @param isCompaction is scanner being used for compaction?
143   * @param scannerOrder Order of this scanner relative to other scanners. See
144   *          {@link KeyValueScanner#getScannerOrder()}.
145   * @param canOptimizeForNonNullColumn {@code true} if we can make sure there is no null column,
146   *          otherwise {@code false}. This is a hint for optimization.
147   * @return a scanner
148   */
149  public StoreFileScanner getStoreFileScanner(boolean cacheBlocks, boolean pread,
150      boolean isCompaction, long readPt, long scannerOrder, boolean canOptimizeForNonNullColumn) {
151    // Increment the ref count
152    refCount.incrementAndGet();
153    return new StoreFileScanner(this, getScanner(cacheBlocks, pread, isCompaction),
154        !isCompaction, reader.hasMVCCInfo(), readPt, scannerOrder, canOptimizeForNonNullColumn);
155  }
156
157  /**
158   * Indicate that the scanner has finished reading with this reader. We need to decrement the ref
159   * count, and also, if this is not the common pread reader, we should close it.
160   */
161  void readCompleted() {
162    refCount.decrementAndGet();
163    if (!shared) {
164      try {
165        reader.close(false);
166      } catch (IOException e) {
167        LOG.warn("failed to close stream reader", e);
168      }
169    }
170  }
171
172  /**
173   * @deprecated Do not write further code which depends on this call. Instead
174   *   use getStoreFileScanner() which uses the StoreFileScanner class/interface
175   *   which is the preferred way to scan a store with higher level concepts.
176   *
177   * @param cacheBlocks should we cache the blocks?
178   * @param pread use pread (for concurrent small readers)
179   * @return the underlying HFileScanner
180   */
181  @Deprecated
182  public HFileScanner getScanner(boolean cacheBlocks, boolean pread) {
183    return getScanner(cacheBlocks, pread, false);
184  }
185
186  /**
187   * @deprecated Do not write further code which depends on this call. Instead
188   *   use getStoreFileScanner() which uses the StoreFileScanner class/interface
189   *   which is the preferred way to scan a store with higher level concepts.
190   *
191   * @param cacheBlocks
192   *          should we cache the blocks?
193   * @param pread
194   *          use pread (for concurrent small readers)
195   * @param isCompaction
196   *          is scanner being used for compaction?
197   * @return the underlying HFileScanner
198   */
199  @Deprecated
200  public HFileScanner getScanner(boolean cacheBlocks, boolean pread,
201      boolean isCompaction) {
202    return reader.getScanner(cacheBlocks, pread, isCompaction);
203  }
204
205  public void close(boolean evictOnClose) throws IOException {
206    reader.close(evictOnClose);
207  }
208
209  /**
210   * Check if this storeFile may contain keys within the TimeRange that
211   * have not expired (i.e. not older than oldestUnexpiredTS).
212   * @param timeRange the timeRange to restrict
213   * @param oldestUnexpiredTS the oldest timestamp that is not expired, as
214   *          determined by the column family's TTL
215   * @return false if queried keys definitely don't exist in this StoreFile
216   */
217  boolean passesTimerangeFilter(TimeRange tr, long oldestUnexpiredTS) {
218    return this.timeRange == null? true:
219      this.timeRange.includesTimeRange(tr) && this.timeRange.getMax() >= oldestUnexpiredTS;
220  }
221
222  /**
223   * Checks whether the given scan passes the Bloom filter (if present). Only
224   * checks Bloom filters for single-row or single-row-column scans. Bloom
225   * filter checking for multi-gets is implemented as part of the store
226   * scanner system (see {@link StoreFileScanner#seek(Cell)} and uses
227   * the lower-level API {@link #passesGeneralRowBloomFilter(byte[], int, int)}
228   * and {@link #passesGeneralRowColBloomFilter(Cell)}.
229   *
230   * @param scan the scan specification. Used to determine the row, and to
231   *          check whether this is a single-row ("get") scan.
232   * @param columns the set of columns. Only used for row-column Bloom
233   *          filters.
234   * @return true if the scan with the given column set passes the Bloom
235   *         filter, or if the Bloom filter is not applicable for the scan.
236   *         False if the Bloom filter is applicable and the scan fails it.
237   */
238  boolean passesBloomFilter(Scan scan, final SortedSet<byte[]> columns) {
239    // Multi-column non-get scans will use Bloom filters through the
240    // lower-level API function that this function calls.
241    if (!scan.isGetScan()) {
242      return true;
243    }
244
245    byte[] row = scan.getStartRow();
246    switch (this.bloomFilterType) {
247      case ROW:
248        return passesGeneralRowBloomFilter(row, 0, row.length);
249
250      case ROWCOL:
251        if (columns != null && columns.size() == 1) {
252          byte[] column = columns.first();
253          // create the required fake key
254          Cell kvKey = PrivateCellUtil.createFirstOnRow(row, HConstants.EMPTY_BYTE_ARRAY, column);
255          return passesGeneralRowColBloomFilter(kvKey);
256        }
257
258        // For multi-column queries the Bloom filter is checked from the
259        // seekExact operation.
260        return true;
261
262      default:
263        return true;
264    }
265  }
266
267  public boolean passesDeleteFamilyBloomFilter(byte[] row, int rowOffset,
268      int rowLen) {
269    // Cache Bloom filter as a local variable in case it is set to null by
270    // another thread on an IO error.
271    BloomFilter bloomFilter = this.deleteFamilyBloomFilter;
272
273    // Empty file or there is no delete family at all
274    if (reader.getTrailer().getEntryCount() == 0 || deleteFamilyCnt == 0) {
275      return false;
276    }
277
278    if (bloomFilter == null) {
279      return true;
280    }
281
282    try {
283      if (!bloomFilter.supportsAutoLoading()) {
284        return true;
285      }
286      return bloomFilter.contains(row, rowOffset, rowLen, null);
287    } catch (IllegalArgumentException e) {
288      LOG.error("Bad Delete Family bloom filter data -- proceeding without",
289          e);
290      setDeleteFamilyBloomFilterFaulty();
291    }
292
293    return true;
294  }
295
296  /**
297   * A method for checking Bloom filters. Called directly from
298   * StoreFileScanner in case of a multi-column query.
299   *
300   * @return True if passes
301   */
302  public boolean passesGeneralRowBloomFilter(byte[] row, int rowOffset, int rowLen) {
303    BloomFilter bloomFilter = this.generalBloomFilter;
304    if (bloomFilter == null) {
305      return true;
306    }
307
308    // Used in ROW bloom
309    byte[] key = null;
310    if (rowOffset != 0 || rowLen != row.length) {
311      throw new AssertionError(
312          "For row-only Bloom filters the row " + "must occupy the whole array");
313    }
314    key = row;
315    return checkGeneralBloomFilter(key, null, bloomFilter);
316  }
317
318  /**
319   * A method for checking Bloom filters. Called directly from
320   * StoreFileScanner in case of a multi-column query.
321   *
322   * @param cell
323   *          the cell to check if present in BloomFilter
324   * @return True if passes
325   */
326  public boolean passesGeneralRowColBloomFilter(Cell cell) {
327    BloomFilter bloomFilter = this.generalBloomFilter;
328    if (bloomFilter == null) {
329      return true;
330    }
331    // Used in ROW_COL bloom
332    Cell kvKey = null;
333    // Already if the incoming key is a fake rowcol key then use it as it is
334    if (cell.getTypeByte() == KeyValue.Type.Maximum.getCode() && cell.getFamilyLength() == 0) {
335      kvKey = cell;
336    } else {
337      kvKey = PrivateCellUtil.createFirstOnRowCol(cell);
338    }
339    return checkGeneralBloomFilter(null, kvKey, bloomFilter);
340  }
341
342  private boolean checkGeneralBloomFilter(byte[] key, Cell kvKey, BloomFilter bloomFilter) {
343    // Empty file
344    if (reader.getTrailer().getEntryCount() == 0) {
345      return false;
346    }
347    HFileBlock bloomBlock = null;
348    try {
349      boolean shouldCheckBloom;
350      ByteBuff bloom;
351      if (bloomFilter.supportsAutoLoading()) {
352        bloom = null;
353        shouldCheckBloom = true;
354      } else {
355        bloomBlock = reader.getMetaBlock(HFile.BLOOM_FILTER_DATA_KEY, true);
356        bloom = bloomBlock.getBufferWithoutHeader();
357        shouldCheckBloom = bloom != null;
358      }
359
360      if (shouldCheckBloom) {
361        boolean exists;
362
363        // Whether the primary Bloom key is greater than the last Bloom key
364        // from the file info. For row-column Bloom filters this is not yet
365        // a sufficient condition to return false.
366        boolean keyIsAfterLast = (lastBloomKey != null);
367        // hbase:meta does not have blooms. So we need not have special interpretation
368        // of the hbase:meta cells.  We can safely use Bytes.BYTES_RAWCOMPARATOR for ROW Bloom
369        if (keyIsAfterLast) {
370          if (bloomFilterType == BloomType.ROW) {
371            keyIsAfterLast = (Bytes.BYTES_RAWCOMPARATOR.compare(key, lastBloomKey) > 0);
372          } else {
373            keyIsAfterLast = (CellComparator.getInstance().compare(kvKey, lastBloomKeyOnlyKV)) > 0;
374          }
375        }
376
377        if (bloomFilterType == BloomType.ROWCOL) {
378          // Since a Row Delete is essentially a DeleteFamily applied to all
379          // columns, a file might be skipped if using row+col Bloom filter.
380          // In order to ensure this file is included an additional check is
381          // required looking only for a row bloom.
382          Cell rowBloomKey = PrivateCellUtil.createFirstOnRow(kvKey);
383          // hbase:meta does not have blooms. So we need not have special interpretation
384          // of the hbase:meta cells.  We can safely use Bytes.BYTES_RAWCOMPARATOR for ROW Bloom
385          if (keyIsAfterLast
386              && (CellComparator.getInstance().compare(rowBloomKey, lastBloomKeyOnlyKV)) > 0) {
387            exists = false;
388          } else {
389            exists =
390                bloomFilter.contains(kvKey, bloom, BloomType.ROWCOL) ||
391                bloomFilter.contains(rowBloomKey, bloom, BloomType.ROWCOL);
392          }
393        } else {
394          exists = !keyIsAfterLast
395              && bloomFilter.contains(key, 0, key.length, bloom);
396        }
397
398        return exists;
399      }
400    } catch (IOException e) {
401      LOG.error("Error reading bloom filter data -- proceeding without",
402          e);
403      setGeneralBloomFilterFaulty();
404    } catch (IllegalArgumentException e) {
405      LOG.error("Bad bloom filter data -- proceeding without", e);
406      setGeneralBloomFilterFaulty();
407    } finally {
408      // Return the bloom block so that its ref count can be decremented.
409      reader.returnBlock(bloomBlock);
410    }
411    return true;
412  }
413
414  /**
415   * Checks whether the given scan rowkey range overlaps with the current storefile's
416   * @param scan the scan specification. Used to determine the rowkey range.
417   * @return true if there is overlap, false otherwise
418   */
419  public boolean passesKeyRangeFilter(Scan scan) {
420    Optional<Cell> firstKeyKV = this.getFirstKey();
421    Optional<Cell> lastKeyKV = this.getLastKey();
422    if (!firstKeyKV.isPresent() || !lastKeyKV.isPresent()) {
423      // the file is empty
424      return false;
425    }
426    if (Bytes.equals(scan.getStartRow(), HConstants.EMPTY_START_ROW) &&
427        Bytes.equals(scan.getStopRow(), HConstants.EMPTY_END_ROW)) {
428      return true;
429    }
430    byte[] smallestScanRow = scan.isReversed() ? scan.getStopRow() : scan.getStartRow();
431    byte[] largestScanRow = scan.isReversed() ? scan.getStartRow() : scan.getStopRow();
432    boolean nonOverLapping = (getComparator()
433        .compareRows(firstKeyKV.get(), largestScanRow, 0, largestScanRow.length) > 0 &&
434        !Bytes.equals(scan.isReversed() ? scan.getStartRow() : scan.getStopRow(),
435          HConstants.EMPTY_END_ROW)) ||
436        getComparator().compareRows(lastKeyKV.get(), smallestScanRow, 0,
437          smallestScanRow.length) < 0;
438    return !nonOverLapping;
439  }
440
441  public Map<byte[], byte[]> loadFileInfo() throws IOException {
442    Map<byte [], byte []> fi = reader.loadFileInfo();
443
444    byte[] b = fi.get(BLOOM_FILTER_TYPE_KEY);
445    if (b != null) {
446      bloomFilterType = BloomType.valueOf(Bytes.toString(b));
447    }
448
449    lastBloomKey = fi.get(LAST_BLOOM_KEY);
450    if(bloomFilterType == BloomType.ROWCOL) {
451      lastBloomKeyOnlyKV = new KeyValue.KeyOnlyKeyValue(lastBloomKey, 0, lastBloomKey.length);
452    }
453    byte[] cnt = fi.get(DELETE_FAMILY_COUNT);
454    if (cnt != null) {
455      deleteFamilyCnt = Bytes.toLong(cnt);
456    }
457
458    return fi;
459  }
460
461  public void loadBloomfilter() {
462    this.loadBloomfilter(BlockType.GENERAL_BLOOM_META);
463    this.loadBloomfilter(BlockType.DELETE_FAMILY_BLOOM_META);
464  }
465
466  public void loadBloomfilter(BlockType blockType) {
467    try {
468      if (blockType == BlockType.GENERAL_BLOOM_META) {
469        if (this.generalBloomFilter != null)
470          return; // Bloom has been loaded
471
472        DataInput bloomMeta = reader.getGeneralBloomFilterMetadata();
473        if (bloomMeta != null) {
474          // sanity check for NONE Bloom filter
475          if (bloomFilterType == BloomType.NONE) {
476            throw new IOException(
477                "valid bloom filter type not found in FileInfo");
478          } else {
479            generalBloomFilter = BloomFilterFactory.createFromMeta(bloomMeta,
480                reader);
481            if (LOG.isTraceEnabled()) {
482              LOG.trace("Loaded " + bloomFilterType.toString() + " "
483                + generalBloomFilter.getClass().getSimpleName()
484                + " metadata for " + reader.getName());
485            }
486          }
487        }
488      } else if (blockType == BlockType.DELETE_FAMILY_BLOOM_META) {
489        if (this.deleteFamilyBloomFilter != null)
490          return; // Bloom has been loaded
491
492        DataInput bloomMeta = reader.getDeleteBloomFilterMetadata();
493        if (bloomMeta != null) {
494          deleteFamilyBloomFilter = BloomFilterFactory.createFromMeta(
495              bloomMeta, reader);
496          LOG.info("Loaded Delete Family Bloom ("
497              + deleteFamilyBloomFilter.getClass().getSimpleName()
498              + ") metadata for " + reader.getName());
499        }
500      } else {
501        throw new RuntimeException("Block Type: " + blockType.toString()
502            + "is not supported for Bloom filter");
503      }
504    } catch (IOException e) {
505      LOG.error("Error reading bloom filter meta for " + blockType
506          + " -- proceeding without", e);
507      setBloomFilterFaulty(blockType);
508    } catch (IllegalArgumentException e) {
509      LOG.error("Bad bloom filter meta " + blockType
510          + " -- proceeding without", e);
511      setBloomFilterFaulty(blockType);
512    }
513  }
514
515  private void setBloomFilterFaulty(BlockType blockType) {
516    if (blockType == BlockType.GENERAL_BLOOM_META) {
517      setGeneralBloomFilterFaulty();
518    } else if (blockType == BlockType.DELETE_FAMILY_BLOOM_META) {
519      setDeleteFamilyBloomFilterFaulty();
520    }
521  }
522
523  /**
524   * The number of Bloom filter entries in this store file, or an estimate
525   * thereof, if the Bloom filter is not loaded. This always returns an upper
526   * bound of the number of Bloom filter entries.
527   *
528   * @return an estimate of the number of Bloom filter entries in this file
529   */
530  public long getFilterEntries() {
531    return generalBloomFilter != null ? generalBloomFilter.getKeyCount()
532        : reader.getEntries();
533  }
534
535  public void setGeneralBloomFilterFaulty() {
536    generalBloomFilter = null;
537  }
538
539  public void setDeleteFamilyBloomFilterFaulty() {
540    this.deleteFamilyBloomFilter = null;
541  }
542
543  public Optional<Cell> getLastKey() {
544    return reader.getLastKey();
545  }
546
547  public Optional<byte[]> getLastRowKey() {
548    return reader.getLastRowKey();
549  }
550
551  public Optional<Cell> midKey() throws IOException {
552    return reader.midKey();
553  }
554
555  public long length() {
556    return reader.length();
557  }
558
559  public long getTotalUncompressedBytes() {
560    return reader.getTrailer().getTotalUncompressedBytes();
561  }
562
563  public long getEntries() {
564    return reader.getEntries();
565  }
566
567  public long getDeleteFamilyCnt() {
568    return deleteFamilyCnt;
569  }
570
571  public Optional<Cell> getFirstKey() {
572    return reader.getFirstKey();
573  }
574
575  public long indexSize() {
576    return reader.indexSize();
577  }
578
579  public BloomType getBloomFilterType() {
580    return this.bloomFilterType;
581  }
582
583  public long getSequenceID() {
584    return sequenceID;
585  }
586
587  public void setSequenceID(long sequenceID) {
588    this.sequenceID = sequenceID;
589  }
590
591  public void setBulkLoaded(boolean bulkLoadResult) {
592    this.bulkLoadResult = bulkLoadResult;
593  }
594
595  public boolean isBulkLoaded() {
596    return this.bulkLoadResult;
597  }
598
599  BloomFilter getGeneralBloomFilter() {
600    return generalBloomFilter;
601  }
602
603  long getUncompressedDataIndexSize() {
604    return reader.getTrailer().getUncompressedDataIndexSize();
605  }
606
607  public long getTotalBloomSize() {
608    if (generalBloomFilter == null)
609      return 0;
610    return generalBloomFilter.getByteSize();
611  }
612
613  public int getHFileVersion() {
614    return reader.getTrailer().getMajorVersion();
615  }
616
617  public int getHFileMinorVersion() {
618    return reader.getTrailer().getMinorVersion();
619  }
620
621  public HFile.Reader getHFileReader() {
622    return reader;
623  }
624
625  void disableBloomFilterForTesting() {
626    generalBloomFilter = null;
627    this.deleteFamilyBloomFilter = null;
628  }
629
630  public long getMaxTimestamp() {
631    return timeRange == null ? TimeRange.INITIAL_MAX_TIMESTAMP: timeRange.getMax();
632  }
633
634  boolean isSkipResetSeqId() {
635    return skipResetSeqId;
636  }
637
638  void setSkipResetSeqId(boolean skipResetSeqId) {
639    this.skipResetSeqId = skipResetSeqId;
640  }
641}