HDFS-12218. Addendum. Rename split EC / replicated block metrics in BlockManager.

This commit is contained in:
Andrew Wang 2017-09-07 16:57:19 -07:00
parent 40c2f31f8d
commit 4e50dc976a
21 changed files with 226 additions and 226 deletions

View File

@ -778,14 +778,14 @@ SnapshottableDirectoryStatus[] getSnapshottableDirListing()
* in the filesystem.
*/
@Idempotent
ReplicatedBlockStats getBlocksStats() throws IOException;
ReplicatedBlockStats getReplicatedBlockStats() throws IOException;
/**
* Get statistics pertaining to blocks of type {@link BlockType#STRIPED}
* in the filesystem.
*/
@Idempotent
ECBlockGroupStats getECBlockGroupsStats() throws IOException;
ECBlockGroupStats getECBlockGroupStats() throws IOException;
/**
* Get a report on the system's current datanodes.

View File

@ -24,45 +24,45 @@
* Get statistics pertaining to blocks of type {@link BlockType#STRIPED}
* in the filesystem.
* <p>
* @see ClientProtocol#getECBlockGroupsStats()
* @see ClientProtocol#getECBlockGroupStats()
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public final class ECBlockGroupStats {
private final long lowRedundancyBlockGroupsStat;
private final long corruptBlockGroupsStat;
private final long missingBlockGroupsStat;
private final long bytesInFutureBlockGroupsStat;
private final long pendingDeletionBlockGroupsStat;
private final long lowRedundancyBlockGroups;
private final long corruptBlockGroups;
private final long missingBlockGroups;
private final long bytesInFutureBlockGroups;
private final long pendingDeletionBlocks;
public ECBlockGroupStats(long lowRedundancyBlockGroupsStat, long
corruptBlockGroupsStat, long missingBlockGroupsStat, long
bytesInFutureBlockGroupsStat, long pendingDeletionBlockGroupsStat) {
this.lowRedundancyBlockGroupsStat = lowRedundancyBlockGroupsStat;
this.corruptBlockGroupsStat = corruptBlockGroupsStat;
this.missingBlockGroupsStat = missingBlockGroupsStat;
this.bytesInFutureBlockGroupsStat = bytesInFutureBlockGroupsStat;
this.pendingDeletionBlockGroupsStat = pendingDeletionBlockGroupsStat;
public ECBlockGroupStats(long lowRedundancyBlockGroups,
long corruptBlockGroups, long missingBlockGroups,
long bytesInFutureBlockGroups, long pendingDeletionBlocks) {
this.lowRedundancyBlockGroups = lowRedundancyBlockGroups;
this.corruptBlockGroups = corruptBlockGroups;
this.missingBlockGroups = missingBlockGroups;
this.bytesInFutureBlockGroups = bytesInFutureBlockGroups;
this.pendingDeletionBlocks = pendingDeletionBlocks;
}
public long getBytesInFutureBlockGroupsStat() {
return bytesInFutureBlockGroupsStat;
public long getBytesInFutureBlockGroups() {
return bytesInFutureBlockGroups;
}
public long getCorruptBlockGroupsStat() {
return corruptBlockGroupsStat;
public long getCorruptBlockGroups() {
return corruptBlockGroups;
}
public long getLowRedundancyBlockGroupsStat() {
return lowRedundancyBlockGroupsStat;
public long getLowRedundancyBlockGroups() {
return lowRedundancyBlockGroups;
}
public long getMissingBlockGroupsStat() {
return missingBlockGroupsStat;
public long getMissingBlockGroups() {
return missingBlockGroups;
}
public long getPendingDeletionBlockGroupsStat() {
return pendingDeletionBlockGroupsStat;
public long getPendingDeletionBlocks() {
return pendingDeletionBlocks;
}
@Override
@ -70,13 +70,13 @@ public String toString() {
StringBuilder statsBuilder = new StringBuilder();
statsBuilder.append("ECBlockGroupStats=[")
.append("LowRedundancyBlockGroups=").append(
getLowRedundancyBlockGroupsStat())
.append(", CorruptBlockGroups=").append(getCorruptBlockGroupsStat())
.append(", MissingBlockGroups=").append(getMissingBlockGroupsStat())
getLowRedundancyBlockGroups())
.append(", CorruptBlockGroups=").append(getCorruptBlockGroups())
.append(", MissingBlockGroups=").append(getMissingBlockGroups())
.append(", BytesInFutureBlockGroups=").append(
getBytesInFutureBlockGroupsStat())
.append(", PendingDeletionBlockGroups=").append(
getPendingDeletionBlockGroupsStat())
getBytesInFutureBlockGroups())
.append(", PendingDeletionBlocks=").append(
getPendingDeletionBlocks())
.append("]");
return statsBuilder.toString();
}

View File

@ -24,66 +24,66 @@
* Get statistics pertaining to blocks of type {@link BlockType#CONTIGUOUS}
* in the filesystem.
* <p>
* @see ClientProtocol#getBlocksStats()
* @see ClientProtocol#getReplicatedBlockStats()
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public final class ReplicatedBlockStats {
private final long lowRedundancyBlocksStat;
private final long corruptBlocksStat;
private final long missingBlocksStat;
private final long missingReplicationOneBlocksStat;
private final long bytesInFutureBlocksStat;
private final long pendingDeletionBlocksStat;
private final long lowRedundancyBlocks;
private final long corruptBlocks;
private final long missingBlocks;
private final long missingReplicationOneBlocks;
private final long bytesInFutureBlocks;
private final long pendingDeletionBlocks;
public ReplicatedBlockStats(long lowRedundancyBlocksStat,
long corruptBlocksStat, long missingBlocksStat,
long missingReplicationOneBlocksStat, long bytesInFutureBlocksStat,
long pendingDeletionBlocksStat) {
this.lowRedundancyBlocksStat = lowRedundancyBlocksStat;
this.corruptBlocksStat = corruptBlocksStat;
this.missingBlocksStat = missingBlocksStat;
this.missingReplicationOneBlocksStat = missingReplicationOneBlocksStat;
this.bytesInFutureBlocksStat = bytesInFutureBlocksStat;
this.pendingDeletionBlocksStat = pendingDeletionBlocksStat;
public ReplicatedBlockStats(long lowRedundancyBlocks,
long corruptBlocks, long missingBlocks,
long missingReplicationOneBlocks, long bytesInFutureBlocks,
long pendingDeletionBlocks) {
this.lowRedundancyBlocks = lowRedundancyBlocks;
this.corruptBlocks = corruptBlocks;
this.missingBlocks = missingBlocks;
this.missingReplicationOneBlocks = missingReplicationOneBlocks;
this.bytesInFutureBlocks = bytesInFutureBlocks;
this.pendingDeletionBlocks = pendingDeletionBlocks;
}
public long getLowRedundancyBlocksStat() {
return lowRedundancyBlocksStat;
public long getLowRedundancyBlocks() {
return lowRedundancyBlocks;
}
public long getCorruptBlocksStat() {
return corruptBlocksStat;
public long getCorruptBlocks() {
return corruptBlocks;
}
public long getMissingReplicaBlocksStat() {
return missingBlocksStat;
public long getMissingReplicaBlocks() {
return missingBlocks;
}
public long getMissingReplicationOneBlocksStat() {
return missingReplicationOneBlocksStat;
public long getMissingReplicationOneBlocks() {
return missingReplicationOneBlocks;
}
public long getBytesInFutureBlocksStat() {
return bytesInFutureBlocksStat;
public long getBytesInFutureBlocks() {
return bytesInFutureBlocks;
}
public long getPendingDeletionBlocksStat() {
return pendingDeletionBlocksStat;
public long getPendingDeletionBlocks() {
return pendingDeletionBlocks;
}
@Override
public String toString() {
StringBuilder statsBuilder = new StringBuilder();
statsBuilder.append("ReplicatedBlocksStats=[")
.append("LowRedundancyBlocks=").append(getLowRedundancyBlocksStat())
.append(", CorruptBlocks=").append(getCorruptBlocksStat())
.append(", MissingReplicaBlocks=").append(getMissingReplicaBlocksStat())
statsBuilder.append("ReplicatedBlockStats=[")
.append("LowRedundancyBlocks=").append(getLowRedundancyBlocks())
.append(", CorruptBlocks=").append(getCorruptBlocks())
.append(", MissingReplicaBlocks=").append(getMissingReplicaBlocks())
.append(", MissingReplicationOneBlocks=").append(
getMissingReplicationOneBlocksStat())
.append(", BytesInFutureBlocks=").append(getBytesInFutureBlocksStat())
getMissingReplicationOneBlocks())
.append(", BytesInFutureBlocks=").append(getBytesInFutureBlocks())
.append(", PendingDeletionBlocks=").append(
getPendingDeletionBlocksStat())
getPendingDeletionBlocks())
.append("]");
return statsBuilder.toString();
}

View File

@ -120,8 +120,8 @@
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileInfoResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileLinkInfoRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileLinkInfoResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupsStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsBlocksStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsReplicatedBlockStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsStatusRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetLinkTargetRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetLinkTargetResponseProto;
@ -246,13 +246,13 @@ public class ClientNamenodeProtocolTranslatorPB implements
private final static GetFsStatusRequestProto VOID_GET_FSSTATUS_REQUEST =
GetFsStatusRequestProto.newBuilder().build();
private final static GetFsBlocksStatsRequestProto
VOID_GET_FS_REPLICABLOCKS_STATS_REQUEST =
GetFsBlocksStatsRequestProto.newBuilder().build();
private final static GetFsReplicatedBlockStatsRequestProto
VOID_GET_FS_REPLICATED_BLOCK_STATS_REQUEST =
GetFsReplicatedBlockStatsRequestProto.newBuilder().build();
private final static GetFsECBlockGroupsStatsRequestProto
VOID_GET_FS_ECBLOCKGROUPS_STATS_REQUEST =
GetFsECBlockGroupsStatsRequestProto.newBuilder().build();
private final static GetFsECBlockGroupStatsRequestProto
VOID_GET_FS_ECBLOCKGROUP_STATS_REQUEST =
GetFsECBlockGroupStatsRequestProto.newBuilder().build();
private final static RollEditsRequestProto VOID_ROLLEDITS_REQUEST =
RollEditsRequestProto.getDefaultInstance();
@ -695,20 +695,20 @@ public long[] getStats() throws IOException {
}
@Override
public ReplicatedBlockStats getBlocksStats() throws IOException {
public ReplicatedBlockStats getReplicatedBlockStats() throws IOException {
try {
return PBHelperClient.convert(rpcProxy.getFsBlocksStats(null,
VOID_GET_FS_REPLICABLOCKS_STATS_REQUEST));
return PBHelperClient.convert(rpcProxy.getFsReplicatedBlockStats(null,
VOID_GET_FS_REPLICATED_BLOCK_STATS_REQUEST));
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
@Override
public ECBlockGroupStats getECBlockGroupsStats() throws IOException {
public ECBlockGroupStats getECBlockGroupStats() throws IOException {
try {
return PBHelperClient.convert(rpcProxy.getFsECBlockGroupsStats(null,
VOID_GET_FS_ECBLOCKGROUPS_STATS_REQUEST));
return PBHelperClient.convert(rpcProxy.getFsECBlockGroupStats(null,
VOID_GET_FS_ECBLOCKGROUP_STATS_REQUEST));
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}

View File

@ -122,8 +122,8 @@
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.DatanodeReportTypeProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.DatanodeStorageReportProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetEditsFromTxidResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupsStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsBlocksStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsReplicatedBlockStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.OpenFilesBatchResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.RollingUpgradeActionProto;
@ -1811,7 +1811,7 @@ public static long[] convert(GetFsStatsResponseProto res) {
}
public static ReplicatedBlockStats convert(
GetFsBlocksStatsResponseProto res) {
GetFsReplicatedBlockStatsResponseProto res) {
return new ReplicatedBlockStats(res.getLowRedundancy(),
res.getCorruptBlocks(), res.getMissingBlocks(),
res.getMissingReplOneBlocks(), res.getBlocksInFuture(),
@ -1819,7 +1819,7 @@ public static ReplicatedBlockStats convert(
}
public static ECBlockGroupStats convert(
GetFsECBlockGroupsStatsResponseProto res) {
GetFsECBlockGroupStatsResponseProto res) {
return new ECBlockGroupStats(res.getLowRedundancy(),
res.getCorruptBlocks(), res.getMissingBlocks(),
res.getBlocksInFuture(), res.getPendingDeletionBlocks());
@ -2236,37 +2236,37 @@ public static GetFsStatsResponseProto convert(long[] fsStats) {
return result.build();
}
public static GetFsBlocksStatsResponseProto convert(
public static GetFsReplicatedBlockStatsResponseProto convert(
ReplicatedBlockStats replicatedBlockStats) {
GetFsBlocksStatsResponseProto.Builder result =
GetFsBlocksStatsResponseProto.newBuilder();
GetFsReplicatedBlockStatsResponseProto.Builder result =
GetFsReplicatedBlockStatsResponseProto.newBuilder();
result.setLowRedundancy(
replicatedBlockStats.getLowRedundancyBlocksStat());
replicatedBlockStats.getLowRedundancyBlocks());
result.setCorruptBlocks(
replicatedBlockStats.getCorruptBlocksStat());
replicatedBlockStats.getCorruptBlocks());
result.setMissingBlocks(
replicatedBlockStats.getMissingReplicaBlocksStat());
replicatedBlockStats.getMissingReplicaBlocks());
result.setMissingReplOneBlocks(
replicatedBlockStats.getMissingReplicationOneBlocksStat());
replicatedBlockStats.getMissingReplicationOneBlocks());
result.setBlocksInFuture(
replicatedBlockStats.getBytesInFutureBlocksStat());
replicatedBlockStats.getBytesInFutureBlocks());
result.setPendingDeletionBlocks(
replicatedBlockStats.getPendingDeletionBlocksStat());
replicatedBlockStats.getPendingDeletionBlocks());
return result.build();
}
public static GetFsECBlockGroupsStatsResponseProto convert(
public static GetFsECBlockGroupStatsResponseProto convert(
ECBlockGroupStats ecBlockGroupStats) {
GetFsECBlockGroupsStatsResponseProto.Builder result =
GetFsECBlockGroupsStatsResponseProto.newBuilder();
GetFsECBlockGroupStatsResponseProto.Builder result =
GetFsECBlockGroupStatsResponseProto.newBuilder();
result.setLowRedundancy(
ecBlockGroupStats.getLowRedundancyBlockGroupsStat());
result.setCorruptBlocks(ecBlockGroupStats.getCorruptBlockGroupsStat());
result.setMissingBlocks(ecBlockGroupStats.getMissingBlockGroupsStat());
ecBlockGroupStats.getLowRedundancyBlockGroups());
result.setCorruptBlocks(ecBlockGroupStats.getCorruptBlockGroups());
result.setMissingBlocks(ecBlockGroupStats.getMissingBlockGroups());
result.setBlocksInFuture(
ecBlockGroupStats.getBytesInFutureBlockGroupsStat());
ecBlockGroupStats.getBytesInFutureBlockGroups());
result.setPendingDeletionBlocks(
ecBlockGroupStats.getPendingDeletionBlockGroupsStat());
ecBlockGroupStats.getPendingDeletionBlocks());
return result.build();
}

View File

@ -327,10 +327,10 @@ message GetFsStatsResponseProto {
optional uint64 pending_deletion_blocks = 9;
}
message GetFsBlocksStatsRequestProto { // no input paramters
message GetFsReplicatedBlockStatsRequestProto { // no input paramters
}
message GetFsBlocksStatsResponseProto {
message GetFsReplicatedBlockStatsResponseProto {
required uint64 low_redundancy = 1;
required uint64 corrupt_blocks = 2;
required uint64 missing_blocks = 3;
@ -339,10 +339,10 @@ message GetFsBlocksStatsResponseProto {
required uint64 pending_deletion_blocks = 6;
}
message GetFsECBlockGroupsStatsRequestProto { // no input paramters
message GetFsECBlockGroupStatsRequestProto { // no input paramters
}
message GetFsECBlockGroupsStatsResponseProto {
message GetFsECBlockGroupStatsResponseProto {
required uint64 low_redundancy = 1;
required uint64 corrupt_blocks = 2;
required uint64 missing_blocks = 3;
@ -831,10 +831,10 @@ service ClientNamenodeProtocol {
rpc recoverLease(RecoverLeaseRequestProto)
returns(RecoverLeaseResponseProto);
rpc getFsStats(GetFsStatusRequestProto) returns(GetFsStatsResponseProto);
rpc getFsBlocksStats(GetFsBlocksStatsRequestProto)
returns (GetFsBlocksStatsResponseProto);
rpc getFsECBlockGroupsStats(GetFsECBlockGroupsStatsRequestProto)
returns (GetFsECBlockGroupsStatsResponseProto);
rpc getFsReplicatedBlockStats(GetFsReplicatedBlockStatsRequestProto)
returns (GetFsReplicatedBlockStatsResponseProto);
rpc getFsECBlockGroupStats(GetFsECBlockGroupStatsRequestProto)
returns (GetFsECBlockGroupStatsResponseProto);
rpc getDatanodeReport(GetDatanodeReportRequestProto)
returns(GetDatanodeReportResponseProto);
rpc getDatanodeStorageReport(GetDatanodeStorageReportRequestProto)

View File

@ -124,12 +124,12 @@
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileInfoResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileLinkInfoRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileLinkInfoResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsReplicatedBlockStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsReplicatedBlockStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsBlocksStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupsStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsStatusRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsBlocksStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupsStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetLinkTargetRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetLinkTargetResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetListingRequestProto;
@ -763,22 +763,22 @@ public GetFsStatsResponseProto getFsStats(RpcController controller,
}
@Override
public GetFsBlocksStatsResponseProto getFsBlocksStats(
RpcController controller, GetFsBlocksStatsRequestProto request)
public GetFsReplicatedBlockStatsResponseProto getFsReplicatedBlockStats(
RpcController controller, GetFsReplicatedBlockStatsRequestProto request)
throws ServiceException {
try {
return PBHelperClient.convert(server.getBlocksStats());
return PBHelperClient.convert(server.getReplicatedBlockStats());
} catch (IOException e) {
throw new ServiceException(e);
}
}
@Override
public GetFsECBlockGroupsStatsResponseProto getFsECBlockGroupsStats(
RpcController controller, GetFsECBlockGroupsStatsRequestProto request)
public GetFsECBlockGroupStatsResponseProto getFsECBlockGroupStats(
RpcController controller, GetFsECBlockGroupStatsRequestProto request)
throws ServiceException {
try {
return PBHelperClient.convert(server.getECBlockGroupsStats());
return PBHelperClient.convert(server.getECBlockGroupStats());
} catch (IOException e) {
throw new ServiceException(e);
}

View File

@ -233,47 +233,47 @@ public long getNumTimedOutPendingReconstructions() {
/** Used by metrics. */
public long getLowRedundancyBlocks() {
return neededReconstruction.getLowRedundancyBlocksStat();
return neededReconstruction.getLowRedundancyBlocks();
}
/** Used by metrics. */
public long getCorruptBlocks() {
return corruptReplicas.getCorruptBlocksStat();
return corruptReplicas.getCorruptBlocks();
}
/** Used by metrics. */
public long getMissingBlocks() {
return neededReconstruction.getCorruptBlocksStat();
return neededReconstruction.getCorruptBlocks();
}
/** Used by metrics. */
public long getMissingReplicationOneBlocks() {
return neededReconstruction.getCorruptReplicationOneBlocksStat();
return neededReconstruction.getCorruptReplicationOneBlocks();
}
/** Used by metrics. */
public long getPendingDeletionReplicatedBlocks() {
return invalidateBlocks.getBlocksStat();
return invalidateBlocks.getBlocks();
}
/** Used by metrics. */
public long getLowRedundancyECBlockGroups() {
return neededReconstruction.getLowRedundancyECBlockGroupsStat();
return neededReconstruction.getLowRedundancyECBlockGroups();
}
/** Used by metrics. */
public long getCorruptECBlockGroups() {
return corruptReplicas.getCorruptECBlockGroupsStat();
return corruptReplicas.getCorruptECBlockGroups();
}
/** Used by metrics. */
public long getMissingECBlockGroups() {
return neededReconstruction.getCorruptECBlockGroupsStat();
return neededReconstruction.getCorruptECBlockGroups();
}
/** Used by metrics. */
public long getPendingDeletionECBlockGroups() {
return invalidateBlocks.getECBlockGroupsStat();
public long getPendingDeletionECBlocks() {
return invalidateBlocks.getECBlocks();
}
/**
@ -748,7 +748,7 @@ public void metaSave(PrintWriter out) {
invalidateBlocks.dump(out);
//Dump corrupt blocks and their storageIDs
Set<Block> corruptBlocks = corruptReplicas.getCorruptBlocks();
Set<Block> corruptBlocks = corruptReplicas.getCorruptBlocksSet();
out.println("Corrupt Blocks:");
for(Block block : corruptBlocks) {
Collection<DatanodeDescriptor> corruptNodes =

View File

@ -240,7 +240,7 @@ long[] getCorruptBlockIdsForTesting(BlockType blockType,
* method to get the set of corrupt blocks in corruptReplicasMap.
* @return Set of Block objects
*/
Set<Block> getCorruptBlocks() {
Set<Block> getCorruptBlocksSet() {
Set<Block> corruptBlocks = new HashSet<Block>();
corruptBlocks.addAll(corruptReplicasMap.keySet());
return corruptBlocks;
@ -267,11 +267,11 @@ String getCorruptReason(Block block, DatanodeDescriptor node) {
}
}
long getCorruptBlocksStat() {
long getCorruptBlocks() {
return totalCorruptBlocks.longValue();
}
long getCorruptECBlockGroupsStat() {
long getCorruptECBlockGroups() {
return totalCorruptECBlockGroups.longValue();
}
}

View File

@ -53,9 +53,9 @@ class InvalidateBlocks {
private final Map<DatanodeInfo, LightWeightHashSet<Block>>
nodeToBlocks = new HashMap<>();
private final Map<DatanodeInfo, LightWeightHashSet<Block>>
nodeToECBlockGroups = new HashMap<>();
nodeToECBlocks = new HashMap<>();
private final LongAdder numBlocks = new LongAdder();
private final LongAdder numECBlockGroups = new LongAdder();
private final LongAdder numECBlocks = new LongAdder();
private final int blockInvalidateLimit;
/**
@ -87,7 +87,7 @@ private void printBlockDeletionTime(final Logger log) {
* @return The total number of blocks to be invalidated.
*/
long numBlocks() {
return getECBlockGroupsStat() + getBlocksStat();
return getECBlocks() + getBlocks();
}
/**
@ -95,7 +95,7 @@ long numBlocks() {
* {@link org.apache.hadoop.hdfs.protocol.BlockType#CONTIGUOUS}
* to be invalidated.
*/
long getBlocksStat() {
long getBlocks() {
return numBlocks.longValue();
}
@ -104,8 +104,8 @@ long getBlocksStat() {
* {@link org.apache.hadoop.hdfs.protocol.BlockType#STRIPED}
* to be invalidated.
*/
long getECBlockGroupsStat() {
return numECBlockGroups.longValue();
long getECBlocks() {
return numECBlocks.longValue();
}
private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn) {
@ -115,9 +115,9 @@ private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn) {
return null;
}
private LightWeightHashSet<Block> getECBlockGroupsSet(final DatanodeInfo dn) {
if (nodeToECBlockGroups.containsKey(dn)) {
return nodeToECBlockGroups.get(dn);
private LightWeightHashSet<Block> getECBlocksSet(final DatanodeInfo dn) {
if (nodeToECBlocks.containsKey(dn)) {
return nodeToECBlocks.get(dn);
}
return null;
}
@ -125,7 +125,7 @@ private LightWeightHashSet<Block> getECBlockGroupsSet(final DatanodeInfo dn) {
private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn,
final Block block) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
return getECBlockGroupsSet(dn);
return getECBlocksSet(dn);
} else {
return getBlocksSet(dn);
}
@ -134,8 +134,8 @@ private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn,
private void putBlocksSet(final DatanodeInfo dn, final Block block,
final LightWeightHashSet set) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
assert getECBlockGroupsSet(dn) == null;
nodeToECBlockGroups.put(dn, set);
assert getECBlocksSet(dn) == null;
nodeToECBlocks.put(dn, set);
} else {
assert getBlocksSet(dn) == null;
nodeToBlocks.put(dn, set);
@ -144,7 +144,7 @@ private void putBlocksSet(final DatanodeInfo dn, final Block block,
private long getBlockSetsSize(final DatanodeInfo dn) {
LightWeightHashSet<Block> replicaBlocks = getBlocksSet(dn);
LightWeightHashSet<Block> stripedBlocks = getECBlockGroupsSet(dn);
LightWeightHashSet<Block> stripedBlocks = getECBlocksSet(dn);
return ((replicaBlocks == null ? 0 : replicaBlocks.size()) +
(stripedBlocks == null ? 0 : stripedBlocks.size()));
}
@ -179,7 +179,7 @@ synchronized void add(final Block block, final DatanodeInfo datanode,
}
if (set.add(block)) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
numECBlockGroups.increment();
numECBlocks.increment();
} else {
numBlocks.increment();
}
@ -196,9 +196,9 @@ synchronized void remove(final DatanodeInfo dn) {
if (replicaBlockSets != null) {
numBlocks.add(replicaBlockSets.size() * -1);
}
LightWeightHashSet<Block> blockGroupSets = nodeToECBlockGroups.remove(dn);
if (blockGroupSets != null) {
numECBlockGroups.add(blockGroupSets.size() * -1);
LightWeightHashSet<Block> ecBlocksSet = nodeToECBlocks.remove(dn);
if (ecBlocksSet != null) {
numECBlocks.add(ecBlocksSet.size() * -1);
}
}
@ -207,7 +207,7 @@ synchronized void remove(final DatanodeInfo dn, final Block block) {
final LightWeightHashSet<Block> v = getBlocksSet(dn, block);
if (v != null && v.remove(block)) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
numECBlockGroups.decrement();
numECBlocks.decrement();
} else {
numBlocks.decrement();
}
@ -231,21 +231,21 @@ private void dumpBlockSet(final Map<DatanodeInfo,
/** Print the contents to out. */
synchronized void dump(final PrintWriter out) {
final int size = nodeToBlocks.values().size() +
nodeToECBlockGroups.values().size();
nodeToECBlocks.values().size();
out.println("Metasave: Blocks " + numBlocks()
+ " waiting deletion from " + size + " datanodes.");
if (size == 0) {
return;
}
dumpBlockSet(nodeToBlocks, out);
dumpBlockSet(nodeToECBlockGroups, out);
dumpBlockSet(nodeToECBlocks, out);
}
/** @return a list of the storage IDs. */
synchronized List<DatanodeInfo> getDatanodes() {
HashSet<DatanodeInfo> set = new HashSet<>();
set.addAll(nodeToBlocks.keySet());
set.addAll(nodeToECBlockGroups.keySet());
set.addAll(nodeToECBlocks.keySet());
return new ArrayList<>(set);
}
@ -289,9 +289,9 @@ synchronized List<Block> invalidateWork(final DatanodeDescriptor dn) {
remainingLimit = getBlocksToInvalidateByLimit(nodeToBlocks.get(dn),
toInvalidate, numBlocks, remainingLimit);
}
if ((remainingLimit > 0) && (nodeToECBlockGroups.get(dn) != null)) {
getBlocksToInvalidateByLimit(nodeToECBlockGroups.get(dn),
toInvalidate, numECBlockGroups, remainingLimit);
if ((remainingLimit > 0) && (nodeToECBlocks.get(dn) != null)) {
getBlocksToInvalidateByLimit(nodeToECBlocks.get(dn),
toInvalidate, numECBlocks, remainingLimit);
}
if (toInvalidate.size() > 0 && getBlockSetsSize(dn) == 0) {
remove(dn);
@ -302,8 +302,8 @@ synchronized List<Block> invalidateWork(final DatanodeDescriptor dn) {
synchronized void clear() {
nodeToBlocks.clear();
nodeToECBlockGroups.clear();
nodeToECBlocks.clear();
numBlocks.reset();
numECBlockGroups.reset();
numECBlocks.reset();
}
}

View File

@ -144,33 +144,33 @@ synchronized int getCorruptBlockSize() {
/** Return the number of corrupt blocks with replication factor 1 */
long getCorruptReplicationOneBlockSize() {
return getCorruptReplicationOneBlocksStat();
return getCorruptReplicationOneBlocks();
}
/**
* Return under replicated block count excluding corrupt replicas.
*/
long getLowRedundancyBlocksStat() {
return lowRedundancyBlocks.longValue() - getCorruptBlocksStat();
long getLowRedundancyBlocks() {
return lowRedundancyBlocks.longValue() - getCorruptBlocks();
}
long getCorruptBlocksStat() {
long getCorruptBlocks() {
return corruptBlocks.longValue();
}
long getCorruptReplicationOneBlocksStat() {
long getCorruptReplicationOneBlocks() {
return corruptReplicationOneBlocks.longValue();
}
/**
* Return low redundancy striped blocks excluding corrupt blocks.
*/
long getLowRedundancyECBlockGroupsStat() {
long getLowRedundancyECBlockGroups() {
return lowRedundancyECBlockGroups.longValue() -
getCorruptECBlockGroupsStat();
getCorruptECBlockGroups();
}
long getCorruptECBlockGroupsStat() {
long getCorruptECBlockGroups() {
return corruptECBlockGroups.longValue();
}

View File

@ -89,7 +89,6 @@
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_REPLICATION_KEY;
import static org.apache.hadoop.hdfs.server.namenode.FSDirStatAndListingOp.*;
import org.apache.hadoop.crypto.key.KeyProvider.KeyVersion;
import org.apache.hadoop.hdfs.protocol.ReplicatedBlockStats;
import org.apache.hadoop.hdfs.protocol.ECBlockGroupStats;
import org.apache.hadoop.hdfs.protocol.OpenFileEntry;
@ -4081,9 +4080,9 @@ long[] getStats() {
* Get statistics pertaining to blocks of type {@link BlockType#CONTIGUOUS}
* in the filesystem.
* <p>
* @see ClientProtocol#getBlocksStats()
* @see ClientProtocol#getReplicatedBlockStats()
*/
ReplicatedBlockStats getBlocksStats() {
ReplicatedBlockStats getReplicatedBlockStats() {
return new ReplicatedBlockStats(getLowRedundancyReplicatedBlocks(),
getCorruptReplicatedBlocks(), getMissingReplicatedBlocks(),
getMissingReplicationOneBlocks(), getBytesInFutureReplicatedBlocks(),
@ -4094,12 +4093,12 @@ ReplicatedBlockStats getBlocksStats() {
* Get statistics pertaining to blocks of type {@link BlockType#STRIPED}
* in the filesystem.
* <p>
* @see ClientProtocol#getECBlockGroupsStats()
* @see ClientProtocol#getECBlockGroupStats()
*/
ECBlockGroupStats getECBlockGroupsStats() {
ECBlockGroupStats getECBlockGroupStats() {
return new ECBlockGroupStats(getLowRedundancyECBlockGroups(),
getCorruptECBlockGroups(), getMissingECBlockGroups(),
getBytesInFutureECBlockGroups(), getPendingDeletionECBlockGroups());
getBytesInFutureECBlockGroups(), getPendingDeletionECBlocks());
}
@Override // FSNamesystemMBean
@ -4712,10 +4711,10 @@ public long getBytesInFutureECBlockGroups() {
}
@Override // ECBlockGroupsMBean
@Metric({"PendingDeletionECBlockGroups", "Number of erasure coded block " +
"groups that are pending deletion"})
public long getPendingDeletionECBlockGroups() {
return blockManager.getPendingDeletionECBlockGroups();
@Metric({"PendingDeletionECBlocks", "Number of erasure coded blocks " +
"that are pending deletion"})
public long getPendingDeletionECBlocks() {
return blockManager.getPendingDeletionECBlocks();
}
@Override

View File

@ -1163,17 +1163,17 @@ public long[] getStats() throws IOException {
}
@Override // ClientProtocol
public ReplicatedBlockStats getBlocksStats() throws IOException {
public ReplicatedBlockStats getReplicatedBlockStats() throws IOException {
checkNNStartup();
namesystem.checkOperation(OperationCategory.READ);
return namesystem.getBlocksStats();
return namesystem.getReplicatedBlockStats();
}
@Override // ClientProtocol
public ECBlockGroupStats getECBlockGroupsStats() throws IOException {
public ECBlockGroupStats getECBlockGroupStats() throws IOException {
checkNNStartup();
namesystem.checkOperation(OperationCategory.READ);
return namesystem.getECBlockGroupsStats();
return namesystem.getECBlockGroupStats();
}
@Override // ClientProtocol

View File

@ -53,7 +53,7 @@ public interface ECBlockGroupsMBean {
long getBytesInFutureECBlockGroups();
/**
* Return count of erasure coded block groups that are pending deletion.
* Return count of erasure coded blocks that are pending deletion.
*/
long getPendingDeletionECBlockGroups();
long getPendingDeletionECBlocks();
}

View File

@ -534,30 +534,31 @@ public void report(String[] argv, int i) throws IOException {
* minutes. Use "-metaSave" to list of all such blocks and accurate
* counts.
*/
ReplicatedBlockStats replicatedBlockStats = dfs.getClient().getNamenode().getBlocksStats();
ReplicatedBlockStats replicatedBlockStats =
dfs.getClient().getNamenode().getReplicatedBlockStats();
System.out.println("Replicated Blocks:");
System.out.println("\tUnder replicated blocks: " +
replicatedBlockStats.getLowRedundancyBlocksStat());
replicatedBlockStats.getLowRedundancyBlocks());
System.out.println("\tBlocks with corrupt replicas: " +
replicatedBlockStats.getCorruptBlocksStat());
replicatedBlockStats.getCorruptBlocks());
System.out.println("\tMissing blocks: " +
replicatedBlockStats.getMissingReplicaBlocksStat());
replicatedBlockStats.getMissingReplicaBlocks());
System.out.println("\tMissing blocks (with replication factor 1): " +
replicatedBlockStats.getMissingReplicationOneBlocksStat());
replicatedBlockStats.getMissingReplicationOneBlocks());
System.out.println("\tPending deletion blocks: " +
replicatedBlockStats.getPendingDeletionBlocksStat());
replicatedBlockStats.getPendingDeletionBlocks());
ECBlockGroupStats ecBlockGroupStats =
dfs.getClient().getNamenode().getECBlockGroupsStats();
dfs.getClient().getNamenode().getECBlockGroupStats();
System.out.println("Erasure Coded Block Groups: ");
System.out.println("\tLow redundancy block groups: " +
ecBlockGroupStats.getLowRedundancyBlockGroupsStat());
ecBlockGroupStats.getLowRedundancyBlockGroups());
System.out.println("\tBlock groups with corrupt internal blocks: " +
ecBlockGroupStats.getCorruptBlockGroupsStat());
ecBlockGroupStats.getCorruptBlockGroups());
System.out.println("\tMissing block groups: " +
ecBlockGroupStats.getMissingBlockGroupsStat());
System.out.println("\tPending deletion block groups: " +
ecBlockGroupStats.getPendingDeletionBlockGroupsStat());
ecBlockGroupStats.getMissingBlockGroups());
System.out.println("\tPending deletion blocks: " +
ecBlockGroupStats.getPendingDeletionBlocks());
System.out.println();

View File

@ -1657,8 +1657,8 @@ public static boolean verifyFileReplicasOnStorageType(FileSystem fs,
/**
* Verify the aggregated {@link ClientProtocol#getStats()} block counts equal
* the sum of {@link ClientProtocol#getBlocksStats()} and
* {@link ClientProtocol#getECBlockGroupsStats()}.
* the sum of {@link ClientProtocol#getReplicatedBlockStats()} and
* {@link ClientProtocol#getECBlockGroupStats()}.
* @throws Exception
*/
public static void verifyClientStats(Configuration conf,
@ -1668,35 +1668,35 @@ public static void verifyClientStats(Configuration conf,
ClientProtocol.class).getProxy();
long[] aggregatedStats = cluster.getNameNode().getRpcServer().getStats();
ReplicatedBlockStats replicatedBlockStats =
client.getBlocksStats();
ECBlockGroupStats ecBlockGroupStats = client.getECBlockGroupsStats();
client.getReplicatedBlockStats();
ECBlockGroupStats ecBlockGroupStats = client.getECBlockGroupStats();
assertEquals("Under replicated stats not matching!",
aggregatedStats[ClientProtocol.GET_STATS_LOW_REDUNDANCY_IDX],
aggregatedStats[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX]);
assertEquals("Low redundancy stats not matching!",
aggregatedStats[ClientProtocol.GET_STATS_LOW_REDUNDANCY_IDX],
replicatedBlockStats.getLowRedundancyBlocksStat() +
ecBlockGroupStats.getLowRedundancyBlockGroupsStat());
replicatedBlockStats.getLowRedundancyBlocks() +
ecBlockGroupStats.getLowRedundancyBlockGroups());
assertEquals("Corrupt blocks stats not matching!",
aggregatedStats[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX],
replicatedBlockStats.getCorruptBlocksStat() +
ecBlockGroupStats.getCorruptBlockGroupsStat());
replicatedBlockStats.getCorruptBlocks() +
ecBlockGroupStats.getCorruptBlockGroups());
assertEquals("Missing blocks stats not matching!",
aggregatedStats[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX],
replicatedBlockStats.getMissingReplicaBlocksStat() +
ecBlockGroupStats.getMissingBlockGroupsStat());
replicatedBlockStats.getMissingReplicaBlocks() +
ecBlockGroupStats.getMissingBlockGroups());
assertEquals("Missing blocks with replication factor one not matching!",
aggregatedStats[ClientProtocol.GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX],
replicatedBlockStats.getMissingReplicationOneBlocksStat());
replicatedBlockStats.getMissingReplicationOneBlocks());
assertEquals("Bytes in future blocks stats not matching!",
aggregatedStats[ClientProtocol.GET_STATS_BYTES_IN_FUTURE_BLOCKS_IDX],
replicatedBlockStats.getBytesInFutureBlocksStat() +
ecBlockGroupStats.getBytesInFutureBlockGroupsStat());
replicatedBlockStats.getBytesInFutureBlocks() +
ecBlockGroupStats.getBytesInFutureBlockGroups());
assertEquals("Pending deletion blocks stats not matching!",
aggregatedStats[ClientProtocol.GET_STATS_PENDING_DELETION_BLOCKS_IDX],
replicatedBlockStats.getPendingDeletionBlocksStat() +
ecBlockGroupStats.getPendingDeletionBlockGroupsStat());
replicatedBlockStats.getPendingDeletionBlocks() +
ecBlockGroupStats.getPendingDeletionBlocks());
}
/**

View File

@ -268,9 +268,9 @@ public void testDatanodeReRegistration() throws Exception {
"Striped BlockGroups!",
(long) expected, invalidateBlocks.numBlocks());
assertEquals("Unexpected invalidate count for replicas!",
totalReplicas, invalidateBlocks.getBlocksStat());
totalReplicas, invalidateBlocks.getBlocks());
assertEquals("Unexpected invalidate count for striped block groups!",
totalStripedDataBlocks, invalidateBlocks.getECBlockGroupsStat());
totalStripedDataBlocks, invalidateBlocks.getECBlocks());
} finally {
namesystem.writeUnlock();
}

View File

@ -78,10 +78,10 @@ private void verifyCorruptBlocksCount(CorruptReplicasMap corruptReplicasMap,
assertEquals("Unexpected total corrupt blocks count!",
totalExpectedCorruptBlocks, corruptReplicasMap.size());
assertEquals("Unexpected replica blocks count!",
expectedReplicaCount, corruptReplicasMap.getCorruptBlocksStat());
expectedReplicaCount, corruptReplicasMap.getCorruptBlocks());
assertEquals("Unexpected striped blocks count!",
expectedStripedBlockCount,
corruptReplicasMap.getCorruptECBlockGroupsStat());
corruptReplicasMap.getCorruptECBlockGroups());
}
@Test
@ -93,9 +93,9 @@ public void testCorruptReplicaInfo()
assertEquals("Total number of corrupt blocks must initially be 0!",
0, crm.size());
assertEquals("Number of corrupt replicas must initially be 0!",
0, crm.getCorruptBlocksStat());
0, crm.getCorruptBlocks());
assertEquals("Number of corrupt striped block groups must initially be 0!",
0, crm.getCorruptECBlockGroupsStat());
0, crm.getCorruptECBlockGroups());
assertNull("Param n cannot be less than 0",
crm.getCorruptBlockIdsForTesting(BlockType.CONTIGUOUS, -1, null));
assertNull("Param n cannot be greater than 100",

View File

@ -50,16 +50,16 @@ private void verifyBlockStats(LowRedundancyBlocks queues,
int corruptReplicationOneCount, int lowRedundancyStripedCount,
int corruptStripedCount) {
assertEquals("Low redundancy replica count incorrect!",
lowRedundancyReplicaCount, queues.getLowRedundancyBlocksStat());
lowRedundancyReplicaCount, queues.getLowRedundancyBlocks());
assertEquals("Corrupt replica count incorrect!",
corruptReplicaCount, queues.getCorruptBlocksStat());
corruptReplicaCount, queues.getCorruptBlocks());
assertEquals("Corrupt replica one count incorrect!",
corruptReplicationOneCount,
queues.getCorruptReplicationOneBlocksStat());
queues.getCorruptReplicationOneBlocks());
assertEquals("Low redundancy striped blocks count incorrect!",
lowRedundancyStripedCount, queues.getLowRedundancyECBlockGroupsStat());
lowRedundancyStripedCount, queues.getLowRedundancyECBlockGroups());
assertEquals("Corrupt striped blocks count incorrect!",
corruptStripedCount, queues.getCorruptECBlockGroupsStat());
corruptStripedCount, queues.getCorruptECBlockGroups());
assertEquals("Low Redundancy count incorrect!",
lowRedundancyReplicaCount + lowRedundancyStripedCount,
queues.getLowRedundancyBlockCount());

View File

@ -449,7 +449,7 @@ private void verifyAggregatedMetricsTally() throws Exception {
assertEquals("Pending deletion blocks metrics not matching!",
namesystem.getPendingDeletionBlocks(),
namesystem.getPendingDeletionReplicatedBlocks() +
namesystem.getPendingDeletionECBlockGroups());
namesystem.getPendingDeletionECBlocks());
}
/** Corrupt a block and ensure metrics reflects it */

View File

@ -778,9 +778,9 @@ private void verifyNodesAndCorruptBlocks(
assertEquals(numCorruptBlocks + numCorruptECBlockGroups,
client.getCorruptBlocksCount());
assertEquals(numCorruptBlocks, client.getNamenode()
.getBlocksStats().getCorruptBlocksStat());
.getReplicatedBlockStats().getCorruptBlocks());
assertEquals(numCorruptECBlockGroups, client.getNamenode()
.getECBlockGroupsStats().getCorruptBlockGroupsStat());
.getECBlockGroupStats().getCorruptBlockGroups());
}
@Test