DfsBlockCache: Report IndexEventConsumer metrics for reverse indexes.

IndexEventConsumer metrics are reported per index PackExt and reverse
indexes did not have one, so they were not included.

Now that there is a REVERSE_INDEX PackExt, enable reporting
IndexEventConsumer metrics for reverse indexes.

Change-Id: Ia6a752f6eb8932a5b4ba45cc15cbc7e0786fd247
Signed-off-by: Anna Papitto <annapapitto@google.com>
This commit is contained in:
Anna Papitto 2022-11-10 14:49:27 -08:00 committed by Ivan Frade
parent accacc27a1
commit bd515f1c2a
1 changed files with 4 additions and 3 deletions

View File

@ -712,7 +712,7 @@ private static HashEntry clean(HashEntry top) {
private void reportIndexRequested(Ref<?> ref, boolean cacheHit,
long start) {
if (indexEventConsumer == null
|| !isIndexOrBitmapExtPos(ref.key.packExtPos)) {
|| !isIndexExtPos(ref.key.packExtPos)) {
return;
}
EvictKey evictKey = new EvictKey(ref);
@ -728,7 +728,7 @@ private void reportIndexRequested(Ref<?> ref, boolean cacheHit,
private void reportIndexEvicted(Ref<?> dead) {
if (indexEventConsumer == null
|| !indexEventConsumer.shouldReportEvictedEvent()
|| !isIndexOrBitmapExtPos(dead.key.packExtPos)) {
|| !isIndexExtPos(dead.key.packExtPos)) {
return;
}
EvictKey evictKey = new EvictKey(dead);
@ -742,8 +742,9 @@ private void reportIndexEvicted(Ref<?> dead) {
Duration.ofNanos(sinceLastEvictionNanos));
}
private static boolean isIndexOrBitmapExtPos(int packExtPos) {
private static boolean isIndexExtPos(int packExtPos) {
return packExtPos == PackExt.INDEX.getPosition()
|| packExtPos == PackExt.REVERSE_INDEX.getPosition()
|| packExtPos == PackExt.BITMAP_INDEX.getPosition();
}