Repository: cassandra Updated Branches: refs/heads/cassandra-3.11 41befde22 -> 8ea0afa3d refs/heads/trunk 380a614f1 -> 3bd152e6c
cdc column addition strikes again patch by Sylvain Lebresne; reviewed by Aleksey Yeschenko for CASSANDRA-13382 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8ea0afa3 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8ea0afa3 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8ea0afa3 Branch: refs/heads/cassandra-3.11 Commit: 8ea0afa3dbced228dbe9332bae6b5b2a1760bd8a Parents: 41befde Author: Sylvain Lebresne <[email protected]> Authored: Mon Mar 27 11:27:28 2017 +0200 Committer: Sylvain Lebresne <[email protected]> Committed: Tue Mar 28 14:35:00 2017 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/schema/SchemaKeyspace.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ea0afa3/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 2122227..c7cc26e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.11.0 + * cdc column addition strikes again (CASSANDRA-13382) * Fix static column indexes (CASSANDRA-13277) * DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298) * unittest CipherFactoryTest failed on MacOS (CASSANDRA-13370) http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ea0afa3/src/java/org/apache/cassandra/schema/SchemaKeyspace.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java index 58580b9..ff7cf04 100644 --- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java +++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.MapDifference; import com.google.common.collect.Maps; import org.slf4j.Logger; @@ -84,6 +85,12 @@ public final class SchemaKeyspace public static final List<String> ALL = ImmutableList.of(KEYSPACES, TABLES, COLUMNS, DROPPED_COLUMNS, TRIGGERS, VIEWS, TYPES, FUNCTIONS, AGGREGATES, INDEXES); + /** + * The tables to which we added the cdc column. This is used in {@link #makeUpdateForSchema} below to make sure we skip that + * column is cdc is disabled as the columns breaks pre-cdc to post-cdc upgrades (typically, 3.0 -> 3.X). + */ + private static final Set<String> TABLES_WITH_CDC_ADDED = ImmutableSet.of(TABLES, VIEWS); + private static final CFMetaData Keyspaces = compile(KEYSPACES, "keyspace definitions", @@ -385,9 +392,9 @@ public final class SchemaKeyspace private static PartitionUpdate makeUpdateForSchema(UnfilteredRowIterator partition, ColumnFilter filter) { // This method is used during schema migration tasks, and if cdc is disabled, we want to force excluding the - // 'cdc' column from the TABLES schema table because it is problematic if received by older nodes (see #12236 + // 'cdc' column from the TABLES/VIEWS schema table because it is problematic if received by older nodes (see #12236 // and #12697). Otherwise though, we just simply "buffer" the content of the partition into a PartitionUpdate. - if (DatabaseDescriptor.isCDCEnabled() || !partition.metadata().cfName.equals(TABLES)) + if (DatabaseDescriptor.isCDCEnabled() || !TABLES_WITH_CDC_ADDED.contains(partition.metadata().cfName)) return PartitionUpdate.fromIterator(partition, filter); // We want to skip the 'cdc' column. A simple solution for that is based on the fact that
