CEP-15: Add Accord configuration stub

Patch by Jacek Lewandowski; reviewed by David Capwell for CASSANDRA-18221
This commit is contained in:
Jacek Lewandowski 2023-10-09 15:05:57 +02:00 committed by David Capwell
parent 27a9313970
commit dfd1e99fd1
24 changed files with 181 additions and 72 deletions

View File

@ -2199,9 +2199,6 @@ drop_compact_storage_enabled: false
# Whether or not USE <keyspace> is allowed. This is enabled by default to avoid failure on upgrade. # Whether or not USE <keyspace> is allowed. This is enabled by default to avoid failure on upgrade.
#use_statements_enabled: true #use_statements_enabled: true
# Enables the execution of Accord (multi-key) transactions on this node.
accord_transactions_enabled: false
# When the client triggers a protocol exception or unknown issue (Cassandra bug) we increment # When the client triggers a protocol exception or unknown issue (Cassandra bug) we increment
# a client metric showing this; this logic will exclude specific subnets from updating these # a client metric showing this; this logic will exclude specific subnets from updating these
# metrics # metrics
@ -2651,3 +2648,16 @@ accord_transactions_enabled: false
# compatibility mode would no longer toggle behaviors as when it was running in the UPGRADING mode. # compatibility mode would no longer toggle behaviors as when it was running in the UPGRADING mode.
# #
storage_compatibility_mode: NONE storage_compatibility_mode: NONE
#accord:
# # Enables the execution of Accord (multi-key) transactions on this node.
# enabled: false
#
# # Journal directory for Accord
# journal_directory:
#
# # The number of Accord shards on this node; -1 means use the number of cores
# shard_count: -1
#
# # Progress log scheduling delay
# progress_log_schedule_delay: 1s

@ -1 +1 @@
Subproject commit 0419858bd1f6761f08fd1369477f7c142f5bbb4f Subproject commit 5ffe3d504bb5aa1ff1c2b96d817791e40f7ced0f

View File

