Skip to content

Commit 79c1a93

Browse files
wzhallrightxkrogen
authored andcommitted
HDFS-16181. [SBN Read] Fix display of JournalNode metric RpcRequestCacheMissAmount (#3317)
Co-authored-by: wangzhaohui8 <[email protected]> (cherry picked from commit 232fd7cae170de8c6b52c14841a47dca8735c6d2) (cherry picked from commit 2f73ac1) (cherry picked from commit 928dbac) (cherry picked from commit 9b63f60)
1 parent edc1381 commit 79c1a93

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ public GetJournaledEditsResponseProto getJournaledEdits(long sinceTxId,
759759
.setEditLog(output.toByteString())
760760
.build();
761761
} catch (JournaledEditsCache.CacheMissException cme) {
762-
metrics.rpcRequestCacheMissAmount.add(cme.getCacheMissAmount());
762+
metrics.addRpcRequestCacheMissAmount(cme.getCacheMissAmount());
763763
throw cme;
764764
}
765765
}

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalMetrics.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ class JournalMetrics {
5151
@Metric("Number of bytes served via RPC")
5252
MutableCounterLong bytesServedViaRpc;
5353

54-
@Metric
55-
MutableStat rpcRequestCacheMissAmount = new MutableStat(
56-
"RpcRequestCacheMissAmount", "Number of RPC requests unable to be " +
57-
"served due to lack of availability in cache, and how many " +
58-
"transactions away the request was from being in the cache.",
59-
"Misses", "Txns");
54+
private MutableStat rpcRequestCacheMissAmount;
6055

6156
@Metric("Number of RPC requests with zero edits returned")
6257
MutableCounterLong rpcEmptyResponses;
@@ -84,6 +79,11 @@ class JournalMetrics {
8479
"syncs" + interval + "s",
8580
"Journal sync time", "ops", "latencyMicros", interval);
8681
}
82+
rpcRequestCacheMissAmount = registry
83+
.newStat("RpcRequestCacheMissAmount", "Number of RPC requests unable to be " +
84+
"served due to lack of availability in cache, and how many " +
85+
"transactions away the request was from being in the cache.",
86+
"Misses", "Txns");
8787
}
8888

8989
public static JournalMetrics create(Journal j) {
@@ -138,4 +138,8 @@ void addSync(long us) {
138138
q.add(us);
139139
}
140140
}
141+
142+
public void addRpcRequestCacheMissAmount(long cacheMissAmount) {
143+
rpcRequestCacheMissAmount.add(cacheMissAmount);
144+
}
141145
}

0 commit comments

Comments
 (0)