use of org.apache.cassandra.config.ParameterizedClass in project cassandra by apache.
the class CommitLogTest method testRecovery.
protected void testRecovery(final byte[] logData, Class<?> expected) throws Exception {
ParameterizedClass commitLogCompression = DatabaseDescriptor.getCommitLogCompression();
EncryptionContext encryptionContext = DatabaseDescriptor.getEncryptionContext();
runExpecting(() -> testRecovery(logData, CommitLogDescriptor.current_version), expected);
}
use of org.apache.cassandra.config.ParameterizedClass in project cassandra by apache.
the class BinAuditLoggerTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
tempDir = BinLogTest.tempDir();
AuditLogOptions options = new AuditLogOptions();
options.enabled = true;
options.logger = new ParameterizedClass("BinAuditLogger", null);
options.roll_cycle = "TEST_SECONDLY";
options.audit_logs_dir = tempDir.toString();
DatabaseDescriptor.setAuditLoggingOptions(options);
AuditLogManager.instance.enable(DatabaseDescriptor.getAuditLoggingOptions());
requireNetwork();
}
use of org.apache.cassandra.config.ParameterizedClass in project cassandra by apache.
the class CommitlogShutdownTest method testShutdownWithPendingTasks.
@Test
@BMRule(name = "Make removing commitlog segments slow", targetClass = "CommitLogSegment", targetMethod = "discard", action = "Thread.sleep(50)")
public void testShutdownWithPendingTasks() throws Exception {
new Random().nextBytes(entropy);
DatabaseDescriptor.daemonInitialization();
DatabaseDescriptor.setCommitLogCompression(new ParameterizedClass("LZ4Compressor", ImmutableMap.of()));
DatabaseDescriptor.setCommitLogSegmentSize(1);
DatabaseDescriptor.setCommitLogSync(Config.CommitLogSync.periodic);
DatabaseDescriptor.setCommitLogSyncPeriod(10 * 1000);
SchemaLoader.prepareServer();
SchemaLoader.createKeyspace(KEYSPACE1, KeyspaceParams.simple(1), SchemaLoader.standardCFMD(KEYSPACE1, STANDARD1, 0, AsciiType.instance, BytesType.instance));
CompactionManager.instance.disableAutoCompaction();
ColumnFamilyStore cfs1 = Keyspace.open(KEYSPACE1).getColumnFamilyStore(STANDARD1);
final Mutation m = new RowUpdateBuilder(cfs1.metadata.get(), 0, "k").clustering("bytes").add("val", ByteBuffer.wrap(entropy)).build();
// force creating several commitlog files
for (int i = 0; i < 10; i++) {
CommitLog.instance.add(m);
}
// schedule discarding completed segments and immediately issue a shutdown
TableId tableId = m.getTableIds().iterator().next();
CommitLog.instance.discardCompletedSegments(tableId, CommitLogPosition.NONE, CommitLog.instance.getCurrentPosition());
CommitLog.instance.shutdownBlocking();
// the shutdown should block until all logs except the currently active one and perhaps a new, empty one are gone
Assert.assertTrue(new File(DatabaseDescriptor.getCommitLogLocation()).tryList().length <= 2);
}
use of org.apache.cassandra.config.ParameterizedClass in project cassandra by apache.
the class CommitLogDescriptorTest method setup.
@Before
public void setup() {
Map<String, String> params = new HashMap<>();
compression = new ParameterizedClass(LZ4Compressor.class.getName(), params);
enabledTdeOptions = EncryptionContextGenerator.createEncryptionOptions();
enabledEncryption = new EncryptionContext(enabledTdeOptions, iv, false);
neverEnabledEncryption = EncryptionContextGenerator.createDisabledContext();
TransparentDataEncryptionOptions disaabledTdeOptions = new TransparentDataEncryptionOptions(false, enabledTdeOptions.cipher, enabledTdeOptions.key_alias, enabledTdeOptions.key_provider);
previouslyEnabledEncryption = new EncryptionContext(disaabledTdeOptions);
}
use of org.apache.cassandra.config.ParameterizedClass in project cassandra by apache.
the class HintsService method createDescriptorParams.
private static ImmutableMap<String, Object> createDescriptorParams() {
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
ParameterizedClass compressionConfig = DatabaseDescriptor.getHintsCompression();
if (compressionConfig != null) {
ImmutableMap.Builder<String, Object> compressorParams = ImmutableMap.builder();
compressorParams.put(ParameterizedClass.CLASS_NAME, compressionConfig.class_name);
if (compressionConfig.parameters != null) {
compressorParams.put(ParameterizedClass.PARAMETERS, compressionConfig.parameters);
}
builder.put(HintsDescriptor.COMPRESSION, compressorParams.build());
}
return builder.build();
}
Aggregations