Skip to content

Commit

Permalink
fix compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
ceekay committed Feb 28, 2024
1 parent 05b4c2b commit 6585630
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.common.cache.CacheLoader;
import java.io.File;
import java.io.IOException;
import java.lang.ref.Reference;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -418,6 +419,7 @@ public int getSnapshotCacheSize() {
public void invalidateCache() {
if (snapshotCache != null) {
snapshotCache.invalidateAll();
updateSnapshotCacheSizeMetric();
}
}

Expand All @@ -429,6 +431,7 @@ public void invalidateCache() {
public void invalidateCacheEntry(UUID key) throws IOException {
if (snapshotCache != null) {
snapshotCache.invalidate(key);
updateSnapshotCacheSizeMetric();
}
}

Expand Down Expand Up @@ -679,7 +682,9 @@ private ReferenceCounted<OmSnapshot> getSnapshot(String snapshotTableKey, boolea
}

// retrieve the snapshot from the cache
return snapshotCache.get(snapshotInfo.getSnapshotId());
ReferenceCounted<OmSnapshot> snapshot = snapshotCache.get(snapshotInfo.getSnapshotId());
updateSnapshotCacheSizeMetric();
return snapshot;
}

/**
Expand Down Expand Up @@ -980,9 +985,8 @@ public long getDiffCleanupServiceInterval() {

/**
* Updates the SnapshotCache size jmx metric.
* @param cacheSize SnapshotCache size
*/
public void updateSnapshotCacheSizeMetric(int cacheSize) {
this.ozoneManager.getMetrics().setNumSnapshotCacheSize(cacheSize);
public void updateSnapshotCacheSizeMetric() {
this.ozoneManager.getMetrics().setNumSnapshotCacheSize(getSnapshotCacheSize());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ private void instantiateServices(boolean withNewSnapshot) throws IOException {
omSnapshotManager = new OmSnapshotManager(this);

// Snapshot metrics
metrics.setNumSnapshotCacheSize(omSnapshotManager.getSnapshotCache().size());
metrics.setNumSnapshotCacheSize(omSnapshotManager.getSnapshotCacheSize());
updateActiveSnapshotMetrics();

if (withNewSnapshot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public void invalidate(UUID key) throws IOException {
}
return null;
});
this.omSnapshotManager.updateSnapshotCacheSizeMetric(size());
}

/**
Expand All @@ -106,7 +105,6 @@ public void invalidateAll() {
}
it.remove();
}
this.omSnapshotManager.updateSnapshotCacheSizeMetric(size());
}

/**
Expand Down Expand Up @@ -159,7 +157,6 @@ public ReferenceCounted<OmSnapshot> get(UUID key) throws IOException {
}
return v;
});
this.omSnapshotManager.updateSnapshotCacheSizeMetric(size());
if (rcOmSnapshot == null) {
// The only exception that would fall through the loader logic above
// is OMException with FILE_NOT_FOUND.
Expand Down Expand Up @@ -232,7 +229,6 @@ private void cleanupInternal() {
return null;
}
});
this.omSnapshotManager.updateSnapshotCacheSizeMetric(size());
}
}
}

0 comments on commit 6585630

Please sign in to comment.