@ -0,0 +1,30 @@
/*
* 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;
public class AccordSpec
{
public volatile boolean enabled = false;
public volatile String journal_directory;
public volatile OptionaldPositiveInt shard_count = OptionaldPositiveInt.UNDEFINED;
public volatile DurationSpec.IntSecondsBound progress_log_schedule_delay = new DurationSpec.IntSecondsBound(1);
}

View File

@ -398,9 +398,6 @@ public class Config
public DataStorageSpec.IntMebibytesBound commitlog_total_space; public DataStorageSpec.IntMebibytesBound commitlog_total_space;
public CommitLogSync commitlog_sync; public CommitLogSync commitlog_sync;
// Accord Journal
public String accord_journal_directory;
@Replaces(oldName = "commitlog_sync_group_window_in_ms", converter = Converters.MILLIS_DURATION_DOUBLE, deprecated = true) @Replaces(oldName = "commitlog_sync_group_window_in_ms", converter = Converters.MILLIS_DURATION_DOUBLE, deprecated = true)
public DurationSpec.IntMillisecondsBound commitlog_sync_group_window = new DurationSpec.IntMillisecondsBound("0ms"); public DurationSpec.IntMillisecondsBound commitlog_sync_group_window = new DurationSpec.IntMillisecondsBound("0ms");
@Replaces(oldName = "commitlog_sync_period_in_ms", converter = Converters.MILLIS_DURATION_INT, deprecated = true) @Replaces(oldName = "commitlog_sync_period_in_ms", converter = Converters.MILLIS_DURATION_INT, deprecated = true)
@ -627,9 +624,6 @@ public class Config
public volatile boolean use_statements_enabled = true; public volatile boolean use_statements_enabled = true;
public boolean accord_transactions_enabled = false;
public OptionaldPositiveInt accord_shard_count = OptionaldPositiveInt.UNDEFINED;
/** /**
* Optionally disable asynchronous UDF execution. * Optionally disable asynchronous UDF execution.
* Disabling asynchronous UDF execution also implicitly disables the security-manager! * Disabling asynchronous UDF execution also implicitly disables the security-manager!
@ -1184,6 +1178,8 @@ public class Config
*/ */
public ParameterizedClass default_compaction = null; public ParameterizedClass default_compaction = null;
public final AccordSpec accord = new AccordSpec();
public static Supplier<Config> getOverrideLoadConfig() public static Supplier<Config> getOverrideLoadConfig()
{ {
return overrideLoadConfig; return overrideLoadConfig;

View File

@ -718,13 +718,14 @@ public class DatabaseDescriptor
conf.commitlog_directory = storagedirFor("commitlog"); conf.commitlog_directory = storagedirFor("commitlog");
} }
if (conf.accord.journal_directory == null)
initializeCommitLogDiskAccessMode(); initializeCommitLogDiskAccessMode();
if (commitLogWriteDiskAccessMode != conf.commitlog_disk_access_mode) if (commitLogWriteDiskAccessMode != conf.commitlog_disk_access_mode)
logger.info("commitlog_disk_access_mode resolved to: {}", commitLogWriteDiskAccessMode); logger.info("commitlog_disk_access_mode resolved to: {}", commitLogWriteDiskAccessMode);
if (conf.accord_journal_directory == null) if (conf.accord.journal_directory == null)
{ {
conf.accord_journal_directory = storagedirFor("accord_journal"); conf.accord.journal_directory = storagedirFor("accord_journal");
} }
if (conf.hints_directory == null) if (conf.hints_directory == null)
@ -802,8 +803,8 @@ public class DatabaseDescriptor
throw new ConfigurationException("local_system_data_file_directory must not be the same as any data_file_directories", false); throw new ConfigurationException("local_system_data_file_directory must not be the same as any data_file_directories", false);
if (datadir.equals(conf.commitlog_directory)) if (datadir.equals(conf.commitlog_directory))
throw new ConfigurationException("commitlog_directory must not be the same as any data_file_directories", false); throw new ConfigurationException("commitlog_directory must not be the same as any data_file_directories", false);
if (datadir.equals(conf.accord_journal_directory)) if (datadir.equals(conf.accord.journal_directory))
throw new ConfigurationException("accord_journal_directory must not be the same as any data_file_directories", false); throw new ConfigurationException("accord.journal_directory must not be the same as any data_file_directories", false);
if (datadir.equals(conf.hints_directory)) if (datadir.equals(conf.hints_directory))
throw new ConfigurationException("hints_directory must not be the same as any data_file_directories", false); throw new ConfigurationException("hints_directory must not be the same as any data_file_directories", false);
if (datadir.equals(conf.saved_caches_directory)) if (datadir.equals(conf.saved_caches_directory))
@ -819,8 +820,8 @@ public class DatabaseDescriptor
{ {
if (conf.local_system_data_file_directory.equals(conf.commitlog_directory)) if (conf.local_system_data_file_directory.equals(conf.commitlog_directory))
throw new ConfigurationException("local_system_data_file_directory must not be the same as the commitlog_directory", false); throw new ConfigurationException("local_system_data_file_directory must not be the same as the commitlog_directory", false);
if (conf.local_system_data_file_directory.equals(conf.accord_journal_directory)) if (conf.local_system_data_file_directory.equals(conf.accord.journal_directory))
throw new ConfigurationException("local_system_data_file_directory must not be the same as the accord_journal_directory", false); throw new ConfigurationException("local_system_data_file_directory must not be the same as the accord.journal_directory", false);
if (conf.local_system_data_file_directory.equals(conf.saved_caches_directory)) if (conf.local_system_data_file_directory.equals(conf.saved_caches_directory))
throw new ConfigurationException("local_system_data_file_directory must not be the same as the saved_caches_directory", false); throw new ConfigurationException("local_system_data_file_directory must not be the same as the saved_caches_directory", false);
if (conf.local_system_data_file_directory.equals(conf.hints_directory)) if (conf.local_system_data_file_directory.equals(conf.hints_directory))
@ -833,17 +834,17 @@ public class DatabaseDescriptor
FBUtilities.prettyPrintMemory(freeBytes)); FBUtilities.prettyPrintMemory(freeBytes));
} }
if (conf.commitlog_directory.equals(conf.accord_journal_directory)) if (conf.commitlog_directory.equals(conf.accord.journal_directory))
throw new ConfigurationException("accord_journal_directory must not be the same as the commitlog_directory", false); throw new ConfigurationException("accord.journal_directory must not be the same as the commitlog_directory", false);
if (conf.commitlog_directory.equals(conf.hints_directory)) if (conf.commitlog_directory.equals(conf.hints_directory))
throw new ConfigurationException("hints_directory must not be the same as the commitlog_directory", false); throw new ConfigurationException("hints_directory must not be the same as the commitlog_directory", false);
if (conf.commitlog_directory.equals(conf.saved_caches_directory)) if (conf.commitlog_directory.equals(conf.saved_caches_directory))
throw new ConfigurationException("saved_caches_directory must not be the same as the commitlog_directory", false); throw new ConfigurationException("saved_caches_directory must not be the same as the commitlog_directory", false);
if (conf.accord_journal_directory.equals(conf.hints_directory)) if (conf.accord.journal_directory.equals(conf.hints_directory))
throw new ConfigurationException("hints_directory must not be the same as the accord_journal_directory", false); throw new ConfigurationException("hints_directory must not be the same as the accord.journal_directory", false);
if (conf.accord_journal_directory.equals(conf.saved_caches_directory)) if (conf.accord.journal_directory.equals(conf.saved_caches_directory))
throw new ConfigurationException("saved_caches_directory must not be the same as the accord_journal_directory", false); throw new ConfigurationException("saved_caches_directory must not be the same as the accord.journal_directory", false);
if (conf.hints_directory.equals(conf.saved_caches_directory)) if (conf.hints_directory.equals(conf.saved_caches_directory))
throw new ConfigurationException("saved_caches_directory must not be the same as the hints_directory", false); throw new ConfigurationException("saved_caches_directory must not be the same as the hints_directory", false);
@ -1145,7 +1146,7 @@ public class DatabaseDescriptor
if (conf.audit_logging_options != null) if (conf.audit_logging_options != null)
setAuditLoggingOptions(conf.audit_logging_options); setAuditLoggingOptions(conf.audit_logging_options);
if (conf.legacy_paxos_strategy == Config.LegacyPaxosStrategy.accord && !conf.accord_transactions_enabled) if (conf.legacy_paxos_strategy == Config.LegacyPaxosStrategy.accord && !conf.accord.enabled)
throw new ConfigurationException(NO_ACCORD_PAXOS_STRATEGY_WITH_ACCORD_DISABLED_MESSAGE); throw new ConfigurationException(NO_ACCORD_PAXOS_STRATEGY_WITH_ACCORD_DISABLED_MESSAGE);
} }
@ -2140,9 +2141,9 @@ public class DatabaseDescriptor
throw new ConfigurationException("commitlog_directory must be specified", false); throw new ConfigurationException("commitlog_directory must be specified", false);
FileUtils.createDirectory(conf.commitlog_directory); FileUtils.createDirectory(conf.commitlog_directory);
if (conf.accord_journal_directory == null) if (conf.accord.journal_directory == null)
throw new ConfigurationException("accord_journal_directory must be specified", false); throw new ConfigurationException("accord.journal_directory must be specified", false);
FileUtils.createDirectory(conf.accord_journal_directory); FileUtils.createDirectory(conf.accord.journal_directory);
if (conf.hints_directory == null) if (conf.hints_directory == null)
throw new ConfigurationException("hints_directory must be specified", false); throw new ConfigurationException("hints_directory must be specified", false);
@ -3049,12 +3050,12 @@ public class DatabaseDescriptor
public static String getAccordJournalDirectory() public static String getAccordJournalDirectory()
{ {
return conf.accord_journal_directory; return conf.accord.journal_directory;
} }
public static void setAccordJournalDirectory(String path) public static void setAccordJournalDirectory(String path)
{ {
conf.accord_journal_directory = path; conf.accord.journal_directory = path;
} }
public static Config.FlushCompression getFlushCompression() public static Config.FlushCompression getFlushCompression()
@ -5218,17 +5219,17 @@ public class DatabaseDescriptor
public static boolean getAccordTransactionsEnabled() public static boolean getAccordTransactionsEnabled()
{ {
return conf.accord_transactions_enabled; return conf.accord.enabled;
} }
public static void setAccordTransactionsEnabled(boolean b) public static void setAccordTransactionsEnabled(boolean b)
{ {
conf.accord_transactions_enabled = b; conf.accord.enabled = b;
} }
public static int getAccordShardCount() public static int getAccordShardCount()
{ {
return conf.accord_shard_count.or(DatabaseDescriptor::getAvailableProcessors); return conf.accord.shard_count.or(DatabaseDescriptor::getAvailableProcessors);
} }
public static boolean getForceNewPreparedStatementBehaviour() public static boolean getForceNewPreparedStatementBehaviour()

