Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ jobs:
j8_jvm_upgrade_dtests:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 1
parallelism: 2
steps:
- attach_workspace:
at: /home/cassandra
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
j8_cqlsh-dtests-py2-with-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
j11_unit_tests:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -252,7 +252,7 @@ jobs:
j11_cqlsh-dtests-py3-with-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -329,7 +329,7 @@ jobs:
j11_cqlsh-dtests-py3-no-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -406,7 +406,7 @@ jobs:
j8_cqlsh-dtests-py3-with-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -482,7 +482,7 @@ jobs:
j8_cqlsh-dtests-py2-no-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -558,7 +558,7 @@ jobs:
j11_cqlsh-dtests-py2-with-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -635,7 +635,7 @@ jobs:
j11_dtests-with-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -715,7 +715,7 @@ jobs:
j8_dtests-no-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -772,7 +772,7 @@ jobs:
j8_upgradetests-no-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -870,7 +870,7 @@ jobs:
utests_stress:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 1
Expand Down Expand Up @@ -915,7 +915,7 @@ jobs:
j8_unit_tests:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -1001,10 +1001,10 @@ jobs:
j11_jvm_dtests:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 1
parallelism: 2
steps:
- attach_workspace:
at: /home/cassandra
Expand Down Expand Up @@ -1169,7 +1169,7 @@ jobs:
j11_cqlsh-dtests-py2-no-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -1246,7 +1246,7 @@ jobs:
j8_dtests-with-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -1303,10 +1303,10 @@ jobs:
j8_jvm_dtests:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 1
parallelism: 2
steps:
- attach_workspace:
at: /home/cassandra
Expand Down Expand Up @@ -1469,7 +1469,7 @@ jobs:
j8_cqlsh-dtests-py3-no-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -1545,7 +1545,7 @@ jobs:
utests_long:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 1
Expand Down Expand Up @@ -1590,7 +1590,7 @@ jobs:
utests_fqltool:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 1
Expand Down Expand Up @@ -1635,7 +1635,7 @@ jobs:
j11_dtests-no-vnodes:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11:20181210
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down Expand Up @@ -1715,7 +1715,7 @@ jobs:
utests_compression:
docker:
- image: spod/cassandra-testing-ubuntu1810-java11-w-dependencies:20190306
resource_class: medium
resource_class: xlarge
working_directory: ~/
shell: /bin/bash -eo pipefail -l
parallelism: 4
Expand Down
7 changes: 5 additions & 2 deletions src/java/org/apache/cassandra/cache/ChunkCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.cassandra.io.util.*;
import org.apache.cassandra.metrics.ChunkCacheMetrics;
import org.apache.cassandra.utils.memory.BufferPool;
import org.apache.cassandra.utils.memory.BufferPoolManager;

public class ChunkCache
implements CacheLoader<ChunkCache.Key, ChunkCache.Buffer>, RemovalListener<ChunkCache.Key, ChunkCache.Buffer>, CacheSize
Expand All @@ -45,6 +46,8 @@ public class ChunkCache
private static boolean enabled = cacheSize > 0;
public static final ChunkCache instance = enabled ? new ChunkCache() : null;

private static final BufferPool bufferPool = BufferPoolManager.longLived();

private final LoadingCache<Key, Buffer> cache;
public final ChunkCacheMetrics metrics;

Expand Down Expand Up @@ -130,7 +133,7 @@ public long offset()
public void release()
{
if (references.decrementAndGet() == 0)
BufferPool.put(buffer);
bufferPool.put(buffer);
}
}

