HBASE-12444 Total number of requests overflow because it's int
This commit is contained in:
parent
f8e2323323
commit
2245dfc558
|
@ -193,15 +193,21 @@ public class ClusterStatus {
|
|||
|
||||
/**
|
||||
* @return the number of requests since last report
|
||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
||||
* Use {@link #getRequestCount()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getRequestsCount() {
|
||||
int count = 0;
|
||||
if (liveServers != null && !liveServers.isEmpty()) {
|
||||
for (Map.Entry<ServerName, ServerLoad> e: this.liveServers.entrySet()) {
|
||||
count += e.getValue().getNumberOfRequests();
|
||||
}
|
||||
return (int) getRequestCount();
|
||||
}
|
||||
|
||||
public long getRequestCount() {
|
||||
if (liveServers == null) {
|
||||
return 0L;
|
||||
}
|
||||
return count;
|
||||
return liveServers.values().stream()
|
||||
.mapToLong(ServerLoad::getNumberOfRequests)
|
||||
.sum();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -375,7 +381,7 @@ public class ClusterStatus {
|
|||
}
|
||||
|
||||
sb.append("\nAverage load: " + getAverageLoad());
|
||||
sb.append("\nNumber of requests: " + getRequestsCount());
|
||||
sb.append("\nNumber of requests: " + getRequestCount());
|
||||
sb.append("\nNumber of regions: " + getRegionsCount());
|
||||
|
||||
int ritSize = (intransition != null) ? intransition.size() : 0;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class StorageClusterStatusResource extends ResourceBase {
|
|||
EnumSet.of(Option.LIVE_SERVERS, Option.DEAD_SERVERS));
|
||||
StorageClusterStatusModel model = new StorageClusterStatusModel();
|
||||
model.setRegions(status.getRegionsCount());
|
||||
model.setRequests(status.getRequestsCount());
|
||||
model.setRequests(status.getRequestCount());
|
||||
model.setAverageLoad(status.getAverageLoad());
|
||||
for (ServerName info: status.getServers()) {
|
||||
ServerLoad load = status.getLoad(info);
|
||||
|
|
|
@ -630,7 +630,7 @@ public class StorageClusterStatusModel
|
|||
* @param requests the total number of requests per second handled by the
|
||||
* cluster
|
||||
*/
|
||||
public void setRequests(int requests) {
|
||||
public void setRequests(long requests) {
|
||||
this.requests = requests;
|
||||
}
|
||||
|
||||
|
|
|
@ -1309,7 +1309,7 @@ public class HRegionServer extends HasThread implements
|
|||
|
||||
ClusterStatusProtos.ServerLoad.Builder serverLoad = ClusterStatusProtos.ServerLoad.newBuilder();
|
||||
serverLoad.setNumberOfRequests((int) regionServerWrapper.getRequestsPerSecond());
|
||||
serverLoad.setTotalNumberOfRequests((int) regionServerWrapper.getTotalRequestCount());
|
||||
serverLoad.setTotalNumberOfRequests(regionServerWrapper.getTotalRequestCount());
|
||||
serverLoad.setUsedHeapMB((int)(usedMemory / 1024 / 1024));
|
||||
serverLoad.setMaxHeapMB((int) (maxMemory / 1024 / 1024));
|
||||
Set<String> coprocessors = getWAL(null).getCoprocessorHost().getCoprocessors();
|
||||
|
|
|
@ -565,7 +565,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
}
|
||||
|
||||
errors.print("Average load: " + status.getAverageLoad());
|
||||
errors.print("Number of requests: " + status.getRequestsCount());
|
||||
errors.print("Number of requests: " + status.getRequestCount());
|
||||
errors.print("Number of regions: " + status.getRegionsCount());
|
||||
|
||||
List<RegionState> rits = status.getRegionsInTransition();
|
||||
|
|
Loading…
Reference in New Issue