This is an automated email from the ASF dual-hosted git repository.

smiklosovic pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 39019f005b6a419ce550f97f28b0ebe0c07cd09a
Merge: 13a3ae9297 ced50b0b30
Author: Stefan Miklosovic <[email protected]>
AuthorDate: Wed Dec 10 11:59:43 2025 +0100

    Merge branch 'cassandra-5.0' into trunk

 CHANGES.txt                                        |  1 +
 .../org/apache/cassandra/service/GCInspector.java  | 39 ++++++++++++++--------
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --cc CHANGES.txt
index c699a8f26b,43578775ed..e6d369b477
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -353,23 -102,7 +353,24 @@@ Merged from 4.1
   * Optionally skip exception logging on invalid legacy protocol magic 
exception (CASSANDRA-19483)
   * Fix SimpleClient ability to release acquired capacity (CASSANDRA-20202)
   * Fix WaitQueue.Signal.awaitUninterruptibly may block forever if invoking 
thread is interrupted (CASSANDRA-20084)
 + * Run audit_logging_options through santiation and validation on startup 
(CASSANDRA-20208)
 + * Enforce CQL message size limit on multiframe messages (CASSANDRA-20052)
 + * Fix race condition in DecayingEstimatedHistogramReservoir during rescale 
(CASSANDRA-19365)
  Merged from 4.0:
++ * Backport fix to nodetool gcstats output for direct memory (CASSANDRA-21037)
 + * 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 memory leak in BufferPoolAllocator when a capacity needs to be 
extended (CASSANDRA-20753)
 + * Leveled Compaction doesn't validate maxBytesForLevel when the table is 
altered/created (CASSANDRA-20570)
 + * Updated dtest-api to 0.0.18 and removed JMX-related classes that now live 
in the dtest-api (CASSANDRA-20884)
 + * Fixed incorrect error message constant for keyspace name length validation 
(CASSANDRA-20915)
 + * Prevent too long table names not fitting file names (CASSANDRA-20389)
 + * Update Jackson to 2.19.2 (CASSANDRA-20848)
 + * Update commons-lang3 to 3.18.0 (CASSANDRA-20849)
 + * Add NativeTransportMaxConcurrentConnectionsPerIp to StorageProxyMBean 
(CASSANDRA-20642)
 + * Make secondary index implementations notified about rows in fully expired 
SSTables in compaction (CASSANDRA-20829)
 + * Ensure prepared_statement INSERT timestamp precedes eviction DELETE 
(CASSANDRA-19703)
 + * Gossip doesn't converge due to race condition when updating EndpointStates 
multiple fields (CASSANDRA-20659)
   * Handle sstable metadata stats file getting a new mtime after compaction 
has finished (CASSANDRA-18119)
   * Honor MAX_PARALLEL_TRANSFERS correctly (CASSANDRA-20532)
   * Updating a column with a new TTL but same expiration time is 
non-deterministic and causes repair mismatches. (CASSANDRA-20561)
diff --cc src/java/org/apache/cassandra/service/GCInspector.java
index 25d741b847,3488605c55..e6d0d1f56b
--- a/src/java/org/apache/cassandra/service/GCInspector.java
+++ b/src/java/org/apache/cassandra/service/GCInspector.java
@@@ -80,12 -71,13 +75,22 @@@ public class GCInspector implements Not
          }
          catch (Throwable t)
          {
 -            logger.debug("Error returning class 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;
-         BITS_RESERVED = reservedTempField;
+ 
+         if (bitsClass != null)
++        {
+             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
@@@ -397,9 -338,12 +402,15 @@@
      }
  
      /**
+      * 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
-      * 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)
      {
          if (field == null) return -1;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to