-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-18397: Unified Compaction Strategy #2287
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
Changes from all commits
dabda81
5b91a01
712527a
1318f1d
e814929
3be1fd4
f9a2d0e
a0d68b6
1b06396
d4cf1f3
e5582c3
fec6e8b
955b73e
c095067
9197ba7
e2295f4
13a71ae
b2835f2
41defe6
6447708
fa86c79
08384a9
a38d50f
6b7e755
58ba8f1
f586649
920022c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
| import org.apache.cassandra.db.virtual.LogMessagesTable; | ||
| import org.apache.cassandra.exceptions.ConfigurationException; | ||
| import org.apache.cassandra.service.FileSystemOwnershipCheck; | ||
| import org.apache.cassandra.utils.FBUtilities; | ||
| import org.apache.cassandra.utils.StorageCompatibilityMode; | ||
|
|
||
| // checkstyle: suppress below 'blockSystemPropertyUsage' | ||
|
|
@@ -516,6 +517,12 @@ public enum CassandraRelevantProperties | |
| TRIGGERS_DIR("cassandra.triggers_dir"), | ||
| TRUNCATE_BALLOT_METADATA("cassandra.truncate_ballot_metadata"), | ||
| TYPE_UDT_CONFLICT_BEHAVIOR("cassandra.type.udt.conflict_behavior"), | ||
| // See org.apache.cassandra.db.compaction.unified.Controller for the definition of the UCS parameters | ||
| UCS_BASE_SHARD_COUNT("unified_compaction.base_shard_count", "4"), | ||
|
||
| UCS_OVERLAP_INCLUSION_METHOD("unified_compaction.overlap_inclusion_method"), | ||
| UCS_SCALING_PARAMETER("unified_compaction.scaling_parameters", "T4"), | ||
| UCS_SURVIVAL_FACTOR("unified_compaction.survival_factor", "1"), | ||
| UCS_TARGET_SSTABLE_SIZE("unified_compaction.target_sstable_size", "1GiB"), | ||
| UDF_EXECUTOR_THREAD_KEEPALIVE_MS("cassandra.udf_executor_thread_keepalive_ms", "30000"), | ||
| UNSAFE_SYSTEM("cassandra.unsafesystem"), | ||
| /** User's home directory. */ | ||
|
|
@@ -725,6 +732,56 @@ public long getLong(long overrideDefaultValue) | |
| return LONG_CONVERTER.convert(value); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the value of a system property as a double. | ||
| * @return System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set. | ||
| */ | ||
| public double getDouble() | ||
| { | ||
| String value = System.getProperty(key); | ||
| if (value == null && defaultVal == null) | ||
| throw new ConfigurationException("Missing property value or default value is not set: " + key); | ||
| return DOUBLE_CONVERTER.convert(value == null ? defaultVal : value); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the value of a system property as a double. | ||
| * @return system property value if it exists, defaultValue otherwise. | ||
| */ | ||
| public double getDouble(double overrideDefaultValue) | ||
| { | ||
| String value = System.getProperty(key); | ||
| if (value == null) | ||
| return overrideDefaultValue; | ||
|
|
||
| return DOUBLE_CONVERTER.convert(value); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the value of a system property, given as a human-readable size in bytes (e.g. 100MiB, 10GB, 500B). | ||
| * @return System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set. | ||
| */ | ||
| public long getSizeInBytes() | ||
| { | ||
| String value = System.getProperty(key); | ||
| if (value == null && defaultVal == null) | ||
| throw new ConfigurationException("Missing property value or default value is not set: " + key); | ||
| return SIZE_IN_BYTES_CONVERTER.convert(value == null ? defaultVal : value); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the value of a system property, given as a human-readable size in bytes (e.g. 100MiB, 10GB, 500B). | ||
| * @return System property value if it exists, defaultValue otherwise. | ||
| */ | ||
| public long getSizeInBytes(long overrideDefaultValue) | ||
| { | ||
| String value = System.getProperty(key); | ||
| if (value == null) | ||
| return overrideDefaultValue; | ||
|
|
||
| return SIZE_IN_BYTES_CONVERTER.convert(value); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the value of a system property as an int. | ||
| * @return system property int value if it exists, overrideDefaultValue otherwise. | ||
|
|
@@ -847,6 +904,32 @@ public interface PropertyConverter<T> | |
| } | ||
| }; | ||
|
|
||
| private static final PropertyConverter<Long> SIZE_IN_BYTES_CONVERTER = value -> | ||
| { | ||
| try | ||
| { | ||
| return FBUtilities.parseHumanReadableBytes(value); | ||
| } | ||
| catch (ConfigurationException e) | ||
| { | ||
| throw new ConfigurationException(String.format("Invalid value for system property: " + | ||
| "expected size in bytes with unit but got '%s'\n%s", value, e)); | ||
| } | ||
| }; | ||
|
|
||
| private static final PropertyConverter<Double> DOUBLE_CONVERTER = value -> | ||
| { | ||
| try | ||
| { | ||
| return Double.parseDouble(value); | ||
| } | ||
| catch (NumberFormatException e) | ||
| { | ||
| throw new ConfigurationException(String.format("Invalid value for system property: " + | ||
| "expected floating point value but got '%s'", value)); | ||
| } | ||
| }; | ||
|
|
||
| /** | ||
| * @return whether a system property is present or not. | ||
| */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1098,6 +1098,11 @@ public enum PaxosOnLinearizabilityViolation | |
| public volatile long min_tracked_partition_tombstone_count = 5000; | ||
| public volatile boolean top_partitions_enabled = true; | ||
|
|
||
| /** | ||
| * Default compaction configuration, used if a table does not specify any. | ||
| */ | ||
| public ParameterizedClass default_compaction = null; | ||
|
||
|
|
||
| public static Supplier<Config> getOverrideLoadConfig() | ||
| { | ||
| return overrideLoadConfig; | ||
|
|
||
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.
As this is a newly introduced configuration, so I think we should give a more detailed description abouth the usage, like :
class_name should be the different compaction strategy name , parameters sholud be the maps of differen parameters that different compaction strategy used. Then the next is an example
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 started changing this to:
but then realized this is out of line with other such items in the YAML, which give the configuration by example only. E.g.
commitlog_compression,hints_compressionare described similarly and go through the same transformation (classamong other parameters in the schema toclass_nameandparametersfields in the YAML).I'm leaning towards keeping it short and in line with other items, but I'm happy to change it if you prefer.
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.
ok,then I think keep same with "commitlog_compression" or "hints_compression" is enough.