View File

@ -17,6 +17,7 @@
*/ */
package org.apache.cassandra.config; package org.apache.cassandra.config;
import java.time.Duration;
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -137,6 +138,11 @@ public abstract class DurationSpec
return unit; return unit;
} }
public Duration toDuration()
{
return Duration.of(quantity(), unit().toChronoUnit());
}
/** /**
* @param symbol the time unit symbol * @param symbol the time unit symbol
* @return the time unit associated to the specified symbol * @return the time unit associated to the specified symbol

View File

@ -99,7 +99,7 @@ public class TransactionStatement implements CQLStatement.CompositeCQLStatement,
public static final String NO_TIMESTAMPS_IN_UPDATES_MESSAGE = "Updates within transactions may not specify custom timestamps; %s statement %s"; public static final String NO_TIMESTAMPS_IN_UPDATES_MESSAGE = "Updates within transactions may not specify custom timestamps; %s statement %s";
public static final String EMPTY_TRANSACTION_MESSAGE = "Transaction contains no reads or writes"; public static final String EMPTY_TRANSACTION_MESSAGE = "Transaction contains no reads or writes";
public static final String SELECT_REFS_NEED_COLUMN_MESSAGE = "SELECT references must specify a column."; public static final String SELECT_REFS_NEED_COLUMN_MESSAGE = "SELECT references must specify a column.";
public static final String TRANSACTIONS_DISABLED_MESSAGE = "Accord transactions are disabled. (See accord_transactions_enabled in cassandra.yaml)"; public static final String TRANSACTIONS_DISABLED_MESSAGE = "Accord transactions are disabled. (See accord.enabled in cassandra.yaml)";
public static final String ILLEGAL_RANGE_QUERY_MESSAGE = "Range queries are not allowed for reads within a transaction; %s %s"; public static final String ILLEGAL_RANGE_QUERY_MESSAGE = "Range queries are not allowed for reads within a transaction; %s %s";
static class NamedSelect static class NamedSelect

View File

@ -0,0 +1,40 @@
/*
* 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.service.accord;
import java.time.Duration;
import accord.config.LocalConfig;
import org.apache.cassandra.config.Config;
public class AccordConfiguration implements LocalConfig
{
private final Config config;
public AccordConfiguration(Config config)
{
this.config = config;
}
@Override
public Duration getProgressLogScheduleDelay()
{
return config.accord.progress_log_schedule_delay.toDuration();
}
}

View File

@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import accord.api.Result; import accord.api.Result;
import accord.config.LocalConfig;
import accord.coordinate.Preempted; import accord.coordinate.Preempted;
import accord.coordinate.Timeout; import accord.coordinate.Timeout;
import accord.impl.AbstractConfigurationService; import accord.impl.AbstractConfigurationService;
@ -105,6 +106,7 @@ public class AccordService implements IAccordService, Shutdownable
private final AccordDataStore dataStore; private final AccordDataStore dataStore;
private final AccordJournal journal; private final AccordJournal journal;
private final AccordVerbHandler<? extends Request> verbHandler; private final AccordVerbHandler<? extends Request> verbHandler;
private final LocalConfig configuration;
private static final IAccordService NOOP_SERVICE = new IAccordService() private static final IAccordService NOOP_SERVICE = new IAccordService()
{ {
@ -117,13 +119,13 @@ public class AccordService implements IAccordService, Shutdownable
@Override @Override
public TxnData coordinate(Txn txn, ConsistencyLevel consistencyLevel) public TxnData coordinate(Txn txn, ConsistencyLevel consistencyLevel)
{ {
throw new UnsupportedOperationException("No accord transaction should be executed when accord_transactions_enabled = false in cassandra.yaml"); throw new UnsupportedOperationException("No accord transaction should be executed when accord.enabled = false in cassandra.yaml");
} }
@Override @Override
public long currentEpoch() public long currentEpoch()
{ {
throw new UnsupportedOperationException("Cannot return epoch when accord_transactions_enabled = false in cassandra.yaml"); throw new UnsupportedOperationException("Cannot return epoch when accord.enabled = false in cassandra.yaml");
} }
@Override @Override
@ -132,7 +134,7 @@ public class AccordService implements IAccordService, Shutdownable
@Override @Override
public TopologyManager topology() public TopologyManager topology()
{ {
throw new UnsupportedOperationException("Cannot return topology when accord_transactions_enabled = false in cassandra.yaml"); throw new UnsupportedOperationException("Cannot return topology when accord.enabled = false in cassandra.yaml");
} }
@Override @Override
@ -227,6 +229,7 @@ public class AccordService implements IAccordService, Shutdownable
this.scheduler = new AccordScheduler(); this.scheduler = new AccordScheduler();
this.dataStore = new AccordDataStore(); this.dataStore = new AccordDataStore();
this.journal = new AccordJournal(); this.journal = new AccordJournal();
this.configuration = new AccordConfiguration(DatabaseDescriptor.getRawConfig());
this.node = new Node(localId, this.node = new Node(localId,
messageSink, messageSink,
this::handleLocalMessage, this::handleLocalMessage,
@ -240,7 +243,8 @@ public class AccordService implements IAccordService, Shutdownable
scheduler, scheduler,
SizeOfIntersectionSorter.SUPPLIER, SizeOfIntersectionSorter.SUPPLIER,
SimpleProgressLog::new, SimpleProgressLog::new,
AccordCommandStores.factory(journal)); AccordCommandStores.factory(journal),
configuration);
this.nodeShutdown = toShutdownable(node); this.nodeShutdown = toShutdownable(node);
this.verbHandler = new AccordVerbHandler<>(node, configService, journal); this.verbHandler = new AccordVerbHandler<>(node, configService, journal);
} }

View File

@ -25,7 +25,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
cdc_enabled: false cdc_enabled: false
hints_directory: build/test/cassandra/hints hints_directory: build/test/cassandra/hints
@ -88,3 +87,5 @@ authenticator:
class_name : org.apache.cassandra.auth.MutualTlsAuthenticator class_name : org.apache.cassandra.auth.MutualTlsAuthenticator
parameters : parameters :
validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -8,7 +8,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
cdc_enabled: false cdc_enabled: false
hints_directory: build/test/cassandra/hints hints_directory: build/test/cassandra/hints
@ -43,3 +42,5 @@ user_defined_functions_enabled: true
scripted_user_defined_functions_enabled: false scripted_user_defined_functions_enabled: false
sasi_indexes_enabled: true sasi_indexes_enabled: true
materialized_views_enabled: true materialized_views_enabled: true
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -9,7 +9,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size_in_mb: 5 commitlog_segment_size_in_mb: 5
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
# commitlog_compression: # commitlog_compression:
# - class_name: LZ4Compressor # - class_name: LZ4Compressor
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
@ -57,3 +56,5 @@ internode_send_buff_size_in_bytes: 5
internode_recv_buff_size_in_bytes: 5 internode_recv_buff_size_in_bytes: 5
max_hint_window_in_ms: 10800000 max_hint_window_in_ms: 10800000
cache_load_timeout_seconds: 35 cache_load_timeout_seconds: 35
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -27,7 +27,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
# commitlog_compression: # commitlog_compression:
# - class_name: LZ4Compressor # - class_name: LZ4Compressor
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
@ -150,3 +149,5 @@ stream_throughput_outbound: 24MiB/s
sasi_indexes_enabled: true sasi_indexes_enabled: true
materialized_views_enabled: true materialized_views_enabled: true
file_cache_enabled: true file_cache_enabled: true
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -27,7 +27,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
# commitlog_compression: # commitlog_compression:
# - class_name: LZ4Compressor # - class_name: LZ4Compressor
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
@ -147,3 +146,5 @@ stream_throughput_outbound: 24MiB/s
sasi_indexes_enabled: true sasi_indexes_enabled: true
materialized_views_enabled: true materialized_views_enabled: true
file_cache_enabled: true file_cache_enabled: true
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -27,7 +27,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
# commitlog_compression: # commitlog_compression:
# - class_name: LZ4Compressor # - class_name: LZ4Compressor
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
@ -151,3 +150,5 @@ stream_throughput_outbound: 24MiB/s
sasi_indexes_enabled: true sasi_indexes_enabled: true
materialized_views_enabled: true materialized_views_enabled: true
file_cache_enabled: true file_cache_enabled: true
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -9,7 +9,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
cdc_enabled: false cdc_enabled: false
hints_directory: build/test/cassandra/hints hints_directory: build/test/cassandra/hints
@ -42,3 +41,5 @@ row_cache_class_name: org.apache.cassandra.cache.OHCProvider
row_cache_size: 16MiB row_cache_size: 16MiB
user_defined_functions_enabled: true user_defined_functions_enabled: true
scripted_user_defined_functions_enabled: false scripted_user_defined_functions_enabled: false
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -27,7 +27,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
# commitlog_compression: # commitlog_compression:
# - class_name: LZ4Compressor # - class_name: LZ4Compressor
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
@ -81,3 +80,5 @@ stream_throughput_outbound: 23841858MiB/s
sasi_indexes_enabled: true sasi_indexes_enabled: true
materialized_views_enabled: true materialized_views_enabled: true
file_cache_enabled: true file_cache_enabled: true
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -27,7 +27,6 @@ commitlog_sync: periodic
commitlog_sync_period: 10s commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
accord_journal_directory: build/test/cassandra/accord_journal
# commitlog_compression: # commitlog_compression:
# - class_name: LZ4Compressor # - class_name: LZ4Compressor
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
@ -84,3 +83,5 @@ stream_throughput_outbound: 23841858MiB/s
sasi_indexes_enabled: true sasi_indexes_enabled: true
materialized_views_enabled: true materialized_views_enabled: true
file_cache_enabled: true file_cache_enabled: true
accord:
journal_directory: build/test/cassandra/accord_journal

View File

@ -10,7 +10,6 @@ commitlog_sync_period: 10s
commitlog_segment_size: 5MiB commitlog_segment_size: 5MiB
commitlog_directory: build/test/cassandra/commitlog commitlog_directory: build/test/cassandra/commitlog
commitlog_disk_access_mode: legacy commitlog_disk_access_mode: legacy
accord_journal_directory: build/test/cassandra/accord_journal
# commitlog_compression: # commitlog_compression:
# - class_name: LZ4Compressor # - class_name: LZ4Compressor
cdc_raw_directory: build/test/cassandra/cdc_raw cdc_raw_directory: build/test/cassandra/cdc_raw
@ -57,7 +56,6 @@ file_cache_enabled: true
full_query_logging_options: full_query_logging_options:
allow_nodetool_archive_command: true allow_nodetool_archive_command: true
auto_hints_cleanup_enabled: true auto_hints_cleanup_enabled: true
accord_transactions_enabled: true
heap_dump_path: build/test heap_dump_path: build/test
dump_heap_on_uncaught_exception: false dump_heap_on_uncaught_exception: false
@ -116,3 +114,9 @@ memtable:
class_name: TrieMemtable class_name: TrieMemtable
# Note: keep the memtable configuration at the end of the file, so that the default mapping can be changed without # Note: keep the memtable configuration at the end of the file, so that the default mapping can be changed without
# duplicating the whole section above. # duplicating the whole section above.
accord:
enabled: true
journal_directory: build/test/cassandra/accord_journal
shard_count: 4
progress_log_schedule_delay: 1s

View File

@ -31,6 +31,8 @@ import java.util.function.Function;
import com.vdurmont.semver4j.Semver; import com.vdurmont.semver4j.Semver;
import org.apache.cassandra.config.CassandraRelevantProperties; import org.apache.cassandra.config.CassandraRelevantProperties;
import org.apache.cassandra.config.AccordSpec;
import org.apache.cassandra.config.OptionaldPositiveInt;
import org.apache.cassandra.distributed.api.Feature; import org.apache.cassandra.distributed.api.Feature;
import org.apache.cassandra.distributed.api.IInstanceConfig; import org.apache.cassandra.distributed.api.IInstanceConfig;
import org.apache.cassandra.distributed.shared.NetworkTopology; import org.apache.cassandra.distributed.shared.NetworkTopology;
@ -72,7 +74,7 @@ public class InstanceConfig implements IInstanceConfig
String commitlog_directory, String commitlog_directory,
String hints_directory, String hints_directory,
String cdc_raw_directory, String cdc_raw_directory,
String accord_journal_directory, AccordSpec accord,
Collection<String> initial_token, Collection<String> initial_token,
int storage_port, int storage_port,
int native_transport_port, int native_transport_port,
@ -93,7 +95,10 @@ public class InstanceConfig implements IInstanceConfig
.set("commitlog_directory", commitlog_directory) .set("commitlog_directory", commitlog_directory)
.set("hints_directory", hints_directory) .set("hints_directory", hints_directory)
.set("cdc_raw_directory", cdc_raw_directory) .set("cdc_raw_directory", cdc_raw_directory)
.set("accord_journal_directory", accord_journal_directory) .set("accord.enabled", accord.enabled)
.set("accord.journal_directory", accord.journal_directory)
.set("accord.shard_count", accord.shard_count.toString())
.set("accord.progress_log_schedule_delay", accord.progress_log_schedule_delay.toString())
.set("partitioner", "org.apache.cassandra.dht.Murmur3Partitioner") .set("partitioner", "org.apache.cassandra.dht.Murmur3Partitioner")
.set("start_native_transport", true) .set("start_native_transport", true)
.set("concurrent_writes", 2) .set("concurrent_writes", 2)
@ -115,7 +120,6 @@ public class InstanceConfig implements IInstanceConfig
// required settings for dtest functionality // required settings for dtest functionality
.set("diagnostic_events_enabled", true) .set("diagnostic_events_enabled", true)
.set("auto_bootstrap", false) .set("auto_bootstrap", false)
.set("accord_transactions_enabled", true)
// capacities that are based on `totalMemory` that should be fixed size // capacities that are based on `totalMemory` that should be fixed size
.set("index_summary_capacity", "50MiB") .set("index_summary_capacity", "50MiB")
.set("counter_cache_size", "50MiB") .set("counter_cache_size", "50MiB")
@ -318,6 +322,10 @@ public class InstanceConfig implements IInstanceConfig
int datadirCount) int datadirCount)
{ {
int seedNode = provisionStrategy.seedNodeNum(); int seedNode = provisionStrategy.seedNodeNum();
AccordSpec accordSpec = new AccordSpec();
accordSpec.enabled = true;
accordSpec.journal_directory = String.format("%s/node%d/accord_journal", root, nodeNum);
accordSpec.shard_count = new OptionaldPositiveInt(4);
return new InstanceConfig(nodeNum, return new InstanceConfig(nodeNum,
networkTopology, networkTopology,
provisionStrategy.ipAddress(nodeNum), provisionStrategy.ipAddress(nodeNum),
@ -331,7 +339,7 @@ public class InstanceConfig implements IInstanceConfig
String.format("%s/node%d/commitlog", root, nodeNum), String.format("%s/node%d/commitlog", root, nodeNum),
String.format("%s/node%d/hints", root, nodeNum), String.format("%s/node%d/hints", root, nodeNum),
String.format("%s/node%d/cdc", root, nodeNum), String.format("%s/node%d/cdc", root, nodeNum),
String.format("%s/node%d/accord_journal", root, nodeNum), accordSpec,
tokens, tokens,
provisionStrategy.storagePort(nodeNum), provisionStrategy.storagePort(nodeNum),
provisionStrategy.nativeTransportPort(nodeNum), provisionStrategy.nativeTransportPort(nodeNum),

View File

@ -174,7 +174,7 @@ public class AccordBootstrapTest extends TestBaseImpl
.withoutVNodes() .withoutVNodes()
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(expandedNodeCount)) .withTokenSupplier(TokenSupplier.evenlyDistributedTokens(expandedNodeCount))
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(expandedNodeCount, "dc0", "rack0")) .withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(expandedNodeCount, "dc0", "rack0"))
.withConfig(config -> config.set("accord_shard_count", 2).with(NETWORK, GOSSIP)) .withConfig(config -> config.set("accord.shard_count", 2).with(NETWORK, GOSSIP))
.start()) .start())
{ {
long initialMax = maxEpoch(cluster); long initialMax = maxEpoch(cluster);

View File

@ -25,8 +25,6 @@ import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.apache.cassandra.schema.Schema;
import org.assertj.core.api.Assertions;
import org.junit.Test; import org.junit.Test;
import org.apache.cassandra.db.virtual.AccordVirtualTables; import org.apache.cassandra.db.virtual.AccordVirtualTables;
@ -39,14 +37,15 @@ import org.apache.cassandra.distributed.api.IIsolatedExecutor;
import org.apache.cassandra.distributed.test.TestBaseImpl; import org.apache.cassandra.distributed.test.TestBaseImpl;
import org.apache.cassandra.exceptions.ConfigurationException; import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.exceptions.InvalidRequestException; import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.schema.Schema;
import org.apache.cassandra.service.accord.AccordService; import org.apache.cassandra.service.accord.AccordService;
import org.apache.cassandra.utils.AssertionUtils; import org.apache.cassandra.utils.AssertionUtils;
import org.assertj.core.api.Assertions;
import static org.junit.Assert.assertEquals;
import static org.apache.cassandra.config.DatabaseDescriptor.NO_ACCORD_PAXOS_STRATEGY_WITH_ACCORD_DISABLED_MESSAGE; import static org.apache.cassandra.config.DatabaseDescriptor.NO_ACCORD_PAXOS_STRATEGY_WITH_ACCORD_DISABLED_MESSAGE;
import static org.apache.cassandra.cql3.statements.TransactionStatement.TRANSACTIONS_DISABLED_MESSAGE; import static org.apache.cassandra.cql3.statements.TransactionStatement.TRANSACTIONS_DISABLED_MESSAGE;
import static org.apache.cassandra.schema.SchemaConstants.ACCORD_KEYSPACE_NAME; import static org.apache.cassandra.schema.SchemaConstants.ACCORD_KEYSPACE_NAME;
import static org.junit.Assert.assertEquals;
public class AccordFeatureFlagTest extends TestBaseImpl public class AccordFeatureFlagTest extends TestBaseImpl
{ {
@ -55,7 +54,7 @@ public class AccordFeatureFlagTest extends TestBaseImpl
{ {
try (Cluster cluster = init(Cluster.build(1) try (Cluster cluster = init(Cluster.build(1)
.withoutVNodes() .withoutVNodes()
.withConfig(c -> c.with(Feature.NETWORK).set("accord_transactions_enabled", "false")) .withConfig(c -> c.with(Feature.NETWORK).set("accord.enabled", "false"))
.start())) .start()))
{ {
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (k int, c int, v int, primary key (k, c))"); cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (k int, c int, v int, primary key (k, c))");
@ -91,7 +90,7 @@ public class AccordFeatureFlagTest extends TestBaseImpl
try (Cluster cluster = Cluster.build(1) try (Cluster cluster = Cluster.build(1)
.withoutVNodes() .withoutVNodes()
.withConfig(c -> c.with(Feature.NETWORK) .withConfig(c -> c.with(Feature.NETWORK)
.set("accord_transactions_enabled", "false") .set("accord.enabled", "false")
.set("legacy_paxos_strategy", "accord")).createWithoutStarting()) .set("legacy_paxos_strategy", "accord")).createWithoutStarting())
{ {

View File

@ -72,11 +72,12 @@ public class DatabaseDescriptorRefTest
"org.apache.cassandra.auth.Cacheable", "org.apache.cassandra.auth.Cacheable",
"org.apache.cassandra.auth.IAuthenticator", "org.apache.cassandra.auth.IAuthenticator",
"org.apache.cassandra.auth.IAuthorizer", "org.apache.cassandra.auth.IAuthorizer",
"org.apache.cassandra.auth.IInternodeAuthenticator",
"org.apache.cassandra.auth.ICIDRAuthorizer", "org.apache.cassandra.auth.ICIDRAuthorizer",
"org.apache.cassandra.auth.ICIDRAuthorizer$CIDRAuthorizerMode", "org.apache.cassandra.auth.ICIDRAuthorizer$CIDRAuthorizerMode",
"org.apache.cassandra.auth.IInternodeAuthenticator",
"org.apache.cassandra.auth.INetworkAuthorizer", "org.apache.cassandra.auth.INetworkAuthorizer",
"org.apache.cassandra.auth.IRoleManager", "org.apache.cassandra.auth.IRoleManager",
"org.apache.cassandra.config.AccordSpec",
"org.apache.cassandra.config.CassandraRelevantProperties", "org.apache.cassandra.config.CassandraRelevantProperties",
"org.apache.cassandra.config.CassandraRelevantProperties$PropertyConverter", "org.apache.cassandra.config.CassandraRelevantProperties$PropertyConverter",
"org.apache.cassandra.config.Config", "org.apache.cassandra.config.Config",
@ -129,8 +130,8 @@ public class DatabaseDescriptorRefTest
"org.apache.cassandra.config.DurationSpec$IntMillisecondsBound", "org.apache.cassandra.config.DurationSpec$IntMillisecondsBound",
"org.apache.cassandra.config.DurationSpec$IntMinutesBound", "org.apache.cassandra.config.DurationSpec$IntMinutesBound",
"org.apache.cassandra.config.DurationSpec$IntSecondsBound", "org.apache.cassandra.config.DurationSpec$IntSecondsBound",
"org.apache.cassandra.config.DurationSpec$LongMillisecondsBound",
"org.apache.cassandra.config.DurationSpec$LongMicrosecondsBound", "org.apache.cassandra.config.DurationSpec$LongMicrosecondsBound",
"org.apache.cassandra.config.DurationSpec$LongMillisecondsBound",
"org.apache.cassandra.config.DurationSpec$LongNanosecondsBound", "org.apache.cassandra.config.DurationSpec$LongNanosecondsBound",
"org.apache.cassandra.config.DurationSpec$LongSecondsBound", "org.apache.cassandra.config.DurationSpec$LongSecondsBound",
"org.apache.cassandra.config.EncryptionOptions", "org.apache.cassandra.config.EncryptionOptions",
@ -151,24 +152,24 @@ public class DatabaseDescriptorRefTest
"org.apache.cassandra.config.ParameterizedClass", "org.apache.cassandra.config.ParameterizedClass",
"org.apache.cassandra.config.RepairConfig", "org.apache.cassandra.config.RepairConfig",
"org.apache.cassandra.config.RepairRetrySpec", "org.apache.cassandra.config.RepairRetrySpec",
"org.apache.cassandra.config.ReplicaFilteringProtectionOptions",
"org.apache.cassandra.config.RetrySpec", "org.apache.cassandra.config.RetrySpec",
"org.apache.cassandra.config.RetrySpec$MaxAttempt", "org.apache.cassandra.config.RetrySpec$MaxAttempt",
"org.apache.cassandra.config.RetrySpec$Type", "org.apache.cassandra.config.RetrySpec$Type",
"org.apache.cassandra.config.ReplicaFilteringProtectionOptions",
"org.apache.cassandra.config.StartupChecksOptions", "org.apache.cassandra.config.StartupChecksOptions",
"org.apache.cassandra.config.StartupChecksOptions",
"org.apache.cassandra.config.StorageAttachedIndexOptions",
"org.apache.cassandra.config.SubnetGroups",
"org.apache.cassandra.config.SubnetGroups", "org.apache.cassandra.config.SubnetGroups",
"org.apache.cassandra.config.TrackWarnings", "org.apache.cassandra.config.TrackWarnings",
"org.apache.cassandra.config.TrackWarnings",
"org.apache.cassandra.config.TransparentDataEncryptionOptions",
"org.apache.cassandra.config.TransparentDataEncryptionOptions", "org.apache.cassandra.config.TransparentDataEncryptionOptions",
"org.apache.cassandra.config.YamlConfigurationLoader", "org.apache.cassandra.config.YamlConfigurationLoader",
"org.apache.cassandra.config.YamlConfigurationLoader$CustomConstructor", "org.apache.cassandra.config.YamlConfigurationLoader$CustomConstructor",
"org.apache.cassandra.config.YamlConfigurationLoader$CustomConstructor",
"org.apache.cassandra.config.YamlConfigurationLoader$PropertiesChecker", "org.apache.cassandra.config.YamlConfigurationLoader$PropertiesChecker",
"org.apache.cassandra.config.YamlConfigurationLoader$PropertiesChecker$1", "org.apache.cassandra.config.YamlConfigurationLoader$PropertiesChecker$1",
"org.apache.cassandra.config.YamlConfigurationLoader$CustomConstructor",
"org.apache.cassandra.config.TransparentDataEncryptionOptions",
"org.apache.cassandra.config.StartupChecksOptions",
"org.apache.cassandra.config.SubnetGroups",
"org.apache.cassandra.config.TrackWarnings",
"org.apache.cassandra.config.StorageAttachedIndexOptions",
"org.apache.cassandra.db.ConsistencyLevel", "org.apache.cassandra.db.ConsistencyLevel",
"org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager", "org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager",
"org.apache.cassandra.db.commitlog.CommitLog", "org.apache.cassandra.db.commitlog.CommitLog",
@ -236,9 +237,9 @@ public class DatabaseDescriptorRefTest
"org.apache.cassandra.io.sstable.format.SSTableReaderLoadingBuilder", "org.apache.cassandra.io.sstable.format.SSTableReaderLoadingBuilder",
"org.apache.cassandra.io.sstable.format.SSTableReaderWithFilter", "org.apache.cassandra.io.sstable.format.SSTableReaderWithFilter",
"org.apache.cassandra.io.sstable.format.SSTableReaderWithFilter$Builder", "org.apache.cassandra.io.sstable.format.SSTableReaderWithFilter$Builder",
"org.apache.cassandra.io.sstable.format.SortedTableReaderLoadingBuilder",
"org.apache.cassandra.io.sstable.format.SSTableWriter", "org.apache.cassandra.io.sstable.format.SSTableWriter",
"org.apache.cassandra.io.sstable.format.SSTableWriter$Builder", "org.apache.cassandra.io.sstable.format.SSTableWriter$Builder",
"org.apache.cassandra.io.sstable.format.SortedTableReaderLoadingBuilder",
"org.apache.cassandra.io.sstable.format.SortedTableWriter", "org.apache.cassandra.io.sstable.format.SortedTableWriter",
"org.apache.cassandra.io.sstable.format.SortedTableWriter$Builder", "org.apache.cassandra.io.sstable.format.SortedTableWriter$Builder",
"org.apache.cassandra.io.sstable.format.Version", "org.apache.cassandra.io.sstable.format.Version",
@ -282,6 +283,7 @@ public class DatabaseDescriptorRefTest
"org.apache.cassandra.locator.SeedProvider", "org.apache.cassandra.locator.SeedProvider",
"org.apache.cassandra.locator.SimpleSeedProvider", "org.apache.cassandra.locator.SimpleSeedProvider",
"org.apache.cassandra.locator.SnitchAdapter", "org.apache.cassandra.locator.SnitchAdapter",
"org.apache.cassandra.security.AbstractCryptoProvider",
"org.apache.cassandra.security.EncryptionContext", "org.apache.cassandra.security.EncryptionContext",
"org.apache.cassandra.security.ISslContextFactory", "org.apache.cassandra.security.ISslContextFactory",
"org.apache.cassandra.security.SSLFactory", "org.apache.cassandra.security.SSLFactory",
@ -296,12 +298,12 @@ public class DatabaseDescriptorRefTest
"org.apache.cassandra.utils.LocalizeString", "org.apache.cassandra.utils.LocalizeString",
"org.apache.cassandra.utils.SystemInfo", "org.apache.cassandra.utils.SystemInfo",
"org.apache.cassandra.utils.Pair", "org.apache.cassandra.utils.Pair",
"org.apache.cassandra.utils.StorageCompatibilityMode",
"org.apache.cassandra.utils.binlog.BinLogOptions", "org.apache.cassandra.utils.binlog.BinLogOptions",
"org.apache.cassandra.utils.concurrent.RefCounted", "org.apache.cassandra.utils.concurrent.RefCounted",
"org.apache.cassandra.utils.concurrent.SelfRefCounted", "org.apache.cassandra.utils.concurrent.SelfRefCounted",
"org.apache.cassandra.utils.concurrent.Transactional", "org.apache.cassandra.utils.concurrent.Transactional",
"org.apache.cassandra.utils.concurrent.UncheckedInterruptedException", "org.apache.cassandra.utils.concurrent.UncheckedInterruptedException",
"org.apache.cassandra.utils.StorageCompatibilityMode"
}; };
static final Set<String> checkedClasses = new HashSet<>(Arrays.asList(validClasses)); static final Set<String> checkedClasses = new HashSet<>(Arrays.asList(validClasses));

View File

@ -436,11 +436,11 @@ public class YamlConfigurationLoaderTest
{ {
Config c = fromType(type, "available_processors", 4); Config c = fromType(type, "available_processors", 4);
assertThat(c.available_processors).isEqualTo(new OptionaldPositiveInt(4)); assertThat(c.available_processors).isEqualTo(new OptionaldPositiveInt(4));
assertThat(c.accord_shard_count).isEqualTo(OptionaldPositiveInt.UNDEFINED); assertThat(c.accord.shard_count).isEqualTo(OptionaldPositiveInt.UNDEFINED);
c = fromType(type, "available_processors", 3, "accord_shard_count", 1); c = fromType(type, "available_processors", 3, "accord.shard_count", 1);
assertThat(c.available_processors).isEqualTo(new OptionaldPositiveInt(3)); assertThat(c.available_processors).isEqualTo(new OptionaldPositiveInt(3));
assertThat(c.accord_shard_count).isEqualTo(new OptionaldPositiveInt(1)); assertThat(c.accord.shard_count).isEqualTo(new OptionaldPositiveInt(1));
} }
} }