Make PeriodicCommitLogService.blockWhenSyncLagsNanos configurable

patch by jasobrown; reviewed by Jordan West for CASSANDRA-14580
This commit is contained in:
Jason Brown 2018-07-20 16:05:18 -07:00
parent 9abeff38c4
commit 176d4bac22
5 changed files with 17 additions and 1 deletions

View File

@ -1,4 +1,5 @@
4.0 4.0
* Make PeriodicCommitLogService.blockWhenSyncLagsNanos configurable (CASSANDRA-14580)
* Improve logging in MessageInHandler's constructor (CASSANDRA-14576) * Improve logging in MessageInHandler's constructor (CASSANDRA-14576)
* Set broadcast address in internode messaging handshake (CASSANDRA-14579) * Set broadcast address in internode messaging handshake (CASSANDRA-14579)
* Wait for schema agreement prior to building MVs (CASSANDRA-14571) * Wait for schema agreement prior to building MVs (CASSANDRA-14571)

View File

@ -389,6 +389,10 @@ counter_cache_save_period: 7200
commitlog_sync: periodic commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000 commitlog_sync_period_in_ms: 10000
# When in periodic commitlog mode, the number of milliseconds to block writes
# while waiting for a slow disk flush to complete.
# periodic_commitlog_sync_lag_block_in_ms:
# The size of the individual commitlog file segments. A commitlog # The size of the individual commitlog file segments. A commitlog
# segment may be archived, deleted, or recycled once all the data # segment may be archived, deleted, or recycled once all the data
# in it (potentially from each columnfamily in the system) has been # in it (potentially from each columnfamily in the system) has been

View File

@ -204,6 +204,7 @@ public class Config
public int commitlog_segment_size_in_mb = 32; public int commitlog_segment_size_in_mb = 32;
public ParameterizedClass commitlog_compression; public ParameterizedClass commitlog_compression;
public int commitlog_max_compression_buffers_in_pool = 3; public int commitlog_max_compression_buffers_in_pool = 3;
public Integer periodic_commitlog_sync_lag_block_in_ms;
public TransparentDataEncryptionOptions transparent_data_encryption_options = new TransparentDataEncryptionOptions(); public TransparentDataEncryptionOptions transparent_data_encryption_options = new TransparentDataEncryptionOptions();
public Integer max_mutation_size_in_kb; public Integer max_mutation_size_in_kb;

View File

@ -1866,6 +1866,14 @@ public class DatabaseDescriptor
return conf.commitlog_sync_period_in_ms; return conf.commitlog_sync_period_in_ms;
} }
public static long getPeriodicCommitLogSyncBlock()
{
Integer blockMillis = conf.periodic_commitlog_sync_lag_block_in_ms;
return blockMillis == null
? (long)(getCommitLogSyncPeriod() * 1.5)
: blockMillis;
}
public static void setCommitLogSyncPeriod(int periodMillis) public static void setCommitLogSyncPeriod(int periodMillis)
{ {
conf.commitlog_sync_period_in_ms = periodMillis; conf.commitlog_sync_period_in_ms = periodMillis;

View File

@ -17,11 +17,13 @@
*/ */
package org.apache.cassandra.db.commitlog; package org.apache.cassandra.db.commitlog;
import java.util.concurrent.TimeUnit;
import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.config.DatabaseDescriptor;
class PeriodicCommitLogService extends AbstractCommitLogService class PeriodicCommitLogService extends AbstractCommitLogService
{ {
private static final long blockWhenSyncLagsNanos = (long) (DatabaseDescriptor.getCommitLogSyncPeriod() * 1.5e6); private static final long blockWhenSyncLagsNanos = TimeUnit.MILLISECONDS.toNanos(DatabaseDescriptor.getPeriodicCommitLogSyncBlock());
public PeriodicCommitLogService(final CommitLog commitLog) public PeriodicCommitLogService(final CommitLog commitLog)
{ {