cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blam...@apache.org
Subject [08/10] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Date Tue, 21 Aug 2018 08:57:25 GMT
Merge branch 'cassandra-3.0' into cassandra-3.11


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/991e1971
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/991e1971
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/991e1971

Branch: refs/heads/cassandra-3.11
Commit: 991e19711f8762bbf93d6af588cef0a14668cc59
Parents: 65a4682 299782c
Author: Branimir Lambov <branimir.lambov@datastax.com>
Authored: Tue Aug 21 11:56:05 2018 +0300
Committer: Branimir Lambov <branimir.lambov@datastax.com>
Committed: Tue Aug 21 11:56:05 2018 +0300

----------------------------------------------------------------------
 .../io/sstable/IndexSummaryBuilder.java         |  4 +-
 .../cassandra/io/util/DataOutputBuffer.java     |  8 +-
 .../io/util/DataOutputBufferFixed.java          |  2 +-
 .../cassandra/io/util/SafeMemoryWriter.java     | 16 ++--
 .../cassandra/io/util/DataOutputTest.java       |  4 +-
 .../cassandra/io/util/SafeMemoryWriterTest.java | 90 ++++++++++++++++++++
 6 files changed, 110 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/991e1971/src/java/org/apache/cassandra/io/util/DataOutputBuffer.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/util/DataOutputBuffer.java
index 144edad,7586543..28ca468
--- a/src/java/org/apache/cassandra/io/util/DataOutputBuffer.java
+++ b/src/java/org/apache/cassandra/io/util/DataOutputBuffer.java
@@@ -38,43 -37,11 +38,43 @@@ public class DataOutputBuffer extends B
      /*
       * Threshold at which resizing transitions from doubling to increasing by 50%
       */
-     private static final long DOUBLING_THRESHOLD = Long.getLong(Config.PROPERTY_PREFIX +
"DOB_DOUBLING_THRESHOLD_MB", 64);
+     static final long DOUBLING_THRESHOLD = Long.getLong(Config.PROPERTY_PREFIX + "DOB_DOUBLING_THRESHOLD_MB",
64);
  
 +    /*
 +     * Only recycle OutputBuffers up to 1Mb. Larger buffers will be trimmed back to this
size.
 +     */
 +    private static final int MAX_RECYCLE_BUFFER_SIZE = Integer.getInteger(Config.PROPERTY_PREFIX
+ "dob_max_recycle_bytes", 1024 * 1024);
 +
 +    private static final int DEFAULT_INITIAL_BUFFER_SIZE = 128;
 +
 +    /**
 +     * Scratch buffers used mostly for serializing in memory. It's important to call #recycle()
when finished
 +     * to keep the memory overhead from being too large in the system.
 +     */
 +    public static final FastThreadLocal<DataOutputBuffer> scratchBuffer = new FastThreadLocal<DataOutputBuffer>()
 +    {
 +        protected DataOutputBuffer initialValue() throws Exception
 +        {
 +            return new DataOutputBuffer()
 +            {
 +                public void close()
 +                {
 +                    if (buffer.capacity() <= MAX_RECYCLE_BUFFER_SIZE)
 +                    {
 +                        buffer.clear();
 +                    }
 +                    else
 +                    {
 +                        buffer = ByteBuffer.allocate(DEFAULT_INITIAL_BUFFER_SIZE);
 +                    }
 +                }
 +            };
 +        }
 +    };
 +
      public DataOutputBuffer()
      {
 -        this(128);
 +        this(DEFAULT_INITIAL_BUFFER_SIZE);
      }
  
      public DataOutputBuffer(int size)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/991e1971/src/java/org/apache/cassandra/io/util/DataOutputBufferFixed.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/991e1971/test/unit/org/apache/cassandra/io/util/DataOutputTest.java
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message