Skip to content

Commit 8e9ad2d

Browse files
authored
Revert "HADOOP-17995. Stale record should be remove when DataNodePeerMetrics#dumpSendPacketDownstreamAvgInfoAsJson (#3630)" (#3697)
1 parent 3d1ca6f commit 8e9ad2d

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableRollingAverages.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,8 @@ public void snapshot(MetricsRecordBuilder builder, boolean all) {
179179
long totalCount = 0;
180180

181181
for (final SumAndCount sumAndCount : entry.getValue()) {
182-
if (Time.monotonicNow() - sumAndCount.getSnapshotTimeStamp()
183-
< recordValidityMs) {
184-
totalCount += sumAndCount.getCount();
185-
totalSum += sumAndCount.getSum();
186-
}
182+
totalCount += sumAndCount.getCount();
183+
totalSum += sumAndCount.getSum();
187184
}
188185

189186
if (totalCount != 0) {

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodePeerMetrics.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,10 @@ public void testRemoveStaleRecord() throws Exception {
122122
GenericTestUtils.waitFor(
123123
() -> rollingAverages.getStats(numSamples).size() > 0, 500, 5000);
124124
assertEquals(3, rollingAverages.getStats(numSamples).size());
125-
String json = peerMetrics.dumpSendPacketDownstreamAvgInfoAsJson();
126-
for (String peerAddr : peerAddrList) {
127-
assertThat(json, containsString(peerAddr));
128-
}
129125
/* wait for stale report to be removed */
130126
GenericTestUtils.waitFor(
131127
() -> rollingAverages.getStats(numSamples).isEmpty(), 500, 10000);
132128
assertEquals(0, rollingAverages.getStats(numSamples).size());
133-
json = peerMetrics.dumpSendPacketDownstreamAvgInfoAsJson();
134-
assertEquals("{}", json);
135129

136130
/* dn can report peer metrics normally when it added back to cluster */
137131
for (String peerAddr : peerAddrList) {
@@ -144,10 +138,6 @@ public void testRemoveStaleRecord() throws Exception {
144138
GenericTestUtils.waitFor(
145139
() -> rollingAverages.getStats(numSamples).size() > 0, 500, 10000);
146140
assertEquals(3, rollingAverages.getStats(numSamples).size());
147-
json = peerMetrics.dumpSendPacketDownstreamAvgInfoAsJson();
148-
for (String peerAddr : peerAddrList) {
149-
assertThat(json, containsString(peerAddr));
150-
}
151141
}
152142

153143
/**

0 commit comments

Comments
 (0)