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

View File

@ -24,66 +24,66 @@
* Get statistics pertaining to blocks of type {@link BlockType#CONTIGUOUS} * Get statistics pertaining to blocks of type {@link BlockType#CONTIGUOUS}
* in the filesystem. * in the filesystem.
* <p> * <p>
* @see ClientProtocol#getBlocksStats() * @see ClientProtocol#getReplicatedBlockStats()
*/ */
@InterfaceAudience.Public @InterfaceAudience.Public
@InterfaceStability.Evolving @InterfaceStability.Evolving
public final class ReplicatedBlockStats { public final class ReplicatedBlockStats {
private final long lowRedundancyBlocksStat; private final long lowRedundancyBlocks;
private final long corruptBlocksStat; private final long corruptBlocks;
private final long missingBlocksStat; private final long missingBlocks;
private final long missingReplicationOneBlocksStat; private final long missingReplicationOneBlocks;
private final long bytesInFutureBlocksStat; private final long bytesInFutureBlocks;
private final long pendingDeletionBlocksStat; private final long pendingDeletionBlocks;
public ReplicatedBlockStats(long lowRedundancyBlocksStat, public ReplicatedBlockStats(long lowRedundancyBlocks,
long corruptBlocksStat, long missingBlocksStat, long corruptBlocks, long missingBlocks,
long missingReplicationOneBlocksStat, long bytesInFutureBlocksStat, long missingReplicationOneBlocks, long bytesInFutureBlocks,
long pendingDeletionBlocksStat) { long pendingDeletionBlocks) {
this.lowRedundancyBlocksStat = lowRedundancyBlocksStat; this.lowRedundancyBlocks = lowRedundancyBlocks;
this.corruptBlocksStat = corruptBlocksStat; this.corruptBlocks = corruptBlocks;
this.missingBlocksStat = missingBlocksStat; this.missingBlocks = missingBlocks;
this.missingReplicationOneBlocksStat = missingReplicationOneBlocksStat; this.missingReplicationOneBlocks = missingReplicationOneBlocks;
this.bytesInFutureBlocksStat = bytesInFutureBlocksStat; this.bytesInFutureBlocks = bytesInFutureBlocks;
this.pendingDeletionBlocksStat = pendingDeletionBlocksStat; this.pendingDeletionBlocks = pendingDeletionBlocks;
} }
public long getLowRedundancyBlocksStat() { public long getLowRedundancyBlocks() {
return lowRedundancyBlocksStat; return lowRedundancyBlocks;
} }
public long getCorruptBlocksStat() { public long getCorruptBlocks() {
return corruptBlocksStat; return corruptBlocks;
} }
public long getMissingReplicaBlocksStat() { public long getMissingReplicaBlocks() {
return missingBlocksStat; return missingBlocks;
} }
public long getMissingReplicationOneBlocksStat() { public long getMissingReplicationOneBlocks() {
return missingReplicationOneBlocksStat; return missingReplicationOneBlocks;
} }
public long getBytesInFutureBlocksStat() { public long getBytesInFutureBlocks() {
return bytesInFutureBlocksStat; return bytesInFutureBlocks;
} }
public long getPendingDeletionBlocksStat() { public long getPendingDeletionBlocks() {
return pendingDeletionBlocksStat; return pendingDeletionBlocks;
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder statsBuilder = new StringBuilder(); StringBuilder statsBuilder = new StringBuilder();
statsBuilder.append("ReplicatedBlocksStats=[") statsBuilder.append("ReplicatedBlockStats=[")
.append("LowRedundancyBlocks=").append(getLowRedundancyBlocksStat()) .append("LowRedundancyBlocks=").append(getLowRedundancyBlocks())
.append(", CorruptBlocks=").append(getCorruptBlocksStat()) .append(", CorruptBlocks=").append(getCorruptBlocks())
.append(", MissingReplicaBlocks=").append(getMissingReplicaBlocksStat()) .append(", MissingReplicaBlocks=").append(getMissingReplicaBlocks())
.append(", MissingReplicationOneBlocks=").append( .append(", MissingReplicationOneBlocks=").append(
getMissingReplicationOneBlocksStat()) getMissingReplicationOneBlocks())
.append(", BytesInFutureBlocks=").append(getBytesInFutureBlocksStat()) .append(", BytesInFutureBlocks=").append(getBytesInFutureBlocks())
.append(", PendingDeletionBlocks=").append( .append(", PendingDeletionBlocks=").append(
getPendingDeletionBlocksStat()) getPendingDeletionBlocks())
.append("]"); .append("]");
return statsBuilder.toString(); 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.GetFileInfoResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileLinkInfoRequestProto; 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.GetFileLinkInfoResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupsStatsRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupStatsRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsBlocksStatsRequestProto; 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.GetFsStatusRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetLinkTargetRequestProto; 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.GetLinkTargetResponseProto;
@ -246,13 +246,13 @@ public class ClientNamenodeProtocolTranslatorPB implements
private final static GetFsStatusRequestProto VOID_GET_FSSTATUS_REQUEST = private final static GetFsStatusRequestProto VOID_GET_FSSTATUS_REQUEST =
GetFsStatusRequestProto.newBuilder().build(); GetFsStatusRequestProto.newBuilder().build();
private final static GetFsBlocksStatsRequestProto private final static GetFsReplicatedBlockStatsRequestProto
VOID_GET_FS_REPLICABLOCKS_STATS_REQUEST = VOID_GET_FS_REPLICATED_BLOCK_STATS_REQUEST =
GetFsBlocksStatsRequestProto.newBuilder().build(); GetFsReplicatedBlockStatsRequestProto.newBuilder().build();
private final static GetFsECBlockGroupsStatsRequestProto private final static GetFsECBlockGroupStatsRequestProto
VOID_GET_FS_ECBLOCKGROUPS_STATS_REQUEST = VOID_GET_FS_ECBLOCKGROUP_STATS_REQUEST =
GetFsECBlockGroupsStatsRequestProto.newBuilder().build(); GetFsECBlockGroupStatsRequestProto.newBuilder().build();
private final static RollEditsRequestProto VOID_ROLLEDITS_REQUEST = private final static RollEditsRequestProto VOID_ROLLEDITS_REQUEST =
RollEditsRequestProto.getDefaultInstance(); RollEditsRequestProto.getDefaultInstance();
@ -695,20 +695,20 @@ public long[] getStats() throws IOException {
} }
@Override @Override
public ReplicatedBlockStats getBlocksStats() throws IOException { public ReplicatedBlockStats getReplicatedBlockStats() throws IOException {
try { try {
return PBHelperClient.convert(rpcProxy.getFsBlocksStats(null, return PBHelperClient.convert(rpcProxy.getFsReplicatedBlockStats(null,
VOID_GET_FS_REPLICABLOCKS_STATS_REQUEST)); VOID_GET_FS_REPLICATED_BLOCK_STATS_REQUEST));
} catch (ServiceException e) { } catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e); throw ProtobufHelper.getRemoteException(e);
} }
} }
@Override @Override
public ECBlockGroupStats getECBlockGroupsStats() throws IOException { public ECBlockGroupStats getECBlockGroupStats() throws IOException {
try { try {
return PBHelperClient.convert(rpcProxy.getFsECBlockGroupsStats(null, return PBHelperClient.convert(rpcProxy.getFsECBlockGroupStats(null,
VOID_GET_FS_ECBLOCKGROUPS_STATS_REQUEST)); VOID_GET_FS_ECBLOCKGROUP_STATS_REQUEST));
} catch (ServiceException e) { } catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(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.DatanodeReportTypeProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.DatanodeStorageReportProto; 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.GetEditsFromTxidResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupsStatsResponseProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsECBlockGroupStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFsBlocksStatsResponseProto; 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.GetFsStatsResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.OpenFilesBatchResponseProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.OpenFilesBatchResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.RollingUpgradeActionProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.RollingUpgradeActionProto;
@ -1811,7 +1811,7 @@ public static long[] convert(GetFsStatsResponseProto res) {
} }
public static ReplicatedBlockStats convert( public static ReplicatedBlockStats convert(
GetFsBlocksStatsResponseProto res) { GetFsReplicatedBlockStatsResponseProto res) {
return new ReplicatedBlockStats(res.getLowRedundancy(), return new ReplicatedBlockStats(res.getLowRedundancy(),
res.getCorruptBlocks(), res.getMissingBlocks(), res.getCorruptBlocks(), res.getMissingBlocks(),
res.getMissingReplOneBlocks(), res.getBlocksInFuture(), res.getMissingReplOneBlocks(), res.getBlocksInFuture(),
@ -1819,7 +1819,7 @@ public static ReplicatedBlockStats convert(
} }
public static ECBlockGroupStats convert( public static ECBlockGroupStats convert(
GetFsECBlockGroupsStatsResponseProto res) { GetFsECBlockGroupStatsResponseProto res) {
return new ECBlockGroupStats(res.getLowRedundancy(), return new ECBlockGroupStats(res.getLowRedundancy(),
res.getCorruptBlocks(), res.getMissingBlocks(), res.getCorruptBlocks(), res.getMissingBlocks(),
res.getBlocksInFuture(), res.getPendingDeletionBlocks()); res.getBlocksInFuture(), res.getPendingDeletionBlocks());
@ -2236,37 +2236,37 @@ public static GetFsStatsResponseProto convert(long[] fsStats) {
return result.build(); return result.build();
} }
public static GetFsBlocksStatsResponseProto convert( public static GetFsReplicatedBlockStatsResponseProto convert(
ReplicatedBlockStats replicatedBlockStats) { ReplicatedBlockStats replicatedBlockStats) {
GetFsBlocksStatsResponseProto.Builder result = GetFsReplicatedBlockStatsResponseProto.Builder result =
GetFsBlocksStatsResponseProto.newBuilder(); GetFsReplicatedBlockStatsResponseProto.newBuilder();
result.setLowRedundancy( result.setLowRedundancy(
replicatedBlockStats.getLowRedundancyBlocksStat()); replicatedBlockStats.getLowRedundancyBlocks());
result.setCorruptBlocks( result.setCorruptBlocks(
replicatedBlockStats.getCorruptBlocksStat()); replicatedBlockStats.getCorruptBlocks());
result.setMissingBlocks( result.setMissingBlocks(
replicatedBlockStats.getMissingReplicaBlocksStat()); replicatedBlockStats.getMissingReplicaBlocks());
result.setMissingReplOneBlocks( result.setMissingReplOneBlocks(
replicatedBlockStats.getMissingReplicationOneBlocksStat()); replicatedBlockStats.getMissingReplicationOneBlocks());
result.setBlocksInFuture( result.setBlocksInFuture(
replicatedBlockStats.getBytesInFutureBlocksStat()); replicatedBlockStats.getBytesInFutureBlocks());
result.setPendingDeletionBlocks( result.setPendingDeletionBlocks(
replicatedBlockStats.getPendingDeletionBlocksStat()); replicatedBlockStats.getPendingDeletionBlocks());
return result.build(); return result.build();
} }
public static GetFsECBlockGroupsStatsResponseProto convert( public static GetFsECBlockGroupStatsResponseProto convert(
ECBlockGroupStats ecBlockGroupStats) { ECBlockGroupStats ecBlockGroupStats) {
GetFsECBlockGroupsStatsResponseProto.Builder result = GetFsECBlockGroupStatsResponseProto.Builder result =
GetFsECBlockGroupsStatsResponseProto.newBuilder(); GetFsECBlockGroupStatsResponseProto.newBuilder();
result.setLowRedundancy( result.setLowRedundancy(
ecBlockGroupStats.getLowRedundancyBlockGroupsStat()); ecBlockGroupStats.getLowRedundancyBlockGroups());
result.setCorruptBlocks(ecBlockGroupStats.getCorruptBlockGroupsStat()); result.setCorruptBlocks(ecBlockGroupStats.getCorruptBlockGroups());
result.setMissingBlocks(ecBlockGroupStats.getMissingBlockGroupsStat()); result.setMissingBlocks(ecBlockGroupStats.getMissingBlockGroups());
result.setBlocksInFuture( result.setBlocksInFuture(
ecBlockGroupStats.getBytesInFutureBlockGroupsStat()); ecBlockGroupStats.getBytesInFutureBlockGroups());
result.setPendingDeletionBlocks( result.setPendingDeletionBlocks(
ecBlockGroupStats.getPendingDeletionBlockGroupsStat()); ecBlockGroupStats.getPendingDeletionBlocks());
return result.build(); return result.build();
} }

View File

@ -327,10 +327,10 @@ message GetFsStatsResponseProto {
optional uint64 pending_deletion_blocks = 9; 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 low_redundancy = 1;
required uint64 corrupt_blocks = 2; required uint64 corrupt_blocks = 2;
required uint64 missing_blocks = 3; required uint64 missing_blocks = 3;
@ -339,10 +339,10 @@ message GetFsBlocksStatsResponseProto {
required uint64 pending_deletion_blocks = 6; 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 low_redundancy = 1;
required uint64 corrupt_blocks = 2; required uint64 corrupt_blocks = 2;
required uint64 missing_blocks = 3; required uint64 missing_blocks = 3;
@ -831,10 +831,10 @@ service ClientNamenodeProtocol {
rpc recoverLease(RecoverLeaseRequestProto) rpc recoverLease(RecoverLeaseRequestProto)
returns(RecoverLeaseResponseProto); returns(RecoverLeaseResponseProto);
rpc getFsStats(GetFsStatusRequestProto) returns(GetFsStatsResponseProto); rpc getFsStats(GetFsStatusRequestProto) returns(GetFsStatsResponseProto);
rpc getFsBlocksStats(GetFsBlocksStatsRequestProto) rpc getFsReplicatedBlockStats(GetFsReplicatedBlockStatsRequestProto)
returns (GetFsBlocksStatsResponseProto); returns (GetFsReplicatedBlockStatsResponseProto);
rpc getFsECBlockGroupsStats(GetFsECBlockGroupsStatsRequestProto) rpc getFsECBlockGroupStats(GetFsECBlockGroupStatsRequestProto)
returns (GetFsECBlockGroupsStatsResponseProto); returns (GetFsECBlockGroupStatsResponseProto);
rpc getDatanodeReport(GetDatanodeReportRequestProto) rpc getDatanodeReport(GetDatanodeReportRequestProto)
returns(GetDatanodeReportResponseProto); returns(GetDatanodeReportResponseProto);
rpc getDatanodeStorageReport(GetDatanodeStorageReportRequestProto) 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.GetFileInfoResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetFileLinkInfoRequestProto; 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.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.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.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.GetLinkTargetRequestProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetLinkTargetResponseProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetLinkTargetResponseProto;
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetListingRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetListingRequestProto;
@ -763,22 +763,22 @@ public GetFsStatsResponseProto getFsStats(RpcController controller,
} }
@Override @Override
public GetFsBlocksStatsResponseProto getFsBlocksStats( public GetFsReplicatedBlockStatsResponseProto getFsReplicatedBlockStats(
RpcController controller, GetFsBlocksStatsRequestProto request) RpcController controller, GetFsReplicatedBlockStatsRequestProto request)
throws ServiceException { throws ServiceException {
try { try {
return PBHelperClient.convert(server.getBlocksStats()); return PBHelperClient.convert(server.getReplicatedBlockStats());
} catch (IOException e) { } catch (IOException e) {
throw new ServiceException(e); throw new ServiceException(e);
} }
} }
@Override @Override
public GetFsECBlockGroupsStatsResponseProto getFsECBlockGroupsStats( public GetFsECBlockGroupStatsResponseProto getFsECBlockGroupStats(
RpcController controller, GetFsECBlockGroupsStatsRequestProto request) RpcController controller, GetFsECBlockGroupStatsRequestProto request)
throws ServiceException { throws ServiceException {
try { try {
return PBHelperClient.convert(server.getECBlockGroupsStats()); return PBHelperClient.convert(server.getECBlockGroupStats());
} catch (IOException e) { } catch (IOException e) {
throw new ServiceException(e); throw new ServiceException(e);
} }

View File

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

View File

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

View File

@ -53,9 +53,9 @@ class InvalidateBlocks {
private final Map<DatanodeInfo, LightWeightHashSet<Block>> private final Map<DatanodeInfo, LightWeightHashSet<Block>>
nodeToBlocks = new HashMap<>(); nodeToBlocks = new HashMap<>();
private final Map<DatanodeInfo, LightWeightHashSet<Block>> private final Map<DatanodeInfo, LightWeightHashSet<Block>>
nodeToECBlockGroups = new HashMap<>(); nodeToECBlocks = new HashMap<>();
private final LongAdder numBlocks = new LongAdder(); private final LongAdder numBlocks = new LongAdder();
private final LongAdder numECBlockGroups = new LongAdder(); private final LongAdder numECBlocks = new LongAdder();
private final int blockInvalidateLimit; private final int blockInvalidateLimit;
/** /**
@ -87,7 +87,7 @@ private void printBlockDeletionTime(final Logger log) {
* @return The total number of blocks to be invalidated. * @return The total number of blocks to be invalidated.
*/ */
long numBlocks() { long numBlocks() {
return getECBlockGroupsStat() + getBlocksStat(); return getECBlocks() + getBlocks();
} }
/** /**
@ -95,7 +95,7 @@ long numBlocks() {
* {@link org.apache.hadoop.hdfs.protocol.BlockType#CONTIGUOUS} * {@link org.apache.hadoop.hdfs.protocol.BlockType#CONTIGUOUS}
* to be invalidated. * to be invalidated.
*/ */
long getBlocksStat() { long getBlocks() {
return numBlocks.longValue(); return numBlocks.longValue();
} }
@ -104,8 +104,8 @@ long getBlocksStat() {
* {@link org.apache.hadoop.hdfs.protocol.BlockType#STRIPED} * {@link org.apache.hadoop.hdfs.protocol.BlockType#STRIPED}
* to be invalidated. * to be invalidated.
*/ */
long getECBlockGroupsStat() { long getECBlocks() {
return numECBlockGroups.longValue(); return numECBlocks.longValue();
} }
private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn) { private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn) {
@ -115,9 +115,9 @@ private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn) {
return null; return null;
} }
private LightWeightHashSet<Block> getECBlockGroupsSet(final DatanodeInfo dn) { private LightWeightHashSet<Block> getECBlocksSet(final DatanodeInfo dn) {
if (nodeToECBlockGroups.containsKey(dn)) { if (nodeToECBlocks.containsKey(dn)) {
return nodeToECBlockGroups.get(dn); return nodeToECBlocks.get(dn);
} }
return null; return null;
} }
@ -125,7 +125,7 @@ private LightWeightHashSet<Block> getECBlockGroupsSet(final DatanodeInfo dn) {
private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn, private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn,
final Block block) { final Block block) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) { if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
return getECBlockGroupsSet(dn); return getECBlocksSet(dn);
} else { } else {
return getBlocksSet(dn); return getBlocksSet(dn);
} }
@ -134,8 +134,8 @@ private LightWeightHashSet<Block> getBlocksSet(final DatanodeInfo dn,
private void putBlocksSet(final DatanodeInfo dn, final Block block, private void putBlocksSet(final DatanodeInfo dn, final Block block,
final LightWeightHashSet set) { final LightWeightHashSet set) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) { if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
assert getECBlockGroupsSet(dn) == null; assert getECBlocksSet(dn) == null;
nodeToECBlockGroups.put(dn, set); nodeToECBlocks.put(dn, set);
} else { } else {
assert getBlocksSet(dn) == null; assert getBlocksSet(dn) == null;
nodeToBlocks.put(dn, set); nodeToBlocks.put(dn, set);
@ -144,7 +144,7 @@ private void putBlocksSet(final DatanodeInfo dn, final Block block,
private long getBlockSetsSize(final DatanodeInfo dn) { private long getBlockSetsSize(final DatanodeInfo dn) {
LightWeightHashSet<Block> replicaBlocks = getBlocksSet(dn); LightWeightHashSet<Block> replicaBlocks = getBlocksSet(dn);
LightWeightHashSet<Block> stripedBlocks = getECBlockGroupsSet(dn); LightWeightHashSet<Block> stripedBlocks = getECBlocksSet(dn);
return ((replicaBlocks == null ? 0 : replicaBlocks.size()) + return ((replicaBlocks == null ? 0 : replicaBlocks.size()) +
(stripedBlocks == null ? 0 : stripedBlocks.size())); (stripedBlocks == null ? 0 : stripedBlocks.size()));
} }
@ -179,7 +179,7 @@ synchronized void add(final Block block, final DatanodeInfo datanode,
} }
if (set.add(block)) { if (set.add(block)) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) { if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
numECBlockGroups.increment(); numECBlocks.increment();
} else { } else {
numBlocks.increment(); numBlocks.increment();
} }
@ -196,9 +196,9 @@ synchronized void remove(final DatanodeInfo dn) {
if (replicaBlockSets != null) { if (replicaBlockSets != null) {
numBlocks.add(replicaBlockSets.size() * -1); numBlocks.add(replicaBlockSets.size() * -1);
} }
LightWeightHashSet<Block> blockGroupSets = nodeToECBlockGroups.remove(dn); LightWeightHashSet<Block> ecBlocksSet = nodeToECBlocks.remove(dn);
if (blockGroupSets != null) { if (ecBlocksSet != null) {
numECBlockGroups.add(blockGroupSets.size() * -1); 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); final LightWeightHashSet<Block> v = getBlocksSet(dn, block);
if (v != null && v.remove(block)) { if (v != null && v.remove(block)) {
if (BlockIdManager.isStripedBlockID(block.getBlockId())) { if (BlockIdManager.isStripedBlockID(block.getBlockId())) {
numECBlockGroups.decrement(); numECBlocks.decrement();
} else { } else {
numBlocks.decrement(); numBlocks.decrement();
} }
@ -231,21 +231,21 @@ private void dumpBlockSet(final Map<DatanodeInfo,
/** Print the contents to out. */ /** Print the contents to out. */
synchronized void dump(final PrintWriter out) { synchronized void dump(final PrintWriter out) {
final int size = nodeToBlocks.values().size() + final int size = nodeToBlocks.values().size() +
nodeToECBlockGroups.values().size(); nodeToECBlocks.values().size();
out.println("Metasave: Blocks " + numBlocks() out.println("Metasave: Blocks " + numBlocks()
+ " waiting deletion from " + size + " datanodes."); + " waiting deletion from " + size + " datanodes.");
if (size == 0) { if (size == 0) {
return; return;
} }
dumpBlockSet(nodeToBlocks, out); dumpBlockSet(nodeToBlocks, out);
dumpBlockSet(nodeToECBlockGroups, out); dumpBlockSet(nodeToECBlocks, out);
} }
/** @return a list of the storage IDs. */ /** @return a list of the storage IDs. */
synchronized List<DatanodeInfo> getDatanodes() { synchronized List<DatanodeInfo> getDatanodes() {
HashSet<DatanodeInfo> set = new HashSet<>(); HashSet<DatanodeInfo> set = new HashSet<>();
set.addAll(nodeToBlocks.keySet()); set.addAll(nodeToBlocks.keySet());
set.addAll(nodeToECBlockGroups.keySet()); set.addAll(nodeToECBlocks.keySet());
return new ArrayList<>(set); return new ArrayList<>(set);
} }
@ -289,9 +289,9 @@ synchronized List<Block> invalidateWork(final DatanodeDescriptor dn) {
remainingLimit = getBlocksToInvalidateByLimit(nodeToBlocks.get(dn), remainingLimit = getBlocksToInvalidateByLimit(nodeToBlocks.get(dn),
toInvalidate, numBlocks, remainingLimit); toInvalidate, numBlocks, remainingLimit);
} }
if ((remainingLimit > 0) && (nodeToECBlockGroups.get(dn) != null)) { if ((remainingLimit > 0) && (nodeToECBlocks.get(dn) != null)) {
getBlocksToInvalidateByLimit(nodeToECBlockGroups.get(dn), getBlocksToInvalidateByLimit(nodeToECBlocks.get(dn),
toInvalidate, numECBlockGroups, remainingLimit); toInvalidate, numECBlocks, remainingLimit);
} }
if (toInvalidate.size() > 0 && getBlockSetsSize(dn) == 0) { if (toInvalidate.size() > 0 && getBlockSetsSize(dn) == 0) {
remove(dn); remove(dn);
@ -302,8 +302,8 @@ synchronized List<Block> invalidateWork(final DatanodeDescriptor dn) {
synchronized void clear() { synchronized void clear() {
nodeToBlocks.clear(); nodeToBlocks.clear();
nodeToECBlockGroups.clear(); nodeToECBlocks.clear();
numBlocks.reset(); 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 */ /** Return the number of corrupt blocks with replication factor 1 */
long getCorruptReplicationOneBlockSize() { long getCorruptReplicationOneBlockSize() {
return getCorruptReplicationOneBlocksStat(); return getCorruptReplicationOneBlocks();
} }
/** /**
* Return under replicated block count excluding corrupt replicas. * Return under replicated block count excluding corrupt replicas.
*/ */
long getLowRedundancyBlocksStat() { long getLowRedundancyBlocks() {
return lowRedundancyBlocks.longValue() - getCorruptBlocksStat(); return lowRedundancyBlocks.longValue() - getCorruptBlocks();
} }
long getCorruptBlocksStat() { long getCorruptBlocks() {
return corruptBlocks.longValue(); return corruptBlocks.longValue();
} }
long getCorruptReplicationOneBlocksStat() { long getCorruptReplicationOneBlocks() {
return corruptReplicationOneBlocks.longValue(); return corruptReplicationOneBlocks.longValue();
} }
/** /**
* Return low redundancy striped blocks excluding corrupt blocks. * Return low redundancy striped blocks excluding corrupt blocks.
*/ */
long getLowRedundancyECBlockGroupsStat() { long getLowRedundancyECBlockGroups() {
return lowRedundancyECBlockGroups.longValue() - return lowRedundancyECBlockGroups.longValue() -
getCorruptECBlockGroupsStat(); getCorruptECBlockGroups();
} }
long getCorruptECBlockGroupsStat() { long getCorruptECBlockGroups() {
return corruptECBlockGroups.longValue(); 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.DFSConfigKeys.DFS_REPLICATION_KEY;
import static org.apache.hadoop.hdfs.server.namenode.FSDirStatAndListingOp.*; 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.ReplicatedBlockStats;
import org.apache.hadoop.hdfs.protocol.ECBlockGroupStats; import org.apache.hadoop.hdfs.protocol.ECBlockGroupStats;
import org.apache.hadoop.hdfs.protocol.OpenFileEntry; import org.apache.hadoop.hdfs.protocol.OpenFileEntry;
@ -4081,9 +4080,9 @@ long[] getStats() {
* Get statistics pertaining to blocks of type {@link BlockType#CONTIGUOUS} * Get statistics pertaining to blocks of type {@link BlockType#CONTIGUOUS}
* in the filesystem. * in the filesystem.
* <p> * <p>
* @see ClientProtocol#getBlocksStats() * @see ClientProtocol#getReplicatedBlockStats()
*/ */
ReplicatedBlockStats getBlocksStats() { ReplicatedBlockStats getReplicatedBlockStats() {
return new ReplicatedBlockStats(getLowRedundancyReplicatedBlocks(), return new ReplicatedBlockStats(getLowRedundancyReplicatedBlocks(),
getCorruptReplicatedBlocks(), getMissingReplicatedBlocks(), getCorruptReplicatedBlocks(), getMissingReplicatedBlocks(),
getMissingReplicationOneBlocks(), getBytesInFutureReplicatedBlocks(), getMissingReplicationOneBlocks(), getBytesInFutureReplicatedBlocks(),
@ -4094,12 +4093,12 @@ ReplicatedBlockStats getBlocksStats() {
* Get statistics pertaining to blocks of type {@link BlockType#STRIPED} * Get statistics pertaining to blocks of type {@link BlockType#STRIPED}
* in the filesystem. * in the filesystem.
* <p> * <p>
* @see ClientProtocol#getECBlockGroupsStats() * @see ClientProtocol#getECBlockGroupStats()
*/ */
ECBlockGroupStats getECBlockGroupsStats() { ECBlockGroupStats getECBlockGroupStats() {
return new ECBlockGroupStats(getLowRedundancyECBlockGroups(), return new ECBlockGroupStats(getLowRedundancyECBlockGroups(),
getCorruptECBlockGroups(), getMissingECBlockGroups(), getCorruptECBlockGroups(), getMissingECBlockGroups(),
getBytesInFutureECBlockGroups(), getPendingDeletionECBlockGroups()); getBytesInFutureECBlockGroups(), getPendingDeletionECBlocks());
} }
@Override // FSNamesystemMBean @Override // FSNamesystemMBean
@ -4712,10 +4711,10 @@ public long getBytesInFutureECBlockGroups() {
} }
@Override // ECBlockGroupsMBean @Override // ECBlockGroupsMBean
@Metric({"PendingDeletionECBlockGroups", "Number of erasure coded block " + @Metric({"PendingDeletionECBlocks", "Number of erasure coded blocks " +
"groups that are pending deletion"}) "that are pending deletion"})
public long getPendingDeletionECBlockGroups() { public long getPendingDeletionECBlocks() {
return blockManager.getPendingDeletionECBlockGroups(); return blockManager.getPendingDeletionECBlocks();
} }
@Override @Override

View File

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

View File

@ -53,7 +53,7 @@ public interface ECBlockGroupsMBean {
long getBytesInFutureECBlockGroups(); 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 * minutes. Use "-metaSave" to list of all such blocks and accurate
* counts. * counts.
*/ */
ReplicatedBlockStats replicatedBlockStats = dfs.getClient().getNamenode().getBlocksStats(); ReplicatedBlockStats replicatedBlockStats =
dfs.getClient().getNamenode().getReplicatedBlockStats();
System.out.println("Replicated Blocks:"); System.out.println("Replicated Blocks:");
System.out.println("\tUnder replicated blocks: " + System.out.println("\tUnder replicated blocks: " +
replicatedBlockStats.getLowRedundancyBlocksStat()); replicatedBlockStats.getLowRedundancyBlocks());
System.out.println("\tBlocks with corrupt replicas: " + System.out.println("\tBlocks with corrupt replicas: " +
replicatedBlockStats.getCorruptBlocksStat()); replicatedBlockStats.getCorruptBlocks());
System.out.println("\tMissing blocks: " + System.out.println("\tMissing blocks: " +
replicatedBlockStats.getMissingReplicaBlocksStat()); replicatedBlockStats.getMissingReplicaBlocks());
System.out.println("\tMissing blocks (with replication factor 1): " + System.out.println("\tMissing blocks (with replication factor 1): " +
replicatedBlockStats.getMissingReplicationOneBlocksStat()); replicatedBlockStats.getMissingReplicationOneBlocks());
System.out.println("\tPending deletion blocks: " + System.out.println("\tPending deletion blocks: " +
replicatedBlockStats.getPendingDeletionBlocksStat()); replicatedBlockStats.getPendingDeletionBlocks());
ECBlockGroupStats ecBlockGroupStats = ECBlockGroupStats ecBlockGroupStats =
dfs.getClient().getNamenode().getECBlockGroupsStats(); dfs.getClient().getNamenode().getECBlockGroupStats();
System.out.println("Erasure Coded Block Groups: "); System.out.println("Erasure Coded Block Groups: ");
System.out.println("\tLow redundancy block groups: " + System.out.println("\tLow redundancy block groups: " +
ecBlockGroupStats.getLowRedundancyBlockGroupsStat()); ecBlockGroupStats.getLowRedundancyBlockGroups());
System.out.println("\tBlock groups with corrupt internal blocks: " + System.out.println("\tBlock groups with corrupt internal blocks: " +
ecBlockGroupStats.getCorruptBlockGroupsStat()); ecBlockGroupStats.getCorruptBlockGroups());
System.out.println("\tMissing block groups: " + System.out.println("\tMissing block groups: " +
ecBlockGroupStats.getMissingBlockGroupsStat()); ecBlockGroupStats.getMissingBlockGroups());
System.out.println("\tPending deletion block groups: " + System.out.println("\tPending deletion blocks: " +
ecBlockGroupStats.getPendingDeletionBlockGroupsStat()); ecBlockGroupStats.getPendingDeletionBlocks());
System.out.println(); System.out.println();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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