-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Improve memtable allocator accounting when updating AtomicBTreePartition #2186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Patch by Benedict Elliott Smith; review by Jon Meredith and Benjamin Lerer for CASSANDRA-18125
| // Create the initial row to populate the partition with | ||
| Row.Builder initialRowBuilder = BTreeRow.unsortedBuilder(); | ||
| initialRowBuilder.newRow(regular.isStatic() ? Clustering.STATIC_CLUSTERING : Clustering.EMPTY); | ||
|
|
||
| initialRowBuilder.addCell(makeCell(regular, initialTS, initialTTL, initialLDT, initialValueBB, null)); | ||
| if (initialComplexDeletionTime != DeletionTime.LIVE) | ||
| initialRowBuilder.addComplexDeletion(complex, initialComplexDeletionTime); | ||
| int cellPath = 1000; | ||
| for (int i = 0; i < numC2InitialCells; i++) | ||
| initialRowBuilder.addCell(makeCell(complex, initialTS, initialTTL, initialLDT, | ||
| ByteBufferUtil.EMPTY_BYTE_BUFFER, | ||
| CellPath.create(ByteBufferUtil.bytes(cellPath--)))); | ||
| Row initialRow = initialRowBuilder.build(); | ||
|
|
||
| // Create the update row to modify the partition with | ||
| Row.Builder updateRowBuilder = BTreeRow.unsortedBuilder(); | ||
| updateRowBuilder.newRow(regular.isStatic() ? Clustering.STATIC_CLUSTERING : Clustering.EMPTY); | ||
|
|
||
| updateRowBuilder.addCell(makeCell(regular, updateTS, updateTTL, updateLDT, updateValueBB, null)); | ||
| if (updateComplexDeletionTime != DeletionTime.LIVE) | ||
| updateRowBuilder.addComplexDeletion(complex, updateComplexDeletionTime); | ||
|
|
||
| // Make multiple update cells to make any issues more pronounced | ||
| cellPath = 1000; | ||
| for (int i = 0; i < numC2UpdateCells; i++) | ||
| updateRowBuilder.addCell(makeCell(complex, updateTS, updateTTL, updateLDT, | ||
| ByteBufferUtil.EMPTY_BYTE_BUFFER, | ||
| CellPath.create(ByteBufferUtil.bytes(cellPath++)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: It seems that the 2 blocks are the same if I am not mistaken. They could be refactored as a method
The difference is the direction the cellPaths go to make some distinct and some overlapping elements. It could be factored out but felt like a lot more passing settings around.
|
|
||
| public long offHeapSize() | ||
| { | ||
| long size = simpleSize(MemoryUtil.getInt(peer + LENGTH)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
simpleSizename is really confusing. I think we should inline the method. It would be much clearer.
Also used in the constructor so want to keep it DRY. Could rename to offHeapSizeWithoutCellPath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it sounds much better.
| return new BufferCell(column, timestamp, ttl, localDeletionTime, value, path); | ||
| } | ||
|
|
||
| void testCase(int initialTS, int initialTTL, int initialLDT, DeletionTime initialCDT, int numC2InitialCells, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Would it not be more readable to have some object to bundle all those information together.
| <exclusion groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl"/> | ||
| </dependency> | ||
| <dependency groupId="net.java.dev.jna" artifactId="jna" version="5.6.0"/> | ||
| <dependency groupId="net.java.dev.jna" artifactId="jna" version="5.13.0"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will drop this from the patch - accidentally committed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to ask about it.
|
Merged. |
See CASSANDRA-18125