HADOOP-8642. ProtobufRpcEngine should log all RPCs if TRACE logging is enabled. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1366127 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
109735f3d1
commit
2f478ac89c
|
@ -88,6 +88,9 @@ Trunk (unreleased changes)
|
||||||
HADOOP-8523. test-patch.sh doesn't validate patches before building
|
HADOOP-8523. test-patch.sh doesn't validate patches before building
|
||||||
(Jack Dintruff via jeagles)
|
(Jack Dintruff via jeagles)
|
||||||
|
|
||||||
|
HADOOP-8642. ProtobufRpcEngine should log all RPCs if TRACE logging is
|
||||||
|
enabled (todd)
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.
|
HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.
|
||||||
|
|
|
@ -1399,5 +1399,10 @@ public class Client {
|
||||||
result = PRIME * result + ((ticket == null) ? 0 : ticket.hashCode());
|
result = PRIME * result + ((ticket == null) ? 0 : ticket.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return serverPrincipal + "@" + address;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,13 +51,14 @@ import com.google.protobuf.BlockingService;
|
||||||
import com.google.protobuf.Descriptors.MethodDescriptor;
|
import com.google.protobuf.Descriptors.MethodDescriptor;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
import com.google.protobuf.ServiceException;
|
import com.google.protobuf.ServiceException;
|
||||||
|
import com.google.protobuf.TextFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RPC Engine for for protobuf based RPCs.
|
* RPC Engine for for protobuf based RPCs.
|
||||||
*/
|
*/
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class ProtobufRpcEngine implements RpcEngine {
|
public class ProtobufRpcEngine implements RpcEngine {
|
||||||
private static final Log LOG = LogFactory.getLog(ProtobufRpcEngine.class);
|
public static final Log LOG = LogFactory.getLog(ProtobufRpcEngine.class);
|
||||||
|
|
||||||
static { // Register the rpcRequest deserializer for WritableRpcEngine
|
static { // Register the rpcRequest deserializer for WritableRpcEngine
|
||||||
org.apache.hadoop.ipc.Server.registerProtocolEngine(
|
org.apache.hadoop.ipc.Server.registerProtocolEngine(
|
||||||
|
@ -191,16 +192,29 @@ public class ProtobufRpcEngine implements RpcEngine {
|
||||||
|
|
||||||
HadoopRpcRequestProto rpcRequest = constructRpcRequest(method, args);
|
HadoopRpcRequestProto rpcRequest = constructRpcRequest(method, args);
|
||||||
RpcResponseWritable val = null;
|
RpcResponseWritable val = null;
|
||||||
|
|
||||||
|
if (LOG.isTraceEnabled()) {
|
||||||
|
LOG.trace(Thread.currentThread().getId() + ": Call -> " +
|
||||||
|
remoteId + ": " + method.getName() +
|
||||||
|
" {" + TextFormat.shortDebugString((Message) args[1]) + "}");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
val = (RpcResponseWritable) client.call(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
|
val = (RpcResponseWritable) client.call(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
|
||||||
new RpcRequestWritable(rpcRequest), remoteId);
|
new RpcRequestWritable(rpcRequest), remoteId);
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
if (LOG.isTraceEnabled()) {
|
||||||
|
LOG.trace(Thread.currentThread().getId() + ": Exception <- " +
|
||||||
|
remoteId + ": " + method.getName() +
|
||||||
|
" {" + e + "}");
|
||||||
|
}
|
||||||
|
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
long callTime = Time.now() - startTime;
|
long callTime = Time.now() - startTime;
|
||||||
LOG.debug("Call: " + method.getName() + " " + callTime);
|
LOG.debug("Call: " + method.getName() + " took " + callTime + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
Message prototype = null;
|
Message prototype = null;
|
||||||
|
@ -213,6 +227,13 @@ public class ProtobufRpcEngine implements RpcEngine {
|
||||||
try {
|
try {
|
||||||
returnMessage = prototype.newBuilderForType()
|
returnMessage = prototype.newBuilderForType()
|
||||||
.mergeFrom(val.responseMessage).build();
|
.mergeFrom(val.responseMessage).build();
|
||||||
|
|
||||||
|
if (LOG.isTraceEnabled()) {
|
||||||
|
LOG.trace(Thread.currentThread().getId() + ": Response <- " +
|
||||||
|
remoteId + ": " + method.getName() +
|
||||||
|
" {" + TextFormat.shortDebugString(returnMessage) + "}");
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue