Merge branch 'cassandra-5.0' into trunk

* cassandra-5.0:
  Don't allocate in ThreadLocalReadAheadBuffer#close()
This commit is contained in:
Jordan West 2025-04-28 13:28:21 -07:00
commit 84fdf2efd9
2 changed files with 12 additions and 8 deletions

View File

@ -183,6 +183,7 @@
* Add the ability to disable bulk loading of SSTables (CASSANDRA-18781)
* Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787)
Merged from 5.0:
* Don't allocate in ThreadLocalReadAheadBuffer#close() (CASSANDRA-20551)
* Ensure RowFilter#isMutableIntersection() properly evaluates numeric ranges on a single column (CASSANDRA-20566)
* SAI marks an index as non-empty when a partial partition/row modifications is flushed due to repair (CASSANDRA-20567)
* SAI fails queries when multiple columns exist and a non-indexed column is a composite with a map (CASSANDRA-19891)

View File

@ -131,18 +131,21 @@ public final class ThreadLocalReadAheadBuffer
public void clear(boolean deallocate)
{
Block block = getBlock();
// avoid calling block() here to reduce unintended allocations
Block block = blockMap.get().get(channel.filePath());
if (block == null)
return;
block.index = -1;
if (block.buffer == null)
return;
ByteBuffer blockBuffer = block.buffer;
if (blockBuffer != null)
blockBuffer.clear();
if (deallocate)
{
blockBuffer.clear();
if (deallocate)
{
FileUtils.clean(blockBuffer);
block.buffer = null;
}
FileUtils.clean(blockBuffer);
block.buffer = null;
}
}