8000 HADOOP-12774 use UGI.currentUser for user and group of s3a objects by steveloughran · Pull Request #136 · apache/hadoop · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

HADOOP-12774 use UGI.currentUser for user and group of s3a objects #136

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 p 8000 rivacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

steveloughran
Copy link
Contributor

This patch grabs the UGI current user shortname in the FS initialize call, then uses that as the user and group for all filestatus instances generated.

$ ./hadoop fs -ls s3a://hwdev-steve-ireland/
Found 1 items
drwxrwxrwx   - stevel stevel          0 2016-10-07 17:29 s3a://hwdev-steve-ireland/tests

Copy link
Contributor
@cnauroth cnauroth left a comment

Choose a reason for hiding this comment

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

@steveloughran , could you please add a test that initializes an S3AFileSystem as a specific user, such as by using UserGroupInformation#createUserForTesting and UserGroupInformation#doAs? The specific test username can be a hard-coded string that is likely to be different from the user.name system property.

@steveloughran
Copy link
Contributor Author

Patch 002: create a fake user, create an FS and verify that the user and owner on the root path is that username

Copy link
Contributor
@cnauroth cnauroth left a comment

Choose a reason for hiding this comment

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

@steveloughran , here are a few more comments on the patch. Thank you.

@@ -32,18 +32,24 @@
@InterfaceStability.Evolving
public class S3AFileStatus extends FileStatus {
private boolean isEmptyDirectory;
private final String owner;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can achieve this change without adding a member variable in the subclass. (See more specific notes to follow.) Removing this member variable would reduce memory footprint. Admittedly, the memory cost is probably not significant, but as we start thinking about the possibility of caching FileStatus instances client-side for things like S3Guard, then the per-instance memory cost of each FileStatus could become more significant.

super(0, isdir, 1, 0, 0, path);
isEmptyDirectory = isemptydir;
this.owner = owner;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider removing the member variable and changing this line of code to:

this.setOwner(owner);
this.setGroup(owner);

(These are protected methods in the base class.)

@@ -52,7 +58,16 @@ public boolean isEmptyDirectory() {

@Override
public String getOwner() {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we implement the above comments, then we can completely remove the override of getOwner here.

* @return the owner.
*/
@Override
public String getGroup() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The override of getGroup could be removed too.

@@ -42,8 +42,11 @@

import java.io.File;
import java.net.URI;
import java.security.PrivilegedAction;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused import?

super(length, false, 1, blockSize, modification_time, path);
isEmptyDirectory = false;
this.owner = owner;
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to the earlier comment:

this.setOwner(owner);
this.setGroup(owner);

@steveloughran steveloughran force-pushed the s3/HADOOP-12774-username branch 2 times, most recently from 2c06cc5 to 29e589c Compare October 13, 2016 14:53
@steveloughran steveloughran force-pushed the s3/HADOOP-12774-username branch from 29e589c to a06b635 Compare October 20, 2016 20:28
…s. Also, given that the first contructor for S3AFileStatus is only for directories, the isdir parameter is always true, hence superflous. Cut and add javadocs for both constructors.
@steveloughran steveloughran force-pushed the s3/HADOOP-12774-username branch from a06b635 to fae8ee7 Compare October 24, 2016 17:14
@steveloughran steveloughran deleted the s3/HADOOP-12774-username branch November 1, 2016 10:21
shanthoosh pushed a commit to shanthoosh/hadoop that referenced this pull request Oct 15, 2019
…istic behavior

Author: vjagadish1989 <jvenkatr@linkedin.com>

Reviewers: Prateek Maheshwari<prateekm@linkedin.com>

Closes apache#136 from vjagadish1989/samza-1202
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.

2 participants
0