mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-5.0' into trunk
This commit is contained in:
commit
39019f005b
|
|
@ -357,6 +357,7 @@ Merged from 4.1:
|
||||||
* Enforce CQL message size limit on multiframe messages (CASSANDRA-20052)
|
* Enforce CQL message size limit on multiframe messages (CASSANDRA-20052)
|
||||||
* Fix race condition in DecayingEstimatedHistogramReservoir during rescale (CASSANDRA-19365)
|
* Fix race condition in DecayingEstimatedHistogramReservoir during rescale (CASSANDRA-19365)
|
||||||
Merged from 4.0:
|
Merged from 4.0:
|
||||||
|
* Backport fix to nodetool gcstats output for direct memory (CASSANDRA-21037)
|
||||||
* ArrayIndexOutOfBoundsException with repaired data tracking and counters (CASSANDRA-20871)
|
* ArrayIndexOutOfBoundsException with repaired data tracking and counters (CASSANDRA-20871)
|
||||||
* Fix cleanup of old incremental repair sessions in case of owned token range changes or a table deleting (CASSANDRA-20877)
|
* Fix cleanup of old incremental repair sessions in case of owned token range changes or a table deleting (CASSANDRA-20877)
|
||||||
* Fix memory leak in BufferPoolAllocator when a capacity needs to be extended (CASSANDRA-20753)
|
* Fix memory leak in BufferPoolAllocator when a capacity needs to be extended (CASSANDRA-20753)
|
||||||
|
|
|
||||||
|
|
@ -67,25 +67,30 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
Field totalTempField = null;
|
Class<?> bitsClass = null;
|
||||||
Field maxTempField = null;
|
|
||||||
Field reservedTempField = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Class<?> bitsClass = Class.forName("java.nio.Bits");
|
bitsClass = Class.forName("java.nio.Bits");
|
||||||
totalTempField = getField(bitsClass, "TOTAL_CAPACITY");
|
|
||||||
// Returns the maximum amount of allocatable direct buffer memory.
|
|
||||||
maxTempField = getField(bitsClass, "MAX_MEMORY");
|
|
||||||
reservedTempField = getField(bitsClass, "RESERVED_MEMORY");
|
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
logger.debug("Error accessing field of java.nio.Bits", t);
|
logger.debug("Error accessing field of java.nio.Bits", t);
|
||||||
//Don't care, will just return the dummy value -1 if we can't get at the field in this JVM
|
|
||||||
}
|
}
|
||||||
BITS_TOTAL_CAPACITY = totalTempField;
|
|
||||||
BITS_MAX = maxTempField;
|
if (bitsClass != null)
|
||||||
BITS_RESERVED = reservedTempField;
|
{
|
||||||
|
BITS_TOTAL_CAPACITY = getField(bitsClass, "TOTAL_CAPACITY");
|
||||||
|
// Returns the maximum amount of allocatable direct buffer memory.
|
||||||
|
BITS_MAX = getField(bitsClass, "MAX_MEMORY");
|
||||||
|
BITS_RESERVED = getField(bitsClass, "RESERVED_MEMORY");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BITS_TOTAL_CAPACITY = null;
|
||||||
|
BITS_MAX = null;
|
||||||
|
BITS_RESERVED = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class State
|
static final class State
|
||||||
|
|
@ -397,9 +402,15 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Retrieves the value of a Field, handling both regular long fields and AtomicLong fields.
|
||||||
|
*
|
||||||
* From the implementation of java.nio.Bits, we can infer that TOTAL_CAPACITY/RESERVED_MEMORY is AtomicLong
|
* From the implementation of java.nio.Bits, we can infer that TOTAL_CAPACITY/RESERVED_MEMORY is AtomicLong
|
||||||
* and MAX_MEMORY is long. This method works well with JDK 11/17
|
* and MAX_MEMORY is long.
|
||||||
* */
|
*
|
||||||
|
* @param field the Field to retrieve the value from
|
||||||
|
* @param isAtomicLong true if the field is an AtomicLong, false if it's a regular long
|
||||||
|
* @return the field value, or -1 if retrieval fails or field is null.
|
||||||
|
*/
|
||||||
private static long getFieldValue(Field field, boolean isAtomicLong)
|
private static long getFieldValue(Field field, boolean isAtomicLong)
|
||||||
{
|
{
|
||||||
if (field == null) return -1;
|
if (field == null) return -1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue