mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-4.0' into cassandra-4.1
This commit is contained in:
commit
93efe0ee04
|
|
@ -6,6 +6,7 @@
|
|||
* Fix COPY ... TO STDOUT behavior in cqlsh (CASSANDRA-18353)
|
||||
* Remove six and Py2SaferScanner merge cruft (CASSANDRA-18354)
|
||||
Merged from 4.0:
|
||||
* Report network cache info in nodetool (CASSANDRa-18400)
|
||||
* Partial compaction can resurrect deleted data (CASSANDRA-18507)
|
||||
* Allow internal address to change with reconnecting snitches (CASSANDRA-16718)
|
||||
* Fix quoting in toCqlString methods of UDTs and aggregates (CASSANDRA-17918)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ public class BufferPoolMetrics
|
|||
/** Total number of misses */
|
||||
public final Meter misses;
|
||||
|
||||
/** Total threshold for a certain type of buffer pool*/
|
||||
public final Gauge<Long> capacity;
|
||||
|
||||
/** Total size of buffer pools, in bytes, including overflow allocation */
|
||||
public final Gauge<Long> size;
|
||||
|
||||
|
|
@ -52,6 +55,8 @@ public class BufferPoolMetrics
|
|||
|
||||
misses = Metrics.meter(factory.createMetricName("Misses"));
|
||||
|
||||
capacity = Metrics.register(factory.createMetricName("Capacity"), bufferPool::memoryUsageThreshold);
|
||||
|
||||
overflowSize = Metrics.register(factory.createMetricName("OverflowSize"), bufferPool::overflowMemoryInBytes);
|
||||
|
||||
usedSize = Metrics.register(factory.createMetricName("UsedSize"), bufferPool::usedSizeInBytes);
|
||||
|
|
|
|||
|
|
@ -1613,7 +1613,7 @@ public class NodeProbe implements AutoCloseable
|
|||
new ObjectName("org.apache.cassandra.metrics:type=Cache,scope=" + cacheType + ",name=MissLatency"),
|
||||
CassandraMetricsRegistry.JmxTimerMBean.class).getDurationUnit();
|
||||
default:
|
||||
throw new RuntimeException("Unknown cache metric name.");
|
||||
throw new RuntimeException("Unknown Cache metric name " + metricName);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1623,6 +1623,40 @@ public class NodeProbe implements AutoCloseable
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve buffer pool metrics based on the buffer pool type
|
||||
* @param poolType networking chunk-cache
|
||||
* @param metricName UsedSize Size
|
||||
* @return
|
||||
*/
|
||||
public Object getBufferPoolMetric(String poolType, String metricName)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (metricName)
|
||||
{
|
||||
case "UsedSize":
|
||||
case "OverflowSize":
|
||||
case "Capacity":
|
||||
case "Size":
|
||||
return JMX.newMBeanProxy(mbeanServerConn,
|
||||
new ObjectName("org.apache.cassandra.metrics:type=BufferPool,scope=" + poolType + ",name=" + metricName),
|
||||
CassandraMetricsRegistry.JmxGaugeMBean.class).getValue();
|
||||
case "Hits":
|
||||
case "Misses":
|
||||
return JMX.newMBeanProxy(mbeanServerConn,
|
||||
new ObjectName("org.apache.cassandra.metrics:type=BufferPool,scope=" + poolType + ",name=" + metricName),
|
||||
CassandraMetricsRegistry.JmxMeterMBean.class).getCount();
|
||||
default:
|
||||
throw new RuntimeException("Unknown BufferPool metric name " + metricName);
|
||||
}
|
||||
}
|
||||
catch (MalformedObjectNameException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Multimap<String, String> getJmxThreadPools(MBeanServerConnection mbeanServerConn)
|
||||
{
|
||||
try
|
||||
|
|
@ -1674,7 +1708,7 @@ public class NodeProbe implements AutoCloseable
|
|||
case ThreadPoolMetrics.CURRENTLY_BLOCKED_TASKS:
|
||||
return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.JmxCounterMBean.class).getCount();
|
||||
default:
|
||||
throw new AssertionError("Unknown metric name " + metricName);
|
||||
throw new AssertionError("Unknown ThreadPools metric name " + metricName);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
|||
|
|
@ -140,6 +140,22 @@ public class Info extends NodeToolCmd
|
|||
// Chunk cache is not on.
|
||||
}
|
||||
|
||||
// network Cache: capacity, size
|
||||
try
|
||||
{
|
||||
out.printf("%-23s: size %s, overflow size: %s, capacity %s%n", "Network Cache",
|
||||
FileUtils.stringifyFileSize((long) probe.getBufferPoolMetric("networking", "Size")),
|
||||
FileUtils.stringifyFileSize((long) probe.getBufferPoolMetric("networking", "OverflowSize")),
|
||||
FileUtils.stringifyFileSize((long) probe.getBufferPoolMetric("networking", "Capacity")));
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
if (!(e.getCause() instanceof InstanceNotFoundException))
|
||||
throw e;
|
||||
|
||||
// network cache is not on.
|
||||
}
|
||||
|
||||
// Global table stats
|
||||
out.printf("%-23s: %s%%%n", "Percent Repaired", probe.getColumnFamilyMetric(null, null, "PercentRepaired"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue