Skip to content
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

CNDB-12406: Make CachedReplicaRows thresholds flexible to be set via … #1551

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,23 @@ public enum CassandraRelevantProperties
*/
SENSORS_VIA_NATIVE_PROTOCOL("cassandra.sensors_via_native_protocol", "false"),

/**
* Set the number of rows from all replicas individual index and filtering queries that can materialize on-heap before warning
*/
CACHED_REPLICA_ROWS_WARN_THRESHOLD("cassandra.cached_replica_rows_warn_threshold"),

/**
* Set the number of rows from all replicas individual index and filtering queries that can materialize on-heap before failing
*/
CACHED_REPLICA_ROWS_FAIL_THRESHOLD("cassandra.cached_replica_rows_fail_threshold"),

/**
* The current messaging version. This is used when we add new messaging versions without adopting them immediately,
* or to force the node to use a specific version for testing purposes.
*/
DS_CURRENT_MESSAGING_VERSION("ds.current_messaging_version", Integer.toString(MessagingService.VERSION_DS_10));


CassandraRelevantProperties(String key, String defaultVal)
{
this.key = key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
import org.apache.cassandra.utils.NoSpamLogger;
import org.apache.cassandra.utils.btree.BTreeSet;

import static org.apache.cassandra.config.CassandraRelevantProperties.CACHED_REPLICA_ROWS_FAIL_THRESHOLD;
import static org.apache.cassandra.config.CassandraRelevantProperties.CACHED_REPLICA_ROWS_WARN_THRESHOLD;

/**
* Helper in charge of collecting additional queries to be done on the coordinator to protect against invalid results
* being included due to replica-side filtering (secondary indexes or {@code ALLOW * FILTERING}).
Expand Down Expand Up @@ -137,8 +140,15 @@ public class ReplicaFilteringProtection<E extends Endpoints<E>>

tableMetrics = ColumnFamilyStore.metricsFor(command.metadata().id);

this.cachedRowsWarnThreshold = cachedRowsWarnThreshold;
this.cachedRowsFailThreshold = cachedRowsFailThreshold;
if (System.getProperty(CACHED_REPLICA_ROWS_WARN_THRESHOLD.getKey()) != null)
this.cachedRowsWarnThreshold = Integer.getInteger(CACHED_REPLICA_ROWS_WARN_THRESHOLD.getKey());
else
this.cachedRowsWarnThreshold = cachedRowsWarnThreshold;

if (System.getProperty(CACHED_REPLICA_ROWS_FAIL_THRESHOLD.getKey()) != null)
this.cachedRowsFailThreshold = Integer.getInteger(CACHED_REPLICA_ROWS_FAIL_THRESHOLD.getKey());
else
this.cachedRowsFailThreshold = cachedRowsFailThreshold;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be something like:

this.cachedRowsWarnThreshold = CACHED_REPLICA_ROWS_WARN_THRESHOLD.getInt(cachedRowsWarnThreshold);
this.cachedRowsFailThreshold = CACHED_REPLICA_ROWS_FAIL_THRESHOLD.getInt(cachedRowsFailThreshold);

This will make it easier to port to main-5.0 where checkstyle will complain about using System.getProperty... :)

}

private UnfilteredPartitionIterator executeReadCommand(ReadCommand cmd, Replica source, ReplicaPlan.Shared<EndpointsForToken, ReplicaPlan.ForTokenRead> replicaPlan)
Expand Down
Loading