From a7dd54f822f815f911ff6e7fcf42e55891050dea Mon Sep 17 00:00:00 2001 From: Dikang Gu Date: Mon, 9 Oct 2017 12:41:30 -0700 Subject: [PATCH] [Rocksandra] set merge operands limit Summary: to experiment performance difference Test Plan: will manual test Reviewers: wpc, #ig-cassandra, chenshen, svemuri Reviewed By: chenshen, svemuri Subscribers: trunkagent, fdeliege Differential Revision: https://phabricator.intern.facebook.com/D6011752 Tasks: T21631952 Signature: 6011752:1507580817:364cec6b102924da72bab29d8bd1f12f9bf1ab93 --- src/java/org/apache/cassandra/rocksdb/RocksDBCF.java | 4 ++-- src/java/org/apache/cassandra/rocksdb/RocksDBConfigs.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/cassandra/rocksdb/RocksDBCF.java b/src/java/org/apache/cassandra/rocksdb/RocksDBCF.java index 138f1a15f22c..88faef2bd391 100644 --- a/src/java/org/apache/cassandra/rocksdb/RocksDBCF.java +++ b/src/java/org/apache/cassandra/rocksdb/RocksDBCF.java @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.UUID; @@ -74,6 +73,7 @@ import org.rocksdb.StatsLevel; import org.rocksdb.WriteOptions; +import static org.apache.cassandra.rocksdb.RocksDBConfigs.MERGE_OPERANDS_LIMIT; import static org.apache.cassandra.rocksdb.RocksDBConfigs.ROCKSDB_DIR; /** @@ -114,7 +114,7 @@ public RocksDBCF(ColumnFamilyStore cfs) throws RocksDBException int gcGraceSeconds = cfs.metadata.params.gcGraceSeconds; boolean purgeTtlOnExpiration = cfs.metadata.params.purgeTtlOnExpiration; compactionFilter = new CassandraCompactionFilter(purgeTtlOnExpiration, gcGraceSeconds); - mergeOperator = new CassandraValueMergeOperator(gcGraceSeconds); + mergeOperator = new CassandraValueMergeOperator(gcGraceSeconds, MERGE_OPERANDS_LIMIT); DBOptions dbOptions = new DBOptions(); List cfDescs = new ArrayList<>(); diff --git a/src/java/org/apache/cassandra/rocksdb/RocksDBConfigs.java b/src/java/org/apache/cassandra/rocksdb/RocksDBConfigs.java index 541b10060653..f7100701aeb5 100644 --- a/src/java/org/apache/cassandra/rocksdb/RocksDBConfigs.java +++ b/src/java/org/apache/cassandra/rocksdb/RocksDBConfigs.java @@ -39,6 +39,9 @@ public class RocksDBConfigs // disable write to rocksdb commit log or not, default is false public static final boolean DISABLE_WRITE_TO_COMMITLOG = Boolean.getBoolean("cassandra.rocksdb.disable_write_to_commitlog"); + // Limit the number of operands in merge operator, 0 means no limit + public static final int MERGE_OPERANDS_LIMIT = Integer.getInteger("cassandra.rocksdb.merge_operands_limit", 0); + /** * Streaming configs */