HADOOP-15968. ABFS: add try catch for UGI failure when initializing ABFS.

Contributed by Da Zhou.
This commit is contained in:
Da Zhou 2018-12-04 13:39:10 +00:00 committed by Steve Loughran
parent de4255509a
commit a8bbd818d5
No known key found for this signature in database
GPG Key ID: D22CF846DBB162A0
2 changed files with 15 additions and 5 deletions

View File

@ -121,7 +121,12 @@ public class AzureBlobFileSystem extends FileSystem {
}
if (!abfsConfiguration.getSkipUserGroupMetadataDuringInitialization()) {
this.primaryUserGroup = userGroupInformation.getPrimaryGroupName();
try {
this.primaryUserGroup = userGroupInformation.getPrimaryGroupName();
} catch (IOException ex) {
LOG.error("Failed to get primary group for {}, using user name as primary group name", user);
this.primaryUserGroup = this.user;
}
} else {
//Provide a default group name
this.primaryUserGroup = this.user;

View File

@ -102,8 +102,8 @@ public class AzureBlobFileSystemStore {
private AbfsClient client;
private URI uri;
private final UserGroupInformation userGroupInformation;
private final String userName;
private final String primaryUserGroup;
private String userName;
private String primaryUserGroup;
private static final String DATE_TIME_PATTERN = "E, dd MMM yyyy HH:mm:ss 'GMT'";
private static final String XMS_PROPERTIES_ENCODING = "ISO-8859-1";
private static final int LIST_MAX_RESULTS = 5000;
@ -134,10 +134,15 @@ public class AzureBlobFileSystemStore {
this.userName = userGroupInformation.getShortUserName();
if (!abfsConfiguration.getSkipUserGroupMetadataDuringInitialization()) {
primaryUserGroup = userGroupInformation.getPrimaryGroupName();
try {
this.primaryUserGroup = userGroupInformation.getPrimaryGroupName();
} catch (IOException ex) {
LOG.error("Failed to get primary group for {}, using user name as primary group name", userName);
this.primaryUserGroup = userName;
}
} else {
//Provide a default group name
primaryUserGroup = userName;
this.primaryUserGroup = userName;
}
this.azureAtomicRenameDirSet = new HashSet<>(Arrays.asList(