Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-27636

The "CREATE_TIME_TS" value of the hfile generated by the HFileOutputFormat2 class is 0

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      When HFileOutputFormat2 is used to create an hfile, the CREATE_TIME_TS of hfileinfo will not be assigned when creating an hfileContext, resulting in the value of  lastMajorCompactionAge  is the timestamp of the current time.

      ##HFileOutputFormat2.class
      HFileContextBuilder contextBuilder = new HFileContextBuilder()
                                  .withCompression(compression)
                                  .withChecksumType(HStore.getChecksumType(conf))
                                  .withBytesPerCheckSum(HStore.getBytesPerChecksum(conf))
                                  .withBlockSize(blockSize);
      
      ##get lastMajorCompactionTs metric
      
        lastMajorCompactionTs = this.region.getOldestHfileTs(true);
      ...
        long now = EnvironmentEdgeManager.currentTime();
        return now - lastMajorCompactionTs;
      ...
      ##
      public long getOldestHfileTs(boolean majorCompactionOnly) throws IOException {
        long result = Long.MAX_VALUE;
        for (HStore store : stores.values()) {
          Collection<HStoreFile> storeFiles = store.getStorefiles();
         ...
          for (HStoreFile file : storeFiles) {
            StoreFileReader sfReader = file.getReader();
           ...
            result = Math.min(result, reader.getFileContext().getFileCreateTime());
          }
        }
        return result == Long.MAX_VALUE ? 0 : result;
      }

       

       

      Attachments

        Activity

          People

            selina.yan selina.yan
            selina.yan selina.yan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: