Merge branch 'cassandra-4.0' into cassandra-4.1

This commit is contained in:
Ekaterina Dimitrova 2022-07-22 09:27:53 -04:00
commit 9beeaf87bd
10 changed files with 42 additions and 11 deletions

View File

@ -1,4 +1,6 @@
4.1-alpha2
* index_summary_resize_interval_in_minutes = -1 is equivalent to index_summary_resize_interval being set to null or
disabled. JMX MBean IndexSummaryManager, setResizeIntervalInMinutes method still takes resizeIntervalInMinutes = -1 for disabled (CASSANDRA-17735)
* min_tracked_partition_size_bytes parameter from 4.1 alpha1 was renamed to min_tracked_partition_size (CASSANDRA-17733)
* Remove commons-lang dependency during build runtime (CASSANDRA-17724)
* Relax synchronization on StreamSession#onError() to avoid deadlock (CASSANDRA-17706)

View File

@ -165,6 +165,8 @@ New features
Upgrading
---------
- `index_summary_resize_interval_in_minutes = -1` is equivalent to index_summary_resize_interval being set to `null` or
disabled. JMX MBean `IndexSummaryManager`, `setResizeIntervalInMinutes` method still takes `resizeIntervalInMinutes = -1` for disabled.
- min_tracked_partition_size_bytes parameter from 4.1 alpha1 was renamed to min_tracked_partition_size.
- Parameters of type data storage, duration and data rate cannot be set to Long.MAX_VALUE (former parameters of long type)
and Integer.MAX_VALUE (former parameters of int type). Those numbers are used during conversion between units to prevent

View File

@ -723,7 +723,7 @@ memtable_allocation_type: heap_buffers
# How frequently index summaries should be resampled. This is done
# periodically to redistribute memory from the fixed-size pool to sstables
# proportional their recent read rates. Setting to -1 will disable this
# proportional their recent read rates. Setting to null value will disable this
# process, leaving existing index summaries at their current sampling level.
# Min unit: m
index_summary_resize_interval: 60m

View File

@ -501,7 +501,7 @@ public class Config
@Replaces(oldName = "index_summary_capacity_in_mb", converter = Converters.MEBIBYTES_DATA_STORAGE_LONG, deprecated = true)
public volatile DataStorageSpec.LongMebibytesBound index_summary_capacity;
@Replaces(oldName = "index_summary_resize_interval_in_minutes", converter = Converters.MINUTES_DURATION, deprecated = true)
@Replaces(oldName = "index_summary_resize_interval_in_minutes", converter = Converters.MINUTES_CUSTOM_DURATION, deprecated = true)
public volatile DurationSpec.IntMinutesBound index_summary_resize_interval = new DurationSpec.IntMinutesBound("60m");
@Replaces(oldName = "gc_log_threshold_in_ms", converter = Converters.MILLIS_DURATION_INT, deprecated = true)

View File

@ -70,9 +70,13 @@ public enum Converters
SECONDS_CUSTOM_DURATION(String.class, DurationSpec.IntSecondsBound.class,
DurationSpec.IntSecondsBound::inSecondsString,
o -> Long.toString(o.toSeconds())),
MINUTES_DURATION(Integer.class, DurationSpec.IntMinutesBound.class,
DurationSpec.IntMinutesBound::new,
DurationSpec.IntMinutesBound::toMinutes),
/**
* This converter is used to support backward compatibility for parameters where in the past -1 was used as a value
* Example: index_summary_resize_interval_in_minutes = -1 and index_summary_resize_interval = null are equal.
*/
MINUTES_CUSTOM_DURATION(Integer.class, DurationSpec.IntMinutesBound.class,
o -> o == -1 ? null : new DurationSpec.IntMinutesBound(o),
o -> o == null ? -1 : o.toMinutes()),
MEBIBYTES_DATA_STORAGE_LONG(Long.class, DataStorageSpec.LongMebibytesBound.class,
DataStorageSpec.LongMebibytesBound::new,
DataStorageSpec.LongMebibytesBound::toMebibytes),

View File

@ -793,6 +793,9 @@ public class DatabaseDescriptor
throw new ConfigurationException("index_summary_capacity option was set incorrectly to '"
+ conf.index_summary_capacity.toString() + "', it should be a non-negative integer.", false);
// we need this assignment for the Settings virtual table - CASSANDRA-17735
conf.index_summary_capacity = new DataStorageSpec.LongMebibytesBound(indexSummaryCapacityInMiB);
if (conf.user_defined_functions_fail_timeout.toMilliseconds() < conf.user_defined_functions_warn_timeout.toMilliseconds())
throw new ConfigurationException("user_defined_functions_warn_timeout must less than user_defined_function_fail_timeout", false);
@ -3309,9 +3312,20 @@ public class DatabaseDescriptor
public static int getIndexSummaryResizeIntervalInMinutes()
{
if (conf.index_summary_resize_interval == null)
return -1;
return conf.index_summary_resize_interval.toMinutes();
}
public static void setIndexSummaryResizeIntervalInMinutes(int value)
{
if (value == -1)
conf.index_summary_resize_interval = null;
else
conf.index_summary_resize_interval = new DurationSpec.IntMinutesBound(value);
}
public static boolean hasLargeAddressSpace()
{
// currently we just check if it's a 64bit arch, but any we only really care if the address space is large

View File

@ -64,7 +64,6 @@ public class IndexSummaryManager implements IndexSummaryManagerMBean
public static final String MBEAN_NAME = "org.apache.cassandra.db:type=IndexSummaries";
public static final IndexSummaryManager instance;
private int resizeIntervalInMinutes = 0;
private long memoryPoolBytes;
private final ScheduledExecutorPlus executor;
@ -93,13 +92,13 @@ public class IndexSummaryManager implements IndexSummaryManagerMBean
public int getResizeIntervalInMinutes()
{
return resizeIntervalInMinutes;
return DatabaseDescriptor.getIndexSummaryResizeIntervalInMinutes();
}
public void setResizeIntervalInMinutes(int resizeIntervalInMinutes)
{
int oldInterval = this.resizeIntervalInMinutes;
this.resizeIntervalInMinutes = resizeIntervalInMinutes;
int oldInterval = getResizeIntervalInMinutes();
DatabaseDescriptor.setIndexSummaryResizeIntervalInMinutes(resizeIntervalInMinutes);
long initialDelay;
if (future != null)
@ -114,7 +113,7 @@ public class IndexSummaryManager implements IndexSummaryManagerMBean
initialDelay = resizeIntervalInMinutes;
}
if (this.resizeIntervalInMinutes < 0)
if (resizeIntervalInMinutes < 0)
{
future = null;
return;

View File

@ -41,5 +41,10 @@ public interface IndexSummaryManagerMBean
public void redistributeSummaries() throws IOException;
public int getResizeIntervalInMinutes();
/**
* Set resizeIntervalInMinutes = -1 for disabled; This is the equivalent of index_summary_resize_interval being
* set to null in cassandra.yaml
*/
public void setResizeIntervalInMinutes(int resizeIntervalInMinutes);
}

View File

@ -264,8 +264,9 @@ public class YamlConfigurationLoaderTest
// SECONDS_CUSTOM_DURATION already tested in type change
// MINUTES_DURATION
// MINUTES_CUSTOM_DURATION
assertThat(from("index_summary_resize_interval_in_minutes", "42").index_summary_resize_interval.toMinutes()).isEqualTo(42);
assertThat(from("index_summary_resize_interval_in_minutes", "-1").index_summary_resize_interval).isNull();
assertThatThrownBy(() -> from("index_summary_resize_interval_in_minutes", -2).index_summary_resize_interval.toMinutes())
.hasRootCauseInstanceOf(IllegalArgumentException.class)
.hasRootCauseMessage("Invalid duration: value must be non-negative");

View File

@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
import org.apache.cassandra.concurrent.NamedThreadFactory;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.RowUpdateBuilder;
@ -545,13 +546,16 @@ public class IndexSummaryManagerTest
// resize interval
manager.setResizeIntervalInMinutes(-1);
assertEquals(-1, DatabaseDescriptor.getIndexSummaryResizeIntervalInMinutes());
assertNull(manager.getTimeToNextResize(TimeUnit.MINUTES));
manager.setResizeIntervalInMinutes(10);
assertEquals(10, manager.getResizeIntervalInMinutes());
assertEquals(10, DatabaseDescriptor.getIndexSummaryResizeIntervalInMinutes());
assertEquals(10, manager.getTimeToNextResize(TimeUnit.MINUTES), 1);
manager.setResizeIntervalInMinutes(15);
assertEquals(15, manager.getResizeIntervalInMinutes());
assertEquals(15, DatabaseDescriptor.getIndexSummaryResizeIntervalInMinutes());
assertEquals(15, manager.getTimeToNextResize(TimeUnit.MINUTES), 2);
// memory pool capacity