From eaf9bf18b2ec50713170a9ca472c34586b17a5a3 Mon Sep 17 00:00:00 2001 From: Aleksey Yeshchenko Date: Mon, 16 Apr 2018 20:56:18 +0100 Subject: [PATCH] Deprecate background repair and probablistic read_repair_chance table options patch by Aleksey Yeschenko; reviewed by Blake Eggleston for CASSANDRA-13910 --- CHANGES.txt | 2 ++ NEWS.txt | 6 ++++ .../cql3/statements/TableAttributes.java | 36 +++++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1aa291fd89..847f347f6e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,6 @@ 3.0.17 + * Deprecate background repair and probablistic read_repair_chance table options + (CASSANDRA-13910) * Fix unbounded validation compactions on repair / revert CASSANDRA-13797 (CASSANDRA-14332) * Avoid deadlock when running nodetool refresh before node is fully up (CASSANDRA-14310) * Handle all exceptions when opening sstables (CASSANDRA-14202) diff --git a/NEWS.txt b/NEWS.txt index c06030e98a..234154e582 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -53,6 +53,12 @@ Upgrading - Changes to bloom_filter_fp_chance will no longer take effect on existing sstables when the node is restarted. Only compactions/upgradesstables regenerates bloom filters and Summaries sstable components. See CASSANDRA-11163 +Deprecation +----------- + - Background read repair has been deprecated. dclocal_read_repair_chance and + read_repair_chance table options have been deprecated, and will be removed entirely in 4.0. + See CASSANDRA-13910 for details. + 3.0.16 ===== diff --git a/src/java/org/apache/cassandra/cql3/statements/TableAttributes.java b/src/java/org/apache/cassandra/cql3/statements/TableAttributes.java index c1a9d542e2..595fdb3f40 100644 --- a/src/java/org/apache/cassandra/cql3/statements/TableAttributes.java +++ b/src/java/org/apache/cassandra/cql3/statements/TableAttributes.java @@ -27,6 +27,7 @@ import org.apache.cassandra.exceptions.ConfigurationException; import org.apache.cassandra.exceptions.SyntaxException; import org.apache.cassandra.schema.*; import org.apache.cassandra.schema.TableParams.Option; +import org.apache.cassandra.service.ClientWarn; import static java.lang.String.format; @@ -36,6 +37,8 @@ public final class TableAttributes extends PropertyDefinitions private static final Set validKeywords; private static final Set obsoleteKeywords; + private static boolean loggedReadRepairChanceDeprecationWarnings; + static { ImmutableSet.Builder validBuilder = ImmutableSet.builder(); @@ -105,7 +108,17 @@ public final class TableAttributes extends PropertyDefinitions } if (hasOption(Option.DCLOCAL_READ_REPAIR_CHANCE)) - builder.dcLocalReadRepairChance(getDouble(Option.DCLOCAL_READ_REPAIR_CHANCE)); + { + double chance = getDouble(Option.DCLOCAL_READ_REPAIR_CHANCE); + + if (chance != 0.0) + { + ClientWarn.instance.warn("dclocal_read_repair_chance table option has been deprecated and will be removed in version 4.0"); + maybeLogReadRepairChanceDeprecationWarning(); + } + + builder.dcLocalReadRepairChance(chance); + } if (hasOption(Option.DEFAULT_TIME_TO_LIVE)) builder.defaultTimeToLive(getInt(Option.DEFAULT_TIME_TO_LIVE)); @@ -123,7 +136,17 @@ public final class TableAttributes extends PropertyDefinitions builder.minIndexInterval(getInt(Option.MIN_INDEX_INTERVAL)); if (hasOption(Option.READ_REPAIR_CHANCE)) - builder.readRepairChance(getDouble(Option.READ_REPAIR_CHANCE)); + { + double chance = getDouble(Option.READ_REPAIR_CHANCE); + + if (chance != 0.0) + { + ClientWarn.instance.warn("read_repair_chance table option has been deprecated and will be removed in version 4.0"); + maybeLogReadRepairChanceDeprecationWarning(); + } + + builder.readRepairChance(chance); + } if (hasOption(Option.SPECULATIVE_RETRY)) builder.speculativeRetry(SpeculativeRetryParam.fromString(getString(Option.SPECULATIVE_RETRY))); @@ -134,6 +157,15 @@ public final class TableAttributes extends PropertyDefinitions return builder.build(); } + private void maybeLogReadRepairChanceDeprecationWarning() + { + if (!loggedReadRepairChanceDeprecationWarnings) + { + logger.warn("dclocal_read_repair_chance and read_repair_chance table options have been deprecated and will be removed in version 4.0"); + loggedReadRepairChanceDeprecationWarnings = true; + } + } + private Double getDeprecatedCrcCheckChance(Map compressionOpts) { String value = compressionOpts.get(Option.CRC_CHECK_CHANCE.toString().toLowerCase());