2222import static org .apache .hadoop .hbase .regionserver .HStoreFile .BLOOM_FILTER_TYPE_KEY ;
2323import static org .apache .hadoop .hbase .regionserver .HStoreFile .COMPACTION_EVENT_KEY ;
2424import static org .apache .hadoop .hbase .regionserver .HStoreFile .DELETE_FAMILY_COUNT ;
25- import static org .apache .hadoop .hbase .regionserver .HStoreFile .EARLIEST_PUT_TS ;
2625import static org .apache .hadoop .hbase .regionserver .HStoreFile .HISTORICAL_KEY ;
2726import static org .apache .hadoop .hbase .regionserver .HStoreFile .MAJOR_COMPACTION_KEY ;
2827import static org .apache .hadoop .hbase .regionserver .HStoreFile .MAX_SEQ_ID_KEY ;
2928import static org .apache .hadoop .hbase .regionserver .HStoreFile .MOB_CELLS_COUNT ;
3029import static org .apache .hadoop .hbase .regionserver .HStoreFile .MOB_FILE_REFS ;
31- import static org .apache .hadoop .hbase .regionserver .HStoreFile .TIMERANGE_KEY ;
3230import static org .apache .hadoop .hbase .regionserver .StoreEngine .STORE_ENGINE_CLASS_KEY ;
3331
3432import java .io .IOException ;
5149import org .apache .hadoop .hbase .CellComparator ;
5250import org .apache .hadoop .hbase .CellUtil ;
5351import org .apache .hadoop .hbase .HConstants ;
54- import org .apache .hadoop .hbase .KeyValue ;
5552import org .apache .hadoop .hbase .PrivateCellUtil ;
5653import org .apache .hadoop .hbase .TableName ;
5754import org .apache .hadoop .hbase .client .ColumnFamilyDescriptorBuilder ;
@@ -495,11 +492,9 @@ private static class SingleStoreFileWriter {
495492 private final BloomFilterWriter deleteFamilyBloomFilterWriter ;
496493 private final BloomType bloomType ;
497494 private byte [] bloomParam = null ;
498- private long earliestPutTs = HConstants .LATEST_TIMESTAMP ;
499495 private long deleteFamilyCnt = 0 ;
500496 private BloomContext bloomContext = null ;
501497 private BloomContext deleteFamilyBloomContext = null ;
502- private final TimeRangeTracker timeRangeTracker ;
503498 private final Supplier <Collection <HStoreFile >> compactedFilesSupplier ;
504499
505500 private HFile .Writer writer ;
@@ -523,7 +518,6 @@ private SingleStoreFileWriter(FileSystem fs, Path path, final Configuration conf
523518 HFileContext fileContext , boolean shouldDropCacheBehind ,
524519 Supplier <Collection <HStoreFile >> compactedFilesSupplier ) throws IOException {
525520 this .compactedFilesSupplier = compactedFilesSupplier ;
526- this .timeRangeTracker = TimeRangeTracker .create (TimeRangeTracker .Type .NON_SYNC );
527521 // TODO : Change all writers to be specifically created for compaction context
528522 writer =
529523 HFile .getWriterFactory (conf , cacheConf ).withPath (fs , path ).withFavoredNodes (favoredNodes )
@@ -665,21 +659,7 @@ private void appendMobMetadata(SetMultimap<TableName, String> mobRefSet) throws
665659 * Add TimestampRange and earliest put timestamp to Metadata
666660 */
667661 private void appendTrackedTimestampsToMetadata () throws IOException {
668- // TODO: The StoreFileReader always converts the byte[] to TimeRange
669- // via TimeRangeTracker, so we should write the serialization data of TimeRange directly.
670- appendFileInfo (TIMERANGE_KEY , TimeRangeTracker .toByteArray (timeRangeTracker ));
671- appendFileInfo (EARLIEST_PUT_TS , Bytes .toBytes (earliestPutTs ));
672- }
673-
674- /**
675- * Record the earlest Put timestamp. If the timeRangeTracker is not set, update TimeRangeTracker
676- * to include the timestamp of this key
677- */
678- private void trackTimestamps (final Cell cell ) {
679- if (KeyValue .Type .Put .getCode () == cell .getTypeByte ()) {
680- earliestPutTs = Math .min (earliestPutTs , cell .getTimestamp ());
681- }
682- timeRangeTracker .includeTimestamp (cell );
662+ writer .appendTrackedTimestampsToMetadata ();
683663 }
684664
685665 private void appendGeneralBloomfilter (final Cell cell ) throws IOException {
@@ -710,7 +690,6 @@ private void append(final Cell cell) throws IOException {
710690 appendGeneralBloomfilter (cell );
711691 appendDeleteFamilyBloomFilter (cell );
712692 writer .append (cell );
713- trackTimestamps (cell );
714693 }
715694
716695 private void beforeShipped () throws IOException {
0 commit comments