[ 
https://issues.apache.org/jira/browse/PHOENIX-6955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

selina.yan updated PHOENIX-6955:
--------------------------------
    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.
{code:java}
HFileContextBuilder contextBuilder = new HFileContextBuilder()
                        .withCompression(compression)
                        .withChecksumType(CompatUtil.getChecksumType(conf))
                        
.withBytesPerCheckSum(CompatUtil.getBytesPerChecksum(conf))
                        .withBlockSize(blockSize)
                        .withDataBlockEncoding(encoding)
                        .withCellComparator(CellComparatorImpl.COMPARATOR);

##get lastMajorCompactionTs metriclastMajorCompactionTs = 
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();{code}

  was:
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.
{code:java}
##MultiHfileOutputFormat.getNewWriter 
              HFileContextBuilder contextBuilder = new HFileContextBuilder()
                                        .withCompression(compression)
                                       
.withChecksumType(CompatUtil.getChecksumType(conf))                             
   .withBytesPerCheckSum(CompatUtil.getBytesPerChecksum(conf))
                                        .withBlockSize(blockSize)
                                        .withDataBlockEncoding(encoding)        
                                
.withCellComparator(CellComparatorImpl.COMPARATOR);

{code}


> The value of region  metric--lastMajorCompactionAge is wrong,when the hfile 
> is buckload file
> --------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6955
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6955
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: selina.yan
>            Priority: Major
>
> 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.
> {code:java}
> HFileContextBuilder contextBuilder = new HFileContextBuilder()
>                         .withCompression(compression)
>                         .withChecksumType(CompatUtil.getChecksumType(conf))
>                         
> .withBytesPerCheckSum(CompatUtil.getBytesPerChecksum(conf))
>                         .withBlockSize(blockSize)
>                         .withDataBlockEncoding(encoding)
>                         .withCellComparator(CellComparatorImpl.COMPARATOR);
> ##get lastMajorCompactionTs metriclastMajorCompactionTs = 
> 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();{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to