[
https://issues.apache.org/jira/browse/HIVE-17563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16173641#comment-16173641
]
Sahil Takiar commented on HIVE-17563:
-------------------------------------
Yes, it creates a {{ProxyLocalFileSystem}}. I agree HIVE-13705 is suspicious, I
think it was done in order to make the {{LocaFileSystem}} consist with the
{{DistributedFileSystem}}. The {{DistributedFileSystem}} is used for accessing
HDFS, and when it renames a file and the dst already exists, then it returns
false. So the {{ProxyLocalFileSystem}} was introduced to make the
{{LocaFileSystem}} consistent HDFS.
Ideally, we should have just changed the {{LocaFileSystem}} itself, there is
some discussion in HDFS-10385 on why that was never done.
I think we can just use the Java APIs to rename this file,
{{File.renameTo(File)}} should be sufficient, but we should check whether the
call to {{renameTo}} returns {{true}} or {{false}}. If it returns {{false}} we
can throw an exception.
This is similar to what the {{LocaFileSystem#rename}} method is doing under the
hood (see
https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java#L354).
> CodahaleMetrics.JsonFileReporter is not updating
> hive.service.metrics.file.location
> -----------------------------------------------------------------------------------
>
> Key: HIVE-17563
> URL: https://issues.apache.org/jira/browse/HIVE-17563
> Project: Hive
> Issue Type: Bug
> Reporter: Sahil Takiar
> Assignee: Alexander Kolbasov
>
> The {{JsonFileReporter}} has a bug where it never updates the content of
> {{hive.service.metrics.file.location}}. The original implementation relied on
> {{fs.rename}} to overwrite the file if it already existed, but after
> HIVE-13705 {{fs.rename}} now returns {{false}} if the destination file exists.
> Also, there is no reason for the {{JsonFileReporter}} to write to any fs
> besides the local filesystem, so we should make this local fs specific.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)