[
https://issues.apache.org/jira/browse/CASSANDRA-6689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13915948#comment-13915948
]
Benedict commented on CASSANDRA-6689:
-------------------------------------
bq. there's tons of method whose name starts with an underscore. I'd really
rather avoid that since it's inconsistent with the code base (and given the
time it took us a few years back to remove all underscores to get the code
consistent, I'd rather not reintroduce some now).
These are almost all within one class: AbstractMemory, also a couple in
NativeAllocation. The reason for this is that these are the base classes for
building off-heap objects, so we need methods for the implementation of the
interfaces these objects will represent, but these methods absolutely should
not escape or interfere with the abstractions we are implementing. As an
example, we need a size() method in CellName, and an internal _size() method in
NativeAllocation. They mean two completely different things, and one of them is
only interesting to the internals of any native implementation. I want to avoid
any such clash, or any overhead in establishing that there is no such clash,
and so underscores seem the best solution. We also need to provide lots of
internal methods for getting/putting data/fields from the off-heap region the
object is made up of, and I don't want any confusion about what methods mess
with this, and which methods are actual functionality.
There are a lot of these methods, and putting "internal" as a prefix or
something else doesn't seem any better to me.
bq. why changing all the ByteBuffer.hasArray() calls to !ByteBuffer.isDirect()?
In almost all cases, hasArray() is called to guard some latter calls to array()
and/or arrayOffset() and the ByteBuffer javadoc is pretty explicit on the fact
that hasArray() is the correct method to call in that case.
This is a valid criticism, and in fact I should roll back this change for this
patch. It was necessary for CASSANDRA-6689 as we were abusing ByteBuffer, and
breaking this contract. This is no longer the case, now that we use
NativeAllocation instead.
> Partially Off Heap Memtables
> ----------------------------
>
> Key: CASSANDRA-6689
> URL: https://issues.apache.org/jira/browse/CASSANDRA-6689
> Project: Cassandra
> Issue Type: New Feature
> Components: Core
> Reporter: Benedict
> Assignee: Benedict
> Fix For: 2.1 beta2
>
>
> Move the contents of ByteBuffers off-heap for records written to a memtable.
> (See comments for details)
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)