From bd515f1c2ac1959730bba805dcdc187d74a542fe Mon Sep 17 00:00:00 2001 From: Anna Papitto Date: Thu, 10 Nov 2022 14:49:27 -0800 Subject: 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 --- .../src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'org.eclipse.jgit/src/org/eclipse/jgit') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java index b30d50921a..0a02180d7d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java @@ -712,7 +712,7 @@ public final class DfsBlockCache { 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 @@ public final class DfsBlockCache { 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 @@ public final class DfsBlockCache { 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(); } -- cgit v1.2.3