Skip to content

Conversation

@rakeshadr
Copy link
Contributor

What changes were proposed in this pull request?

This task is to handle rename key path request and make it an atomic operation by updating the DirTable or FileTable.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-4357

How was this patch tested?

Added TestOzoneFileSystemV1 UT. I will add more unit test cases eventually.

Copy link
Contributor

@linyiqun linyiqun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the latest PR, @rakeshadr .
I left my comments below, all of them are for the test.

keyArgs.getModificationTime(), omResponse, ozoneManager);
result = Result.SUCCESS;
} else {
// case-3) destination is a file and should not exist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: What is meant here by should not exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example,
source: /x/y/file1 and destin: /root_dir/file1.renamed, which exits.
Rename checks whether the destin is a file type and if exists then throws KEY_ALREADY_EXISTS exception.

I have checked existing code and followed same behavior.

Does this make sense to you?

@rakeshadr
Copy link
Contributor Author

@linyiqun @bharatviswa504 thanks for the review help. I've updated PR by addressing your comments, please take another look at it.

@linyiqun
Copy link
Contributor

Seems a very good test coverage now, thanks for adding more testing.
+1.

return fileName.toString();
}
// failed to converts a path key
return keyName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not got when parent is null, why we need to return keyName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done to avoid any NPE and I thought below logic will throw exception. Does that make sense to you?

OzoneFileStatus toKeyParentDirStatus = getOMKeyInfoIfExists(metaMgr,
          volumeName, bucketName, toKeyParentDir, 0);
  // check if the immediate parent exists
  if (toKeyParentDirStatus == null || toKeyParentDirStatus.isFile()) {
    throw new OMException(String.format(
            "Failed to rename %s to %s, %s is a file", fromKeyName, toKeyName,
            toKeyParentDir), OMException.ResultCodes.KEY_RENAME_ERROR);
  }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean to say here because we use Paths.get will cause issue here?

Copy link
Contributor Author

@rakeshadr rakeshadr Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it won't occur in general, just return keyname it for the safer side.

@bharatviswa504
Copy link
Contributor

bharatviswa504 commented Nov 13, 2020

Thank You @rakeshadr for the update and extensive test coverage.
I have few minor comments/questions.

@rakeshadr
Copy link
Contributor Author

Thank You @rakeshadr for the update and extensive test coverage.
I have few minor comments/questions.

Thanks a lot @bharatviswa504 for the comments. Updated patch and also replied to your comments.

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 LGTM, one question can go ahead with commit.

@rakeshadr
Copy link
Contributor Author

+1 LGTM, one question can go ahead with commit.

Thanks a lot @bharatviswa504 for the reviews. I replied to that comment. I don't have strong opinion on that but added for safe side. Will revisit that part later, if you disagree.

@rakeshadr rakeshadr closed this Nov 19, 2020
@rakeshadr rakeshadr reopened this Nov 19, 2020
@rakeshadr
Copy link
Contributor Author

Thanks @bharatviswa504 and @linyiqun for the detailed reviews.

Regarding the test failure. I looked at the logs and client failed to contact OM server due to NoRouteHostException. I believe, this error is unrelated to the current patch and planning to go ahead with merge.

Caused by: java.net.NoRouteToHostException: No route to host
	at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:779)
	at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
	at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:533)
	at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:700)
	at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:804)
	at org.apache.hadoop.ipc.Client$Connection.access$3800(Client.java:421)
	at org.apache.hadoop.ipc.Client.getConnection(Client.java:1606)
	at org.apache.hadoop.ipc.Client.call(Client.java:1435)
	... 35 more
No route to host

@rakeshadr rakeshadr merged this pull request into apache:HDDS-2939 Nov 19, 2020
rakeshadr added a commit that referenced this pull request Nov 20, 2020
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Dec 7, 2020
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Jan 6, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Jan 11, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Jan 13, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Jan 25, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Jan 28, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Feb 1, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Feb 1, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Feb 3, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Feb 5, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Feb 15, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Feb 18, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Feb 25, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Mar 3, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Mar 9, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Mar 27, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Apr 7, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
rakeshadr added a commit that referenced this pull request Apr 8, 2021
…try in dir/file table (#1557)

HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants