HBASE-12164 Check for presence of user Id in SecureBulkLoadEndpoint#secureBulkLoadHFiles() is inaccurate

This commit is contained in:
Ted Yu 2014-10-03 03:53:58 +00:00
parent 8dbf7b2238
commit a17614d5b2
1 changed files with 5 additions and 4 deletions

View File

@ -198,7 +198,7 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
}
Token userToken = null;
if (request.getFsToken().hasIdentifier() && request.getFsToken().hasPassword()) {
if (userProvider.isHadoopSecurityEnabled()) {
userToken = new Token(request.getFsToken().getIdentifier().toByteArray(), request.getFsToken()
.getPassword().toByteArray(), new Text(request.getFsToken().getKind()), new Text(
request.getFsToken().getService()));
@ -213,6 +213,7 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
//for mini cluster testing
ResponseConverter.setControllerException(controller,
new DoNotRetryIOException("User token cannot be null"));
done.run(SecureBulkLoadHFilesResponse.newBuilder().setLoaded(false).build());
return;
}
@ -223,7 +224,7 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
} catch (IOException e) {
ResponseConverter.setControllerException(controller, e);
done.run(null);
done.run(SecureBulkLoadHFilesResponse.newBuilder().setLoaded(false).build());
return;
}
}
@ -240,7 +241,7 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
targetfsDelegationToken.acquireDelegationToken(fs);
} catch (IOException e) {
ResponseConverter.setControllerException(controller, e);
done.run(null);
done.run(SecureBulkLoadHFilesResponse.newBuilder().setLoaded(false).build());
return;
}
Token<?> targetFsToken = targetfsDelegationToken.getUserToken();
@ -284,7 +285,7 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded);
} catch (IOException e) {
ResponseConverter.setControllerException(controller, e);
done.run(null);
done.run(SecureBulkLoadHFilesResponse.newBuilder().setLoaded(false).build());
return;
}
}