Search in sources :

Example 1 with VersionInfo

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo in project hbase by apache.

the class MasterRpcServices method regionServerStartup.

@Override
public RegionServerStartupResponse regionServerStartup(RpcController controller, RegionServerStartupRequest request) throws ServiceException {
    // Register with server manager
    try {
        server.checkServiceStarted();
        int versionNumber = 0;
        String version = "0.0.0";
        VersionInfo versionInfo = VersionInfoUtil.getCurrentClientVersionInfo();
        if (versionInfo != null) {
            version = versionInfo.getVersion();
            versionNumber = VersionInfoUtil.getVersionNumber(versionInfo);
        }
        InetAddress ia = server.getRemoteInetAddress(request.getPort(), request.getServerStartCode());
        // if regionserver passed hostname to use,
        // then use it instead of doing a reverse DNS lookup
        ServerName rs = server.getServerManager().regionServerStartup(request, versionNumber, version, ia);
        // Send back some config info
        RegionServerStartupResponse.Builder resp = createConfigurationSubset();
        NameStringPair.Builder entry = NameStringPair.newBuilder().setName(HConstants.KEY_FOR_HOSTNAME_SEEN_BY_MASTER).setValue(rs.getHostname());
        resp.addMapEntries(entry.build());
        return resp.build();
    } catch (IOException ioe) {
        throw new ServiceException(ioe);
    }
}
Also used : VersionInfo(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) NameStringPair(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameStringPair) ServerName(org.apache.hadoop.hbase.ServerName) RegionServerStartupResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) InetAddress(java.net.InetAddress)

Example 2 with VersionInfo

use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo in project hbase by apache.

the class MasterRpcServices method regionServerReport.

@Override
public RegionServerReportResponse regionServerReport(RpcController controller, RegionServerReportRequest request) throws ServiceException {
    try {
        server.checkServiceStarted();
        int versionNumber = 0;
        String version = "0.0.0";
        VersionInfo versionInfo = VersionInfoUtil.getCurrentClientVersionInfo();
        if (versionInfo != null) {
            version = versionInfo.getVersion();
            versionNumber = VersionInfoUtil.getVersionNumber(versionInfo);
        }
        ClusterStatusProtos.ServerLoad sl = request.getLoad();
        ServerName serverName = ProtobufUtil.toServerName(request.getServer());
        ServerMetrics oldLoad = server.getServerManager().getLoad(serverName);
        ServerMetrics newLoad = ServerMetricsBuilder.toServerMetrics(serverName, versionNumber, version, sl);
        server.getServerManager().regionServerReport(serverName, newLoad);
        server.getAssignmentManager().reportOnlineRegions(serverName, newLoad.getRegionMetrics().keySet());
        if (sl != null && server.metricsMaster != null) {
            // Up our metrics.
            server.metricsMaster.incrementRequests(sl.getTotalNumberOfRequests() - (oldLoad != null ? oldLoad.getRequestCount() : 0));
            server.metricsMaster.incrementReadRequests(sl.getReadRequestsCount() - (oldLoad != null ? oldLoad.getReadRequestsCount() : 0));
            server.metricsMaster.incrementWriteRequests(sl.getWriteRequestsCount() - (oldLoad != null ? oldLoad.getWriteRequestsCount() : 0));
        }
    } catch (IOException ioe) {
        throw new ServiceException(ioe);
    }
    return RegionServerReportResponse.newBuilder().build();
}
Also used : VersionInfo(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo) ClusterStatusProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ServerName(org.apache.hadoop.hbase.ServerName) ServerMetrics(org.apache.hadoop.hbase.ServerMetrics) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Aggregations

IOException (java.io.IOException)2 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)2 ServerName (org.apache.hadoop.hbase.ServerName)2 VersionInfo (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo)2 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)2 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)2 InetAddress (java.net.InetAddress)1 ServerMetrics (org.apache.hadoop.hbase.ServerMetrics)1 ClusterStatusProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos)1 NameStringPair (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameStringPair)1 RegionServerStartupResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse)1