[ 
https://issues.apache.org/jira/browse/HBASE-17330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15756766#comment-15756766
 ] 

Jianwei Cui commented on HBASE-17330:
-------------------------------------

In {{SnapshotFileCache#refreshCache}}, the modify time of snapshot tmp 
directory will also be considered as:
{code}
    // get the status of the snapshots temporary directory and check if it has 
changes
    // The top-level directory timestamp is not updated, so we have to check 
the inner-level.
    try {
      Path snapshotTmpDir = new Path(snapshotDir, 
SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME);
      FileStatus tempDirStatus = fs.getFileStatus(snapshotTmpDir);
      lastTimestamp = Math.min(lastTimestamp, 
tempDirStatus.getModificationTime());
      hasChanges |= (lastTimestamp >= lastModifiedTime);
      ...
    } catch (FileNotFoundException e) {
      // Nothing todo, if the tmp dir is empty
    }
{code}
It seems the in-progress snapshots under tmp directory won't be loaded in 
{{SnapshotFileCache#refreshCache}} after 
[HBASE-12627|https://issues.apache.org/jira/browse/HBASE-12627], so do not need 
to consider modify time of tmp directory in {{SnapshotFileCache#refreshCache}}?

> SnapshotFileCache will always refresh the file cache
> ----------------------------------------------------
>
>                 Key: HBASE-17330
>                 URL: https://issues.apache.org/jira/browse/HBASE-17330
>             Project: HBase
>          Issue Type: Bug
>          Components: snapshots
>    Affects Versions: 2.0.0, 1.3.1, 0.98.23
>            Reporter: Jianwei Cui
>            Priority: Minor
>         Attachments: HBASE-17330-v1.patch
>
>
> In {{SnapshotFileCache#refreshCache}}, the {{hasChanges}} will be judged as:
> {code}
>     try {
>       FileStatus dirStatus = fs.getFileStatus(snapshotDir);
>       lastTimestamp = dirStatus.getModificationTime();
>       hasChanges |= (lastTimestamp >= lastModifiedTime); // >= will make 
> hasChanges always be true
> {code}
> The  {{(lastTimestamp >= lastModifiedTime)}} will make {{hasChanges}} always 
> be true because {{lastTimestamp}} will be updated as:
> {code}
> this.lastModifiedTime = lastTimestamp;
> {code}
> So, SnapshotFileCache will always refresh the file cache.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to