HBASE-19087 Logs should have Optional's value/null instead of Optional[value]/Optional.empty.

Change-Id: I436d02ee91710442d199e63956186a9364852c4e
Signed-off-by: Apekshit Sharma <appy@apache.org>
This commit is contained in:
Guangxu Cheng 2017-10-25 20:23:33 +08:00 committed by Apekshit Sharma
parent 98c01bd4cf
commit 5000652e5e
3 changed files with 8 additions and 6 deletions

View File

@ -1552,7 +1552,8 @@ public class HMaster extends HRegionServer implements MasterServices {
* @return Client info for use as prefix on an audit log string; who did an action
*/
public String getClientIdAuditPrefix() {
return "Client=" + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress();
return "Client=" + RpcServer.getRequestUserName().orElse(null)
+ "/" + RpcServer.getRemoteAddress().orElse(null);
}
/**

View File

@ -1137,7 +1137,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
if (LOG.isWarnEnabled()) {
LOG.warn("Large batch operation detected (greater than " + rowSizeWarnThreshold
+ ") (HBASE-18023)." + " Requested Number of Rows: " + sum + " Client: "
+ RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress()
+ RpcServer.getRequestUserName().orElse(null) + "/"
+ RpcServer.getRemoteAddress().orElse(null)
+ " first region in multi=" + firstRegionName);
}
}
@ -1727,8 +1728,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
@QosPriority(priority=HConstants.ADMIN_QOS)
public ClearCompactionQueuesResponse clearCompactionQueues(RpcController controller,
ClearCompactionQueuesRequest request) throws ServiceException {
LOG.debug("Client=" + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress()
+ " clear compactions queue");
LOG.debug("Client=" + RpcServer.getRequestUserName().orElse(null) + "/"
+ RpcServer.getRemoteAddress().orElse(null) + " clear compactions queue");
ClearCompactionQueuesResponse.Builder respBuilder = ClearCompactionQueuesResponse.newBuilder();
requestCount.increment();
if (clearCompactionQueues.compareAndSet(false,true)) {

View File

@ -374,7 +374,7 @@ public class TestTokenAuthentication {
public AuthenticationProtos.GetAuthenticationTokenResponse getAuthenticationToken(
RpcController controller, AuthenticationProtos.GetAuthenticationTokenRequest request)
throws ServiceException {
LOG.debug("Authentication token request from " + RpcServer.getRequestUserName());
LOG.debug("Authentication token request from " + RpcServer.getRequestUserName().orElse(null));
// Ignore above passed in controller -- it is always null
ServerRpcController serverController = new ServerRpcController();
final NonShadedBlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse>
@ -392,7 +392,7 @@ public class TestTokenAuthentication {
public AuthenticationProtos.WhoAmIResponse whoAmI(
RpcController controller, AuthenticationProtos.WhoAmIRequest request)
throws ServiceException {
LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName());
LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName().orElse(null));
// Ignore above passed in controller -- it is always null
ServerRpcController serverController = new ServerRpcController();
NonShadedBlockingRpcCallback<AuthenticationProtos.WhoAmIResponse> callback =