From 3bf9bd6831ae23670f0113b5d858e4dc00448ce5 Mon Sep 17 00:00:00 2001 From: Mick Semb Wever Date: Thu, 9 Mar 2023 14:11:19 +0100 Subject: [PATCH] Remove legacy 3.0/3.11 buffer pool metrics patch by Mick Semb Wever; reviewed by Brandon Williams, Maxim Muzafarov for CASSANDRA-18313 --- CHANGES.txt | 1 + NEWS.txt | 2 ++ .../org/apache/cassandra/metrics/BufferPoolMetrics.java | 9 --------- .../org/apache/cassandra/utils/memory/BufferPools.java | 1 - .../org/apache/cassandra/tools/JMXCompatabilityTest.java | 8 ++++++-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 08cc8a5e8a..1b02aa51bd 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 5.0 + * Remove legacy 3.0/3.11 buffer pool metrics (CASSANDRA-18313) * Add AzureSnitch (CASSANDRA-18646) * Implementation of the Unified Compaction Strategy as described in CEP-26 (CASSANDRA-18397) * Upgrade commons cli to 1.5.0 (CASSANDRA-18659) diff --git a/NEWS.txt b/NEWS.txt index 26be1a6bde..ff90a9a465 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -202,6 +202,8 @@ Upgrading communicate with AWS IMDS of version 2. This change is transparent, there does not need to be done anything upon upgrade. Furthermore, IMDS of version 2 can be configured to be required in AWS EC2 console. Consult cassandra-rackdc.properties for more details. (CASSANDRA-16555) + - JMX MBean `org.apache.cassandra.metrics:type=BufferPool` without scope has been removed. + Use instead `org.apache.cassandra.metrics:type=BufferPool,scope=chunk-cache`. (CASSANDRA-17668) Deprecation diff --git a/src/java/org/apache/cassandra/metrics/BufferPoolMetrics.java b/src/java/org/apache/cassandra/metrics/BufferPoolMetrics.java index b79a8fea26..71373b35e8 100644 --- a/src/java/org/apache/cassandra/metrics/BufferPoolMetrics.java +++ b/src/java/org/apache/cassandra/metrics/BufferPoolMetrics.java @@ -64,13 +64,4 @@ public class BufferPoolMetrics size = Metrics.register(factory.createMetricName("Size"), bufferPool::sizeInBytes); } - /** - * used to register alias for 3.0/3.11 compatibility - */ - public void register3xAlias() - { - MetricNameFactory legacyFactory = new DefaultNameFactory("BufferPool"); - Metrics.registerMBean(misses, legacyFactory.createMetricName("Misses").getMBeanName()); - Metrics.registerMBean(size, legacyFactory.createMetricName("Size").getMBeanName()); - } } diff --git a/src/java/org/apache/cassandra/utils/memory/BufferPools.java b/src/java/org/apache/cassandra/utils/memory/BufferPools.java index 5d80881961..aba5900b70 100644 --- a/src/java/org/apache/cassandra/utils/memory/BufferPools.java +++ b/src/java/org/apache/cassandra/utils/memory/BufferPools.java @@ -52,7 +52,6 @@ public class BufferPools prettyPrintMemory(NETWORKING_MEMORY_USAGE_THRESHOLD), NETWORKING_POOL.name); - CHUNK_CACHE_POOL.metrics().register3xAlias(); } /** * Long-lived buffers used for chunk cache and other disk access diff --git a/test/unit/org/apache/cassandra/tools/JMXCompatabilityTest.java b/test/unit/org/apache/cassandra/tools/JMXCompatabilityTest.java index 59485de233..e37c574713 100644 --- a/test/unit/org/apache/cassandra/tools/JMXCompatabilityTest.java +++ b/test/unit/org/apache/cassandra/tools/JMXCompatabilityTest.java @@ -97,6 +97,7 @@ public class JMXCompatabilityTest extends CQLTester { List excludeObjects = newArrayList("org.apache.cassandra.metrics:type=ThreadPools.*", "org.apache.cassandra.internal:.*", + "org.apache.cassandra.metrics:type=BufferPool,name=(Misses|Size)", // removed in CASSANDRA-18313 "org.apache.cassandra.metrics:type=DroppedMessage.*", "org.apache.cassandra.metrics:type=ClientRequest,scope=CASRead,name=ConditionNotMet", "org.apache.cassandra.metrics:type=Client,name=connectedThriftClients", // removed in CASSANDRA-11115 @@ -133,6 +134,7 @@ public class JMXCompatabilityTest extends CQLTester { List excludeObjects = newArrayList("org.apache.cassandra.metrics:type=ThreadPools.*", //lazy initialization in 4.0 "org.apache.cassandra.internal:.*", + "org.apache.cassandra.metrics:type=BufferPool,name=(Misses|Size)", // removed in CASSANDRA-18313 "org.apache.cassandra.metrics:type=DroppedMessage,scope=PAGED_RANGE.*", //it was deprecated in the previous major version "org.apache.cassandra.metrics:type=Client,name=connectedThriftClients", // removed in CASSANDRA-11115 "org.apache.cassandra.request:type=ReadRepairStage", // removed in CASSANDRA-13910 @@ -169,7 +171,8 @@ public class JMXCompatabilityTest extends CQLTester @Test public void diff40() throws Throwable { - List excludeObjects = newArrayList(); + List excludeObjects = newArrayList("org.apache.cassandra.metrics:type=BufferPool,name=(Misses|Size)" // removed in CASSANDRA-18313 + ); List excludeAttributes = newArrayList(); List excludeOperations = newArrayList(); @@ -185,7 +188,8 @@ public class JMXCompatabilityTest extends CQLTester @Test public void diff41() throws Throwable { - List excludeObjects = newArrayList(); + List excludeObjects = newArrayList("org.apache.cassandra.metrics:type=BufferPool,name=(Misses|Size)" // removed in CASSANDRA-18313 + ); List excludeAttributes = newArrayList(); List excludeOperations = newArrayList();