LiuGuH commented on code in PR #5552:
URL: https://github.com/apache/hadoop/pull/5552#discussion_r1170763729
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -453,15 +453,15 @@ private void logAuditEvent(boolean succeeded,
private void appendClientPortToCallerContextIfAbsent() {
final CallerContext ctx = CallerContext.getCurrent();
- if (isClientPortInfoAbsent(ctx)) {
- String origContext = ctx == null ? null : ctx.getContext();
- byte[] origSignature = ctx == null ? null : ctx.getSignature();
- CallerContext.setCurrent(
- new CallerContext.Builder(origContext, contextFieldSeparator)
- .append(CallerContext.CLIENT_PORT_STR,
String.valueOf(Server.getRemotePort()))
- .setSignature(origSignature)
- .build());
- }
+ String origContext = ctx == null ? null : ctx.getContext();
+ byte[] origSignature = ctx == null ? null : ctx.getSignature();
+ String clientPort = isClientPortInfoAbsent(ctx) ?
CallerContext.CLIENT_PORT_STR :
Review Comment:
Yes,it is. Because when is from dfsrouter ,the callcontext will add
clientPort . The code is in RouterRpcClient.addClientInfoToCallerContext().
In a word, when is comes form dfsrouter , the callcontext has clientPort, or it
is not contains clientPort,so we can use isClientPortInfoAbsent() to
distinguish sources
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]