HBASE-16972 Log more details for Scan#next request when responseTooSlow
This commit is contained in:
parent
c93c194e5a
commit
b1d1dc8569
|
@ -99,7 +99,9 @@ import org.apache.hadoop.hbase.io.ByteBufferPool;
|
|||
import org.apache.hadoop.hbase.io.crypto.aes.CryptoAES;
|
||||
import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
|
||||
import org.apache.hadoop.hbase.monitoring.TaskMonitor;
|
||||
import org.apache.hadoop.hbase.regionserver.RSRpcServices;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CellBlockMeta;
|
||||
|
@ -305,6 +307,12 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
|||
|
||||
private volatile boolean allowFallbackToSimpleAuth;
|
||||
|
||||
/**
|
||||
* Used to get details for scan with a scanner_id<br/>
|
||||
* TODO try to figure out a better way and remove reference from regionserver package later.
|
||||
*/
|
||||
private RSRpcServices rsRpcServices;
|
||||
|
||||
/**
|
||||
* Datastructure that holds all necessary to a method invocation and then afterward, carries
|
||||
* the result.
|
||||
|
@ -2554,6 +2562,16 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
|||
responseInfo.put("method", methodName);
|
||||
responseInfo.put("call", call);
|
||||
responseInfo.put("param", ProtobufUtil.getShortTextFormat(param));
|
||||
if (param instanceof ClientProtos.ScanRequest && rsRpcServices != null) {
|
||||
ClientProtos.ScanRequest request = ((ClientProtos.ScanRequest) param);
|
||||
if (request.hasScannerId()) {
|
||||
long scannerId = request.getScannerId();
|
||||
String scanDetails = rsRpcServices.getScanDetailsWithId(scannerId);
|
||||
if (scanDetails != null) {
|
||||
responseInfo.put("scandetails", scanDetails);
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo));
|
||||
}
|
||||
|
||||
|
@ -2887,6 +2905,11 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
|||
return scheduler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRsRpcServices(RSRpcServices rsRpcServices) {
|
||||
this.rsRpcServices = rsRpcServices;
|
||||
}
|
||||
|
||||
private class ConnectionManager {
|
||||
final private AtomicInteger count = new AtomicInteger();
|
||||
final private Set<Connection> connections;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.classification.InterfaceStability;
|
|||
import org.apache.hadoop.hbase.CellScanner;
|
||||
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
||||
import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
|
||||
import org.apache.hadoop.hbase.regionserver.RSRpcServices;
|
||||
import org.apache.hadoop.hbase.util.Pair;
|
||||
import org.apache.hadoop.security.authorize.PolicyProvider;
|
||||
|
||||
|
@ -83,4 +84,6 @@ public interface RpcServerInterface {
|
|||
void refreshAuthManager(PolicyProvider pp);
|
||||
|
||||
RpcScheduler getScheduler();
|
||||
|
||||
void setRsRpcServices(RSRpcServices rsRpcServices);
|
||||
}
|
||||
|
|
|
@ -1065,6 +1065,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
bindAddress, // use final bindAddress for this server.
|
||||
rs.conf,
|
||||
rpcSchedulerFactory.create(rs.conf, this, rs));
|
||||
rpcServer.setRsRpcServices(this);
|
||||
} catch (BindException be) {
|
||||
String configName = (this instanceof MasterRpcServices) ? HConstants.MASTER_PORT :
|
||||
HConstants.REGIONSERVER_PORT;
|
||||
|
@ -1130,6 +1131,17 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
return null;
|
||||
}
|
||||
|
||||
public String getScanDetailsWithId(long scannerId) {
|
||||
RegionScanner scanner = getScanner(scannerId);
|
||||
if (scanner == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("table: ").append(scanner.getRegionInfo().getTable().getNameAsString());
|
||||
builder.append(" region: ").append(scanner.getRegionInfo().getRegionNameAsString());
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vtime associated with the scanner.
|
||||
* Currently the vtime is the number of "next" calls.
|
||||
|
|
Loading…
Reference in New Issue