Yiqun Lin commented on HDFS-12773:

Hi [~elgoiri], thanks for your comments. Comments make sense to me.
{quote}In this approach, we use temporary files for the writes and renaming 
"atomically" to the final value.
 All the implementation is done in the StateStoreFileBaseImpl which instead of 
writing to the final location, it will go to a temporary one and then rename to 
the final destination.
Why not document this in javadoc of {{StateStoreFileBaseImpl}}? This will be 
good understanding for users.
{quote}It could be fixed by checking monotonicNow() in testTempOld() but that's 
not correct because multiple Routers need to check for that timestamp.
 I'm reverting that one back to now().
A good way should update {{now()}} to {{monotonicNow()}} both in 
{{StateStoreFileBaseImpl#putAll}} and 
{{StateStoreFileBaseImpl#isOldTempRecord}}, instead of reverting that one.

In *StateStoreFileSystemImpl.java*,
  protected boolean rename(String src, String dst) {
    try {
      if (fs instanceof DistributedFileSystem) {
      } else {
        // Replace should be atomic but not available
        if (fs.exists(new Path(dst))) {
          fs.delete(new Path(dst), false);
        return fs.rename(new Path(src), new Path(dst));
The second parameter passed in delete operation would be bettter to use 
{{true}}. That mean we will recursively delete all files under given dir.

> RBF: Improve State Store FS implementation
> ------------------------------------------
>                 Key: HDFS-12773
>                 URL: https://issues.apache.org/jira/browse/HDFS-12773
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Íñigo Goiri
>            Assignee: Íñigo Goiri
>            Priority: Major
>         Attachments: HDFS-12773.000.patch, HDFS-12773.001.patch, 
> HDFS-12773.002.patch, HDFS-12773.003.patch, HDFS-12773.004.patch, 
> HDFS-12773.005.patch, HDFS-12773.006.patch
> HDFS-10630 introduced a filesystem implementation of the State Store for unit 
> tests. However, this implementation doesn't handle multiple writers 
> concurrently.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to