pengmq1 commented on a change in pull request #1730:
URL: https://github.com/apache/hbase/pull/1730#discussion_r446612226
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
##########
@@ -1564,6 +1568,18 @@ public void
deleteChangedReaderObserver(ChangedReadersObserver o) {
return sfs;
}
+ // Set correct storage policy from the file name of DTCP.
+ // Rename file will not change the storage policy.
+ private void setStoragePolicyFromFileName(List<Path> newFiles) throws
IOException {
+ String prefix = HConstants.STORAGE_POLICY_PREFIX;
+ for (Path newFile : newFiles) {
+ if (newFile.getParent().getName().startsWith(prefix)) {
+ CommonFSUtils.setStoragePolicy(fs.getFileSystem(), newFile,
Review comment:
newFiles是已经compact结束将要被rename到region目录下的文件,但它们的storage
policy还未指定,文件storage policy属性保存在INode中。rename之后,未指定storage
policy的文件自动继承新的父目录。在rename之前调用setStoragePolicy()是为了使数据和storage
policy保持一致,避免storage policy因为继承发生变化。HDFS允许对已经close的文件设置storage policy,
并不会发生数据移动。而且newFiles的数据和临时父目录的storage
policy已经是一致的了(因为在compact之前tmp下已创建了不同存储策略的临时目录)
`newFiles` are files that have been compacted and will be renamed to the
region directory, but their `storage policy` has not been specified. The file
storage policy attribute is saved in INode. After renaming, files that do not
specify a storage policy automatically inherit the new parent directory. Before
renaming call to `setStoragePolicy()` here is to keep the data consistent with
the storage policy and avoid the storage policy changing due to inheritance.
HDFS allows storage policy to be set on files that have been closed, and no
data movement will occur. Moreover, the data of `newFiles` and the storage
policy of tmp parent dir are already consistent (because tmp directories of
different storage strategies have been created under tmp dir before compact).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]