Skip to content

Conversation

netudima
Copy link
Contributor

Before the fix during a capacity extension BufferPoolAllocator returned to BufferPool a sliced ByteBuffer wrapper object instead of the originally allocated one, so the ByteBuffer was not recycled by BufferPool

Adjust BufferPoolAllocatorTest to test the ByteBuf capacity extension with a real BufferPool behaviuor

Patch by Dmitry Konstantinov; reviewed by TBD for CASSANDRA-20753

…tended

Before the fix during a capacity extension BufferPoolAllocator returned to BufferPool a sliced ByteBuffer wrapper object instead of the originally allocated one, so the ByteBuffer was not recycled by BufferPool
Adjust BufferPoolAllocatorTest to test the ByteBuf capacity extension with a real BufferPool behavior

Patch by Dmitry Konstantinov; reviewed by TBD for CASSANDRA-20753
Comment on lines +1629 to +1635
return originalBuffer;
if (Chunk.getParentChunk(buffer) != null)
return buffer;

Object attachment = MemoryUtil.getAttachment(buffer);
if (!(attachment instanceof ByteBuffer))
return originalBuffer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the two places where we fallback to return originalBuffer; is there any difference if originalBuffer or the previous buffer value (not the current value of buffer) was returned ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I relied on a common sense logic here: if we get something non-expected as an input - do not modify it and return the original value (it is also a fallback to the original behaviour), it is just a safer approach by default, IMHO

@michaelsembwever
Copy link
Member

on the 5.0 patch can we run the multiplexer on the test please.

.build/run-tests.sh -a test-t BufferPoolAllocatorTest -e REPEATED_TESTS_COUNT=1000

@netudima
Copy link
Contributor Author

netudima commented Aug 18, 2025

the repeated run is passed using 5.0 branch (https://github.com/netudima/cassandra/tree/CASSANDRA-20753-5.0):

failure rate: 0/1000
Generating Test Summary for test files found under /Users/dmitry/IdeaProjects/cassandra-5.0/build/test/output
[Test Summary] Run: 9, Failed: 0, Errors: 0, Skipped: 0

used command:

.build/run-tests.sh -a test-repeat -t BufferPoolAllocatorTest -e REPEATED_TESTS_COUNT=1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants