]> source.dussan.org Git - jgit.git/commitdiff
DfsBlockCache: Report IndexEventConsumer metrics for reverse indexes. 90/196890/3
authorAnna Papitto <annapapitto@google.com>
Thu, 10 Nov 2022 22:49:27 +0000 (14:49 -0800)
committerIvan Frade <ifrade@google.com>
Thu, 17 Nov 2022 17:38:48 +0000 (12:38 -0500)
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>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java

index b30d50921a6b01ebc5c282a76e4a6e20f3dbb5cc..0a02180d7d5fbcd9d16ba64a865238ce4c81bbb5 100644 (file)
@@ -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();
        }