This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new 5f571506dd Fixed NPE in ScanServerMetrics (#4598)
5f571506dd is described below
commit 5f571506ddf6d7dfc003c2fd9969dda783118550
Author: Dave Marion <[email protected]>
AuthorDate: Fri May 24 07:45:40 2024 -0400
Fixed NPE in ScanServerMetrics (#4598)
A NPE was being raised in ScanServerMetrics.registerMetrics when
the SSERV_CACHED_TABLET_METADATA_EXPIRATION value was zero, which
disables the tablet metadata caching and leaves the variable
tabletMetadataCache referencing null. A test was failing in
ScanServerConcurrentTabletScanIT that led to this discovery.
---
.../main/java/org/apache/accumulo/tserver/ScanServerMetrics.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
index 365c26ceee..1ba7de6e33 100644
---
a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
+++
b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
@@ -63,9 +63,12 @@ public class ScanServerMetrics implements MetricsProducer {
"Counts instances where file reservation attempts for scans
encountered conflicts")
.register(registry);
- Preconditions.checkState(tabletMetadataCache.policy().isRecordingStats(),
- "Attempted to instrument cache that is not recording stats.");
- CaffeineCacheMetrics.monitor(registry, tabletMetadataCache,
METRICS_SCAN_TABLET_METADATA_CACHE);
+ if (tabletMetadataCache != null) {
+ Preconditions.checkState(tabletMetadataCache.policy().isRecordingStats(),
+ "Attempted to instrument cache that is not recording stats.");
+ CaffeineCacheMetrics.monitor(registry, tabletMetadataCache,
+ METRICS_SCAN_TABLET_METADATA_CACHE);
+ }
}
public void recordTotalReservationTime(Duration time) {