Expand All @@ -149,7 +152,7 @@ private ChunkCache()
@Override
public Buffer load(Key key)
{
ByteBuffer buffer = BufferPool.get(key.file.chunkSize(), key.file.preferredBufferType());
ByteBuffer buffer = bufferPool.get(key.file.chunkSize(), key.file.preferredBufferType());
assert buffer != null;
key.file.readChunk(key.position, buffer);
return new Buffer(buffer, key.position);
Expand Down
2 changes: 2 additions & 0 deletions src/java/org/apache/cassandra/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ public class Config
private static boolean isClientMode = false;
private static Supplier<Config> overrideLoadConfig = null;

public Integer network_cache_size_in_mb;

public Integer file_cache_size_in_mb;

/**
Expand Down
14 changes: 14 additions & 0 deletions src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ else if (conf.disk_access_mode == Config.DiskAccessMode.mmap_index_only)
if (conf.concurrent_replicates != null)
logger.warn("concurrent_replicates has been deprecated and should be removed from cassandra.yaml");

if (conf.network_cache_size_in_mb == null)
conf.network_cache_size_in_mb = Math.min(128, (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)));

if (conf.file_cache_size_in_mb == null)
conf.file_cache_size_in_mb = Math.min(512, (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)));

Expand Down Expand Up @@ -2417,6 +2420,17 @@ public static int getFileCacheSizeInMB()
return conf.file_cache_size_in_mb;
}

public static int getNetworkCacheSizeInMB()
{
if (conf.network_cache_size_in_mb == null)
{
// In client mode the value is not set.
assert DatabaseDescriptor.isClientInitialized();
return 0;
}
return conf.network_cache_size_in_mb;
}

public static boolean getFileCacheRoundUp()
{
if (conf.file_cache_round_up == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.apache.cassandra.streaming.StreamSession;
import org.apache.cassandra.streaming.async.StreamCompressionSerializer;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.memory.BufferPool;
import org.apache.cassandra.utils.memory.BufferPoolManager;

import static org.apache.cassandra.net.MessagingService.current_version;

Expand Down Expand Up @@ -153,7 +153,7 @@ protected long write(ChannelProxy proxy, ChecksumValidator validator, AsyncStrea

// this buffer will hold the data from disk. as it will be compressed on the fly by
// AsyncChannelCompressedStreamWriter.write(ByteBuffer), we can release this buffer as soon as we can.
ByteBuffer buffer = BufferPool.get(minReadable, BufferType.OFF_HEAP);
ByteBuffer buffer = BufferPoolManager.ephemeral().get(minReadable, BufferType.OFF_HEAP);
try
{
int readCount = proxy.read(buffer, start);
Expand All @@ -172,7 +172,7 @@ protected long write(ChannelProxy proxy, ChecksumValidator validator, AsyncStrea
}
finally
{
BufferPool.put(buffer);
BufferPoolManager.ephemeral().put(buffer);
}

return toTransfer;
Expand Down
7 changes: 5 additions & 2 deletions src/java/org/apache/cassandra/hints/ChecksummedDataInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.cassandra.utils.Throwables;
import org.apache.cassandra.utils.NativeLibrary;
import org.apache.cassandra.utils.memory.BufferPool;
import org.apache.cassandra.utils.memory.BufferPoolManager;

/**
* A {@link RandomAccessReader} wrapper that calculates the CRC in place.
Expand All @@ -43,6 +44,8 @@
*/
public class ChecksummedDataInput extends RebufferingInputStream
{
private static final BufferPool bufferPool = BufferPoolManager.longLived();

private final CRC32 crc;
private int crcPosition;
private boolean crcUpdateDisabled;
Expand All @@ -55,7 +58,7 @@ public class ChecksummedDataInput extends RebufferingInputStream

ChecksummedDataInput(ChannelProxy channel, BufferType bufferType)
{
super(BufferPool.get(RandomAccessReader.DEFAULT_BUFFER_SIZE, bufferType));
super(bufferPool.get(RandomAccessReader.DEFAULT_BUFFER_SIZE, bufferType));

crc = new CRC32();
crcPosition = 0;
Expand Down Expand Up @@ -244,7 +247,7 @@ private void updateCrc()
@Override
public void close()
{
BufferPool.put(buffer);
bufferPool.put(buffer);
channel.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
import org.apache.cassandra.io.util.ChannelProxy;
import org.apache.cassandra.utils.memory.BufferPool;
import org.apache.cassandra.utils.Throwables;
import org.apache.cassandra.utils.memory.BufferPoolManager;

public final class CompressedChecksummedDataInput extends ChecksummedDataInput
{
private static final BufferPool bufferPool = BufferPoolManager.longLived();

private final ICompressor compressor;
private volatile long filePosition = 0; // Current position in file, advanced when reading chunk.
private volatile long sourcePosition = 0; // Current position in file to report, advanced after consuming chunk.
Expand Down Expand Up @@ -117,9 +120,9 @@ protected void readBuffer()
int bufferSize = compressedSize + (compressedSize / 20); // allocate +5% to cover variability in compressed size
if (compressedBuffer != null)
{
BufferPool.put(compressedBuffer);
bufferPool.put(compressedBuffer);
}
compressedBuffer = BufferPool.get(bufferSize, compressor.preferredBufferType());
compressedBuffer = bufferPool.get(bufferSize, compressor.preferredBufferType());
}

compressedBuffer.clear();
Expand All @@ -131,8 +134,8 @@ protected void readBuffer()
if (buffer.capacity() < uncompressedSize)
{
int bufferSize = uncompressedSize + (uncompressedSize / 20);
BufferPool.put(buffer);
buffer = BufferPool.get(bufferSize, compressor.preferredBufferType());
bufferPool.put(buffer);
buffer = bufferPool.get(bufferSize, compressor.preferredBufferType());
}

buffer.clear();
Expand All @@ -151,7 +154,7 @@ protected void readBuffer()
@Override
public void close()
{
BufferPool.put(compressedBuffer);
bufferPool.put(compressedBuffer);
super.close();
}

Expand Down
Loading