Skip to content
Permalink
Browse files
Add memtable API (CEP-11)
patch by Branimir Lambov; reviewed by Andrés de la Peña and Caleb Rackliffe for CASSANDRA-17034
  • Loading branch information
blambov committed Apr 29, 2022
1 parent 77d6bbf commit e4e19e33faf9ac7cf27a9779c8083a7f5c5b865a
Showing 241 changed files with 5,626 additions and 2,007 deletions.
@@ -79,7 +79,7 @@
<exclude name="**/tools/cqlstress-lwt-example.yaml"/>
<!-- Documentation files -->
<exclude NAME="**/doc/modules/**/*"/>
<exclude NAME="**/src/java/**/Paxos.md"/>
<exclude NAME="**/src/java/**/*.md"/>
<!-- NOTICE files -->
<exclude NAME="**/NOTICE.md"/>
<!-- LICENSE files -->
@@ -1,4 +1,5 @@
4.1
* Add a pluggable memtable API (CEP-11 / CASSANDRA-17034)
* Save sstable id as string in activity table (CASSANDRA-17585)
* Implement startup check to prevent Cassandra to potentially spread zombie data (CASSANDRA-17180)
* Allow failing startup on duplicate config keys (CASSANDRA-17379)
@@ -56,6 +56,8 @@ using the provided 'sstableupgrade' tool.

New features
------------
- Added API for alternative memtable implementations. For details, see
src/java/org/apache/cassandra/db/memtable/Memtable_API.md
- Added a new guardrails framework allowing to define soft/hard limits for different user actions, such as limiting
the number of tables, columns per table or the size of collections. These guardrails are only applied to regular
user queries, and superusers and internal queries are excluded. Reaching the soft limit raises a client warning,
@@ -88,7 +90,7 @@ New features
- Whether querying with ALLOW FILTERING is allowed.
- Add support for the use of pure monotonic functions on the last attribute of the GROUP BY clause.
- Add floor functions that can be use to group by time range.
- Support for native transport rate limiting via native_transport_rate_limiting_enabled and
- Support for native transport rate limiting via native_transport_rate_limiting_enabled and
native_transport_max_requests_per_second in cassandra.yaml.
- Support for pre hashing passwords on CQL DCL commands
- Expose all client options via system_views.clients and nodetool clientstats.
@@ -1369,10 +1369,12 @@

<target name="build-jmh" depends="build-test, jar" description="Create JMH uber jar">
<jar jarfile="${build.test.dir}/deps.jar">
<zipgroupfileset dir="${build.dir.lib}/jars">
<zipgroupfileset dir="${test.lib}/jars">
<include name="*jmh*.jar"/>
<include name="jopt*.jar"/>
<include name="commons*.jar"/>
<include name="junit*.jar"/>
<include name="hamcrest*.jar"/>
</zipgroupfileset>
<zipgroupfileset dir="${build.lib}" includes="*.jar"/>
</jar>
@@ -44,5 +44,14 @@ restore_directories=
# or equal to this timestamp will be applied.
restore_point_in_time=

# Snapshot commit log position override. This should not be normally necessary, unless the snapshot used a method other
# than sstables to store data (e.g. persistent memtable was restored from snapshot).
# Format: segmentId, position
#
# Recovery will not replay any commit log data before the specified commit log position. It will NOT exclude the
# intervals covered by existing sstables from the replay interval, i.e. it will replay data that may already be in
# sstables.
snapshot_commitlog_position=

# precision of the timestamp used in the inserts (MILLISECONDS, MICROSECONDS, ...)
precision=MICROSECONDS
@@ -658,6 +658,7 @@ def test_describe_columnfamily_output(self):
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND memtable = 'default'
AND crc_check_chance = 1.0
AND default_time_to_live = 0
AND extensions = {}
@@ -21,6 +21,7 @@
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -174,6 +175,17 @@ public static Set<String> splitCommaDelimited(String src)
public SmallestDataStorageMebibytes memtable_offheap_space;
public Float memtable_cleanup_threshold = null;

public static class MemtableOptions
{
public LinkedHashMap<String, InheritingClass> configurations; // order must be preserved

public MemtableOptions()
{
}
}

public MemtableOptions memtable;

// Limit the maximum depth of repair session merkle trees
@Deprecated
public volatile Integer repair_session_max_tree_depth = null;
@@ -3326,6 +3326,13 @@ public static Float getMemtableCleanupThreshold()
return conf.memtable_cleanup_threshold;
}

public static Map<String, InheritingClass> getMemtableConfigurations()
{
if (conf == null || conf.memtable == null)
return null;
return conf.memtable.configurations;
}

public static int getIndexSummaryResizeIntervalInMinutes()
{
return conf.index_summary_resize_interval.toMinutesAsInt();
@@ -0,0 +1,78 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.cassandra.config;

import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.cassandra.exceptions.ConfigurationException;

public class InheritingClass extends ParameterizedClass
{
public String inherits = null;

@SuppressWarnings("unused") // for snakeyaml
public InheritingClass()
{
}

public InheritingClass(String inherits, String class_name, Map<String, String> parameters)
{
super(class_name, parameters);
this.inherits = inherits;
}

@SuppressWarnings("unused")
public InheritingClass(Map<String, ?> p)
{
super(p);
this.inherits = p.get("inherits").toString();
}

public ParameterizedClass resolve(Map<String, ParameterizedClass> map)
{
if (inherits == null)
return this;
ParameterizedClass p