Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ public static CompletableFuture<Optional<TableState>> getTableState(AsyncTable<?
return future;
}

/**
* Returns the HRegionLocation from meta for the given region n * @param regionName region we're
* looking for
* @return HRegionLocation for the given region
*/
/** Returns the HRegionLocation from meta for the given region */
public static CompletableFuture<Optional<HRegionLocation>>
getRegionLocation(AsyncTable<?> metaTable, byte[] regionName) {
CompletableFuture<Optional<HRegionLocation>> future = new CompletableFuture<>();
Expand All @@ -127,11 +123,7 @@ public static CompletableFuture<Optional<TableState>> getTableState(AsyncTable<?
return future;
}

/**
* Returns the HRegionLocation from meta for the given encoded region name n * @param
* encodedRegionName region we're looking for
* @return HRegionLocation for the given region
*/
/** Returns the HRegionLocation from meta for the given encoded region name */
public static CompletableFuture<Optional<HRegionLocation>>
getRegionLocationWithEncodedName(AsyncTable<?> metaTable, byte[] encodedRegionName) {
CompletableFuture<Optional<HRegionLocation>> future = new CompletableFuture<>();
Expand Down Expand Up @@ -176,8 +168,9 @@ private static Optional<TableState> getTableState(Result r) throws IOException {
}

/**
* Used to get all region locations for the specific table. n * @param tableName table we're
* looking for, can be null for getting all regions
* Used to get all region locations for the specific table
* @param metaTable scanner over meta table
* @param tableName table we're looking for, can be null for getting all regions
* @return the list of region locations. The return value will be wrapped by a
* {@link CompletableFuture}.
*/
Expand All @@ -200,8 +193,9 @@ public static CompletableFuture<List<HRegionLocation>> getTableHRegionLocations(
}

/**
* Used to get table regions' info and server. n * @param tableName table we're looking for, can
* be null for getting all regions
* Used to get table regions' info and server.
* @param metaTable scanner over meta table
* @param tableName table we're looking for, can be null for getting all regions
* @param excludeOfflinedSplitParents don't return split parents
* @return the list of regioninfos and server. The return value will be wrapped by a
* {@link CompletableFuture}.
Expand Down Expand Up @@ -259,9 +253,11 @@ void add(Result r) {
}

/**
* Performs a scan of META table for given table. n * @param tableName table withing we scan
* @param type scanned part of meta
* @param visitor Visitor invoked against each row
* Performs a scan of META table for given table.
* @param metaTable scanner over meta table
* @param tableName table within we scan
* @param type scanned part of meta
* @param visitor Visitor invoked against each row
*/
private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable,
TableName tableName, QueryType type, final Visitor visitor) {
Expand All @@ -270,11 +266,13 @@ private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultCon
}

/**
* Performs a scan of META table for given table. n * @param startRow Where to start the scan
* @param stopRow Where to stop the scan
* @param type scanned part of meta
* @param maxRows maximum rows to return
* @param visitor Visitor invoked against each row
* Performs a scan of META table for given table.
* @param metaTable scanner over meta table
* @param startRow Where to start the scan
* @param stopRow Where to stop the scan
* @param type scanned part of meta
* @param maxRows maximum rows to return
* @param visitor Visitor invoked against each row
*/
private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable,
byte[] startRow, byte[] stopRow, QueryType type, int maxRows, final Visitor visitor) {
Expand Down Expand Up @@ -410,25 +408,32 @@ private static Scan getMetaScan(AsyncTable<?> metaTable, int rowUpperLimit) {
* can't deserialize the result.
*/
private static Optional<RegionLocations> getRegionLocations(final Result r) {
if (r == null) return Optional.empty();
if (r == null) {
return Optional.empty();
}
Optional<RegionInfo> regionInfo = getHRegionInfo(r, getRegionInfoColumn());
if (!regionInfo.isPresent()) return Optional.empty();
if (!regionInfo.isPresent()) {
return Optional.empty();
}

List<HRegionLocation> locations = new ArrayList<HRegionLocation>(1);
NavigableMap<byte[], NavigableMap<byte[], byte[]>> familyMap = r.getNoVersionMap();

locations.add(getRegionLocation(r, regionInfo.get(), 0));

NavigableMap<byte[], byte[]> infoMap = familyMap.get(getCatalogFamily());
if (infoMap == null) return Optional.of(new RegionLocations(locations));
if (infoMap == null) {
return Optional.of(new RegionLocations(locations));
}

// iterate until all serverName columns are seen
int replicaId = 0;
byte[] serverColumn = getServerColumn(replicaId);
SortedMap<byte[], byte[]> serverMap = null;
serverMap = infoMap.tailMap(serverColumn, false);
SortedMap<byte[], byte[]> serverMap = infoMap.tailMap(serverColumn, false);

if (serverMap.isEmpty()) return Optional.of(new RegionLocations(locations));
if (serverMap.isEmpty()) {
return Optional.of(new RegionLocations(locations));
}

for (Map.Entry<byte[], byte[]> entry : serverMap.entrySet()) {
replicaId = parseReplicaIdFromServerColumn(entry.getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public byte[] toByteArray() {
}

/**
* Parse the serialized representation of the {@link ClusterId}
* @param bytes A pb serialized {@link ClusterId} instance with pb magic prefix
* @return An instance of {@link ClusterId} made from <code>bytes</code> n * @see #toByteArray()
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public static ClusterStatusProtos.ClusterStatus toClusterStatus(ClusterMetrics m
.collect(Collectors.toList()))
.addAllTableRegionStatesCount(metrics.getTableRegionStatesCount().entrySet().stream()
.map(status -> ClusterStatusProtos.TableRegionStatesCount.newBuilder()
.setTableName(ProtobufUtil.toProtoTableName((status.getKey())))
.setTableName(ProtobufUtil.toProtoTableName(status.getKey()))
.setRegionStatesCount(ProtobufUtil.toTableRegionStatesCount(status.getValue())).build())
.collect(Collectors.toList()));
if (metrics.getMasterName() != null) {
builder.setMaster(ProtobufUtil.toServerName((metrics.getMasterName())));
builder.setMaster(ProtobufUtil.toServerName(metrics.getMasterName()));
}
if (metrics.getMasterTasks() != null) {
builder.addAllMasterTasks(metrics.getMasterTasks().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public List<RegionState> getRegionStatesInTransition() {
}

/** Returns the HBase version string as reported by the HMaster */
@Override
public String getHBaseVersion() {
return metrics.getHBaseVersion();
}
Expand Down Expand Up @@ -279,6 +280,7 @@ public ServerLoad getLoad(final ServerName sn) {
return serverMetrics == null ? null : new ServerLoad(serverMetrics);
}

@Override
public String getClusterId() {
return metrics.getClusterId();
}
Expand All @@ -289,6 +291,7 @@ public List<String> getMasterCoprocessorNames() {
}

/**
* Get the list of master coprocessor names.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link #getMasterCoprocessorNames} instead.
*/
Expand All @@ -299,6 +302,7 @@ public String[] getMasterCoprocessors() {
}

/**
* Get the last major compaction time for a given table.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link #getLastMajorCompactionTimestamp(TableName)} instead.
*/
Expand All @@ -308,6 +312,7 @@ public long getLastMajorCompactionTsForTable(TableName table) {
}

/**
* Get the last major compaction time for a given region.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link #getLastMajorCompactionTimestamp(byte[])} instead.
*/
Expand All @@ -317,6 +322,7 @@ public long getLastMajorCompactionTsForRegion(final byte[] region) {
}

/**
* Returns true if the balancer is enabled.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 No flag in 2.0
*/
@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public interface CoprocessorEnvironment<C extends Coprocessor> {
int getLoadSequence();

/**
* @return a Read-only Configuration; throws {@link UnsupportedOperationException} if you try to
* set a configuration.
* Returns a Read-only Configuration; throws {@link UnsupportedOperationException} if you try to
* set a configuration.
*/
Configuration getConfiguration();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ public HBaseServerException(boolean serverOverloaded, String message) {
this.serverOverloaded = serverOverloaded;
}

/**
* @param t throwable to check for server overloaded state
* @return True if the server was considered overloaded when the exception was thrown
*/
/** Returns True if the server was considered overloaded when the exception was thrown */
public static boolean isServerOverloaded(Throwable t) {
if (t instanceof HBaseServerException) {
return ((HBaseServerException) t).isServerOverloaded();
Expand Down
Loading