Michael Semb Wever created CASSANDRA-21699:
----------------------------------------------

             Summary: InMemoryTrie reads the row overhead property for its size 
limit
                 Key: CASSANDRA-21699
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21699
             Project: Apache Cassandra
          Issue Type: Bug
          Components: Local/Memtable
            Reporter: Michael Semb Wever


{{InMemoryTrie}} reads {{cassandra.memtable.row_overhead_size}} for its 
allocated size threshold:

{code:java}
int limitInMB = CassandraRelevantProperties.MEMTABLE_OVERHEAD_SIZE.getInt(2048 
* 10 / 11);
if (limitInMB < 1 || limitInMB > 2047)
    throw new AssertionError(...);
{code}

That property is a byte count that {{SkipListMemtable}} reads for its per-row 
overhead, and the trie reads the same value as a megabyte count, so one 
property drives two unrelated settings. An operator who tunes the row overhead 
moves the trie threshold as well, and a row overhead above 2047 makes the class 
initialiser throw an {{AssertionError}}.

{{SimulationRunner}} shows the effect in the tree: it sets the property to 100 
for the row overhead, which cuts the trie threshold from 1861MB to 100MB, so a 
simulated trie memtable reports that it reached its limit after a twentieth of 
the memory the default allows.

{{CassandraRelevantProperties}} already declares {{MEMTABLE_TRIE_SIZE_LIMIT}} 
({{cassandra.trie_size_limit_mb}}), and no code reads it. The patch reads that 
property instead, and names it in the range message. The default threshold does 
not change. The static block becomes a package-private method, so a test can 
read the threshold more than once.

Patch: 
[mck/upstream/trie-size-limit-property/5.0|https://github.com/thelastpickle/cassandra/tree/mck/upstream/trie-size-limit-property/5.0]
Provenance: 
[eb272c8458|https://github.com/datastax/cassandra/commit/eb272c8458390d6e3bbbb557c62cf68b9967f04c]
 by [~mike_tr_adamson]. That commit makes the same property change and also 
lowers the default threshold to 1GB, which this patch leaves out, because the 
default belongs to a separate discussion. That commit carries no test; this 
patch adds one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to