hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhijie Shen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (YARN-2996) Refine some fs operations in FileSystemRMStateStore to improve performance
Date Mon, 05 Jan 2015 18:52:35 GMT

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

Zhijie Shen commented on YARN-2996:
-----------------------------------

bq. we can merge them to save one RPC call

It sounds a good idea

bq. we can reduce one rename operation.

This will affect the mechanism that we use *.new* file to recover the actual state file  when
recovering RM. It needs to be take care of, too. Perhaps we can't simply remove the logic
to recover actual state file from *.new* file, and I can think of a rare incompatible issue.
See the following procedure:

1. Old FS RMStateStore writes state file and fails after .new file is created.
2. RM stops.
3. RM is upgraded and so does FS RMStateStore.
4. RM starts again.
5. New FS RMStateStore will not recover *.new* file, and may mistake it as a normal file.

> Refine some fs operations in FileSystemRMStateStore to improve performance
> --------------------------------------------------------------------------
>
>                 Key: YARN-2996
>                 URL: https://issues.apache.org/jira/browse/YARN-2996
>             Project: Hadoop YARN
>          Issue Type: Improvement
>          Components: resourcemanager
>            Reporter: Yi Liu
>            Assignee: Yi Liu
>         Attachments: YARN-2996.001.patch
>
>
> In {{FileSystemRMStateStore}}, we can refine some fs operations to improve performance:
> *1.* There are several places invoke {{fs.exists}}, then {{fs.getFileStatus}}, we can
merge them to save one RPC call
> {code}
> if (fs.exists(versionNodePath)) {
>     FileStatus status = fs.getFileStatus(versionNodePath);
> {code}
> *2.*
> {code}
> protected void updateFile(Path outputPath, byte[] data) throws Exception {
>   Path newPath = new Path(outputPath.getParent(), outputPath.getName() + ".new");
>   // use writeFile to make sure .new file is created atomically
>   writeFile(newPath, data);
>   replaceFile(newPath, outputPath);
> }
> {code}
> The {{updateFile}} is not good too, it write file to _output\_file_.tmp, then rename
to _output\_file_.new, then rename it to _output\_file_, we can reduce one rename operation.
> Also there is one unnecessary import, we can remove it.



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

Mime
View raw message