Skip to content

HDDS-8278. O3fs/ofs to support setTimes() API #4720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 31, 2023

Conversation

jojochuang
Copy link
Contributor

What changes were proposed in this pull request?

Support FileSystem.setTimes() API

What is the link to the Apache JIRA

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

How was this patch tested?

Unit tests and file system integration tests.

@jojochuang jojochuang marked this pull request as ready for review May 22, 2023 22:21
Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

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

@jojochuang Thanks working over this, looks good to me, have few minor query, please check.

void apply(OmKeyInfo omKeyInfo, long trxnLogIndex) {
// No need to check not null here, this will be never called with null.
long mtime = getModificationTime();
if (mtime != -1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should do some validation for mtime, like value should be greater than "0"
Do we have any range of mtime validation which can be set ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The -1 has a special meaning according to Hadoop setTimes() API javadoc:

/**

  • Set access time of a file.
  • @param p The path
  • @param mtime Set the modification time of this file.
  •          The number of milliseconds since Jan 1, 1970.
    
  •          A value of -1 means that this call should not set modification time.
    
  • @param atime Set the access time of this file.
  •          The number of milliseconds since Jan 1, 1970.
    
  •          A value of -1 means that this call should not set access time.
    
  • @throws IOException IO failure
    */
    public void setTimes(Path p, long mtime, long atime
    ) throws IOException {
    }

But yes in general we should add a guardrail around it.

Copy link
Member

@ayushtkn ayushtkn left a comment

Choose a reason for hiding this comment

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

minor comments, rest lgtm

TODO: need tests
Change-Id: I3fe42a93995e344aa0f55c6fb08319d2bd066355
Change-Id: I0b879ff955c79a6cb95e105c27db2565a398e80e
Change-Id: I0e897cf83c43f5682242eaa8c46ad7290031aca7
Change-Id: I405462009f46a91045f6a92cd0a8f8f556ed79b6
Change-Id: I9f02fc2ad3ae37076fd357921aa9c4db8247dd6e
Change-Id: I3065d57a535727ca47c73477af5a5c4711e6743b
Change-Id: I58e72ce60ee70d3ed4f4d44ebe743aff3a63cafa
Change-Id: I845cb33f9d4b998759bb1cdbde2b25f3e5d2ebc2
Copy link
Member

@ayushtkn ayushtkn left a comment

Choose a reason for hiding this comment

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

LGTM

@adoroszlai adoroszlai marked this pull request as draft May 30, 2023 07:13
Change-Id: I21f36c2abc317cbfc686c67753f47eaf03af9a58
Change-Id: I5ffd49999775eee75964cf7cb2456e448f037561
@jojochuang jojochuang marked this pull request as ready for review May 31, 2023 17:04
Change-Id: Ie1842a21ebd3abf849cd31f751b31f64dbb2f17e
@jojochuang jojochuang merged commit a92e107 into apache:master May 31, 2023
@jojochuang
Copy link
Contributor Author

Thanks Ayush. This is merged.

@@ -1364,4 +1364,12 @@ public boolean recoverLease(final Path f) throws IOException {
return ozoneClient.getProxy().getOzoneManagerClient().recoverLease(
volume.getName(), bucket.getName(), ofsPath.getKeyName());
}

public void setTimes(String key, long mtime, long atime) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this method need to add Override @jojochuang

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.

4 participants