From 3540e2463fb98ff3f0ca9f46a67f0e2784264feb Mon Sep 17 00:00:00 2001 From: Arvind Kandpal Date: Tue, 28 Jul 2026 11:55:04 +0530 Subject: [PATCH] CASSANDRA-14366: Add try-catch block for missing prepared statement --- .../apache/cassandra/tools/nodetool/Info.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/cassandra/tools/nodetool/Info.java b/src/java/org/apache/cassandra/tools/nodetool/Info.java index dc721c7ddd..f312385ecf 100644 --- a/src/java/org/apache/cassandra/tools/nodetool/Info.java +++ b/src/java/org/apache/cassandra/tools/nodetool/Info.java @@ -120,13 +120,21 @@ public class Info extends AbstractCommand cacheService.getCounterCacheSavePeriodInSeconds()); // Prepared Statement Cache: entries, size, capacity, executions, evictions - out.printf("%-23s: entries %d, size %s, capacity %s, %d executions, %d evictions%n", - "Prepared Stmt Cache", - probe.getCQLMetric("PreparedStatementsCount"), - FileUtils.stringifyFileSize((long) probe.getCQLMetric("PreparedStatementsCacheSize")), - FileUtils.stringifyFileSize((long) probe.getCQLMetric("PreparedStatementsCacheCapacity")), - probe.getCQLMetric("PreparedStatementsExecuted"), - probe.getCQLMetric("PreparedStatementsEvicted")); + try + { + out.printf("%-23s: entries %d, size %s, capacity %s, %d executions, %d evictions%n", + "Prepared Stmt Cache", + probe.getCQLMetric("PreparedStatementsCount"), + FileUtils.stringifyFileSize((long) probe.getCQLMetric("PreparedStatementsCacheSize")), + FileUtils.stringifyFileSize((long) probe.getCQLMetric("PreparedStatementsCacheCapacity")), + probe.getCQLMetric("PreparedStatementsExecuted"), + probe.getCQLMetric("PreparedStatementsEvicted")); + } + catch (RuntimeException e) + { + if (!(e.getCause() instanceof InstanceNotFoundException)) + throw e; + } // Chunk Cache: Hits, Requests, RecentHitRate, SavePeriodInSeconds try