You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2017/08/03 13:29:13 UTC
[1/6] cassandra git commit: Drop table should remove corresponding
entries in dropped_columns table
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.0 d74ed4b78 -> d9eabd3d0
refs/heads/cassandra-3.11 61a47afc0 -> 2fd33ba9d
refs/heads/trunk 457733bd5 -> 32de990b7
Drop table should remove corresponding entries in dropped_columns table
patch by Zhao Yang; reviewed by Aleksey Yeschenko for CASSANDRA-13730
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d9eabd3d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d9eabd3d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d9eabd3d
Branch: refs/heads/cassandra-3.0
Commit: d9eabd3d0cbf1287aa7d01bc23dd8e39c3acf232
Parents: d74ed4b
Author: Zhao Yang <zh...@gmail.com>
Authored: Sun Jul 30 12:24:46 2017 +0800
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Thu Aug 3 12:32:13 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/schema/SchemaKeyspace.java | 9 +++++++++
.../cassandra/cql3/validation/operations/DropTest.java | 13 +++++++++++++
3 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7e518ed..799e7f4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.15
+ * Drop table should remove corresponding entries in dropped_columns table (CASSANDRA-13730)
* Log warn message until legacy auth tables have been migrated (CASSANDRA-13371)
* Fix incorrect [2.1 <- 3.0] serialization of counter cells created in 2.0 (CASSANDRA-13691)
* Fix invalid writetime for null cells (CASSANDRA-13711)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/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 63017ec..06450f1 100644
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.config.*;
+import org.apache.cassandra.config.CFMetaData.DroppedColumn;
import org.apache.cassandra.config.ColumnDefinition.ClusteringOrder;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.functions.*;
@@ -626,6 +627,9 @@ public final class SchemaKeyspace
for (ColumnDefinition column : table.allColumns())
dropColumnFromSchemaMutation(table, column, timestamp, mutation);
+ for (CFMetaData.DroppedColumn column : table.getDroppedColumns().values())
+ dropDroppedColumnFromSchemaMutation(table, column, timestamp, mutation);
+
for (TriggerMetadata trigger : table.getTriggers())
dropTriggerFromSchemaMutation(table, trigger, timestamp, mutation);
@@ -657,6 +661,11 @@ public final class SchemaKeyspace
RowUpdateBuilder.deleteRow(Columns, timestamp, mutation, table.cfName, column.name.toString());
}
+ private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation mutation)
+ {
+ RowUpdateBuilder.deleteRow(DroppedColumns, timestamp, mutation, table.cfName, column.name);
+ }
+
private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, long timestamp, Mutation mutation)
{
RowUpdateBuilder adder = new RowUpdateBuilder(DroppedColumns, timestamp, mutation).clustering(table.cfName, column.name);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
index e5c7089..692eb45 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
@@ -34,4 +34,17 @@ public class DropTest extends CQLTester
execute("DROP TABLE IF EXISTS keyspace_does_not_exist.table_does_not_exist");
}
+ @Test
+ public void testDropTableWithDroppedColumns() throws Throwable
+ {
+ // CASSANDRA-13730: entry should be removed from dropped_columns table when table is dropped
+ String cf = createTable("CREATE TABLE %s (k1 int, c1 int , v1 int, v2 int, PRIMARY KEY (k1, c1))");
+
+ execute("ALTER TABLE %s DROP v2");
+ execute("DROP TABLE %s");
+
+ assertRowsIgnoringOrder(execute("select * from system_schema.dropped_columns where keyspace_name = '"
+ + keyspace()
+ + "' and table_name = '" + cf + "'"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[5/6] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.11
Posted by al...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2fd33ba9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2fd33ba9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2fd33ba9
Branch: refs/heads/cassandra-3.11
Commit: 2fd33ba9d70684b6b2da22d045df49bfe70451fa
Parents: 61a47af d9eabd3
Author: Aleksey Yeschenko <al...@yeschenko.com>
Authored: Thu Aug 3 14:15:36 2017 +0100
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Thu Aug 3 14:15:36 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/schema/SchemaKeyspace.java | 9 +++++++++
.../cassandra/cql3/validation/operations/DropTest.java | 13 +++++++++++++
3 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd33ba9/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 3b0524b,799e7f4..45ed523
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,9 -1,5 +1,10 @@@
-3.0.15
+3.11.1
+ * "ignore" option is ignored in sstableloader (CASSANDRA-13721)
+ * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652)
+ * Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512)
+ * Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
+Merged from 3.0:
+ * Drop table should remove corresponding entries in dropped_columns table (CASSANDRA-13730)
* Log warn message until legacy auth tables have been migrated (CASSANDRA-13371)
* Fix incorrect [2.1 <- 3.0] serialization of counter cells created in 2.0 (CASSANDRA-13691)
* Fix invalid writetime for null cells (CASSANDRA-13711)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd33ba9/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index 03c393f,06450f1..1f8d2fc
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@@ -646,86 -617,99 +647,94 @@@ public final class SchemaKeyspac
return Maps.difference(beforeMap, afterMap);
}
- public static Mutation makeDropTableMutation(KeyspaceMetadata keyspace, CFMetaData table, long timestamp)
+ public static Mutation.SimpleBuilder makeDropTableMutation(KeyspaceMetadata keyspace, CFMetaData table, long timestamp)
{
// Include the serialized keyspace in case the target node missed a CREATE KEYSPACE migration (see CASSANDRA-5631).
- Mutation mutation = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
+ Mutation.SimpleBuilder builder = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
- RowUpdateBuilder.deleteRow(Tables, timestamp, mutation, table.cfName);
+ builder.update(Tables).row(table.cfName).delete();
for (ColumnDefinition column : table.allColumns())
- dropColumnFromSchemaMutation(table, column, timestamp, mutation);
+ dropColumnFromSchemaMutation(table, column, builder);
+ for (CFMetaData.DroppedColumn column : table.getDroppedColumns().values())
- dropDroppedColumnFromSchemaMutation(table, column, timestamp, mutation);
++ dropDroppedColumnFromSchemaMutation(table, column, timestamp, builder);
+
for (TriggerMetadata trigger : table.getTriggers())
- dropTriggerFromSchemaMutation(table, trigger, timestamp, mutation);
+ dropTriggerFromSchemaMutation(table, trigger, builder);
for (IndexMetadata index : table.getIndexes())
- dropIndexFromSchemaMutation(table, index, timestamp, mutation);
+ dropIndexFromSchemaMutation(table, index, builder);
- return mutation;
+ return builder;
}
- private static void addColumnToSchemaMutation(CFMetaData table, ColumnDefinition column, long timestamp, Mutation mutation)
+ private static void addColumnToSchemaMutation(CFMetaData table, ColumnDefinition column, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder adder = new RowUpdateBuilder(Columns, timestamp, mutation).clustering(table.cfName, column.name.toString());
-
AbstractType<?> type = column.type;
if (type instanceof ReversedType)
type = ((ReversedType) type).baseType;
- adder.add("column_name_bytes", column.name.bytes)
- .add("kind", column.kind.toString().toLowerCase())
- .add("position", column.position())
- .add("clustering_order", column.clusteringOrder().toString().toLowerCase())
- .add("type", type.asCQL3Type().toString())
- .build();
+ builder.update(Columns)
+ .row(table.cfName, column.name.toString())
+ .add("column_name_bytes", column.name.bytes)
+ .add("kind", column.kind.toString().toLowerCase())
+ .add("position", column.position())
+ .add("clustering_order", column.clusteringOrder().toString().toLowerCase())
+ .add("type", type.asCQL3Type().toString());
}
- private static void dropColumnFromSchemaMutation(CFMetaData table, ColumnDefinition column, long timestamp, Mutation mutation)
+ private static void dropColumnFromSchemaMutation(CFMetaData table, ColumnDefinition column, Mutation.SimpleBuilder builder)
{
// Note: we do want to use name.toString(), not name.bytes directly for backward compatibility (For CQL3, this won't make a difference).
- RowUpdateBuilder.deleteRow(Columns, timestamp, mutation, table.cfName, column.name.toString());
+ builder.update(Columns).row(table.cfName, column.name.toString()).delete();
}
- private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation mutation)
+ private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder.deleteRow(DroppedColumns, timestamp, mutation, table.cfName, column.name);
+ builder.update(DroppedColumns)
+ .row(table.cfName, column.name)
+ .add("dropped_time", new Date(TimeUnit.MICROSECONDS.toMillis(column.droppedTime)))
+ .add("type", expandUserTypes(column.type).asCQL3Type().toString());
}
- private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, long timestamp, Mutation mutation)
++ private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation.SimpleBuilder builder)
+ {
- RowUpdateBuilder adder = new RowUpdateBuilder(DroppedColumns, timestamp, mutation).clustering(table.cfName, column.name);
-
- adder.add("dropped_time", new Date(TimeUnit.MICROSECONDS.toMillis(column.droppedTime)))
- .add("type", expandUserTypes(column.type).asCQL3Type().toString())
- .build();
++ builder.update(DroppedColumns).row(table.cfName, column.name).delete();
+ }
+
- private static void addTriggerToSchemaMutation(CFMetaData table, TriggerMetadata trigger, long timestamp, Mutation mutation)
+ private static void addTriggerToSchemaMutation(CFMetaData table, TriggerMetadata trigger, Mutation.SimpleBuilder builder)
{
- new RowUpdateBuilder(Triggers, timestamp, mutation)
- .clustering(table.cfName, trigger.name)
- .frozenMap("options", Collections.singletonMap("class", trigger.classOption))
- .build();
+ builder.update(Triggers)
+ .row(table.cfName, trigger.name)
+ .add("options", Collections.singletonMap("class", trigger.classOption));
}
- private static void dropTriggerFromSchemaMutation(CFMetaData table, TriggerMetadata trigger, long timestamp, Mutation mutation)
+ private static void dropTriggerFromSchemaMutation(CFMetaData table, TriggerMetadata trigger, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder.deleteRow(Triggers, timestamp, mutation, table.cfName, trigger.name);
+ builder.update(Triggers).row(table.cfName, trigger.name).delete();
}
- public static Mutation makeCreateViewMutation(KeyspaceMetadata keyspace, ViewDefinition view, long timestamp)
+ public static Mutation.SimpleBuilder makeCreateViewMutation(KeyspaceMetadata keyspace, ViewDefinition view, long timestamp)
{
// Include the serialized keyspace in case the target node missed a CREATE KEYSPACE migration (see CASSANDRA-5631).
- Mutation mutation = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
- addViewToSchemaMutation(view, timestamp, true, mutation);
- return mutation;
+ Mutation.SimpleBuilder builder = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
+ addViewToSchemaMutation(view, true, builder);
+ return builder;
}
- private static void addViewToSchemaMutation(ViewDefinition view, long timestamp, boolean includeColumns, Mutation mutation)
+ private static void addViewToSchemaMutation(ViewDefinition view, boolean includeColumns, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder builder = new RowUpdateBuilder(Views, timestamp, mutation)
- .clustering(view.viewName);
-
CFMetaData table = view.metadata;
+ Row.SimpleBuilder rowBuilder = builder.update(Views)
+ .row(view.viewName)
+ .add("include_all_columns", view.includeAllColumns)
+ .add("base_table_id", view.baseTableId)
+ .add("base_table_name", view.baseTableMetadata().cfName)
+ .add("where_clause", view.whereClause)
+ .add("id", table.cfId);
- builder.add("include_all_columns", view.includeAllColumns)
- .add("base_table_id", view.baseTableId)
- .add("base_table_name", view.baseTableMetadata().cfName)
- .add("where_clause", view.whereClause)
- .add("id", table.cfId);
-
- addTableParamsToSchemaMutation(table.params, builder);
+ addTableParamsToRowBuilder(table.params, rowBuilder);
if (includeColumns)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[3/6] cassandra git commit: Drop table should remove corresponding
entries in dropped_columns table
Posted by al...@apache.org.
Drop table should remove corresponding entries in dropped_columns table
patch by Zhao Yang; reviewed by Aleksey Yeschenko for CASSANDRA-13730
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d9eabd3d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d9eabd3d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d9eabd3d
Branch: refs/heads/trunk
Commit: d9eabd3d0cbf1287aa7d01bc23dd8e39c3acf232
Parents: d74ed4b
Author: Zhao Yang <zh...@gmail.com>
Authored: Sun Jul 30 12:24:46 2017 +0800
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Thu Aug 3 12:32:13 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/schema/SchemaKeyspace.java | 9 +++++++++
.../cassandra/cql3/validation/operations/DropTest.java | 13 +++++++++++++
3 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7e518ed..799e7f4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.15
+ * Drop table should remove corresponding entries in dropped_columns table (CASSANDRA-13730)
* Log warn message until legacy auth tables have been migrated (CASSANDRA-13371)
* Fix incorrect [2.1 <- 3.0] serialization of counter cells created in 2.0 (CASSANDRA-13691)
* Fix invalid writetime for null cells (CASSANDRA-13711)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/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 63017ec..06450f1 100644
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.config.*;
+import org.apache.cassandra.config.CFMetaData.DroppedColumn;
import org.apache.cassandra.config.ColumnDefinition.ClusteringOrder;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.functions.*;
@@ -626,6 +627,9 @@ public final class SchemaKeyspace
for (ColumnDefinition column : table.allColumns())
dropColumnFromSchemaMutation(table, column, timestamp, mutation);
+ for (CFMetaData.DroppedColumn column : table.getDroppedColumns().values())
+ dropDroppedColumnFromSchemaMutation(table, column, timestamp, mutation);
+
for (TriggerMetadata trigger : table.getTriggers())
dropTriggerFromSchemaMutation(table, trigger, timestamp, mutation);
@@ -657,6 +661,11 @@ public final class SchemaKeyspace
RowUpdateBuilder.deleteRow(Columns, timestamp, mutation, table.cfName, column.name.toString());
}
+ private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation mutation)
+ {
+ RowUpdateBuilder.deleteRow(DroppedColumns, timestamp, mutation, table.cfName, column.name);
+ }
+
private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, long timestamp, Mutation mutation)
{
RowUpdateBuilder adder = new RowUpdateBuilder(DroppedColumns, timestamp, mutation).clustering(table.cfName, column.name);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
index e5c7089..692eb45 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
@@ -34,4 +34,17 @@ public class DropTest extends CQLTester
execute("DROP TABLE IF EXISTS keyspace_does_not_exist.table_does_not_exist");
}
+ @Test
+ public void testDropTableWithDroppedColumns() throws Throwable
+ {
+ // CASSANDRA-13730: entry should be removed from dropped_columns table when table is dropped
+ String cf = createTable("CREATE TABLE %s (k1 int, c1 int , v1 int, v2 int, PRIMARY KEY (k1, c1))");
+
+ execute("ALTER TABLE %s DROP v2");
+ execute("DROP TABLE %s");
+
+ assertRowsIgnoringOrder(execute("select * from system_schema.dropped_columns where keyspace_name = '"
+ + keyspace()
+ + "' and table_name = '" + cf + "'"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[6/6] cassandra git commit: Merge branch 'cassandra-3.11' into trunk
Posted by al...@apache.org.
Merge branch 'cassandra-3.11' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/32de990b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/32de990b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/32de990b
Branch: refs/heads/trunk
Commit: 32de990b7abf1ae54f31ba728a9860031d0f435c
Parents: 457733b 2fd33ba
Author: Aleksey Yeschenko <al...@yeschenko.com>
Authored: Thu Aug 3 14:28:52 2017 +0100
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Thu Aug 3 14:28:52 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../org/apache/cassandra/schema/SchemaKeyspace.java | 8 ++++++++
.../cassandra/cql3/validation/operations/DropTest.java | 13 +++++++++++++
3 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/32de990b/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/32de990b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index 69bdf8d,1f8d2fc..b7de321
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@@ -640,15 -652,18 +640,18 @@@ public final class SchemaKeyspac
// Include the serialized keyspace in case the target node missed a CREATE KEYSPACE migration (see CASSANDRA-5631).
Mutation.SimpleBuilder builder = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
- builder.update(Tables).row(table.cfName).delete();
+ builder.update(Tables).row(table.name).delete();
- for (ColumnDefinition column : table.allColumns())
+ for (ColumnMetadata column : table.columns())
dropColumnFromSchemaMutation(table, column, builder);
- for (CFMetaData.DroppedColumn column : table.getDroppedColumns().values())
- dropDroppedColumnFromSchemaMutation(table, column, timestamp, builder);
-
- for (TriggerMetadata trigger : table.getTriggers())
+ for (TriggerMetadata trigger : table.triggers)
dropTriggerFromSchemaMutation(table, trigger, builder);
- for (IndexMetadata index : table.getIndexes())
++ for (DroppedColumn column : table.droppedColumns.values())
++ dropDroppedColumnFromSchemaMutation(table, column, builder);
++
+ for (IndexMetadata index : table.indexes)
dropIndexFromSchemaMutation(table, index, builder);
return builder;
@@@ -669,25 -684,29 +672,30 @@@
.add("type", type.asCQL3Type().toString());
}
- private static void dropColumnFromSchemaMutation(CFMetaData table, ColumnDefinition column, Mutation.SimpleBuilder builder)
+ private static void dropColumnFromSchemaMutation(TableMetadata table, ColumnMetadata column, Mutation.SimpleBuilder builder)
{
// Note: we do want to use name.toString(), not name.bytes directly for backward compatibility (For CQL3, this won't make a difference).
- builder.update(Columns).row(table.cfName, column.name.toString()).delete();
+ builder.update(Columns).row(table.name, column.name.toString()).delete();
}
- private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, Mutation.SimpleBuilder builder)
+ private static void addDroppedColumnToSchemaMutation(TableMetadata table, DroppedColumn column, Mutation.SimpleBuilder builder)
{
builder.update(DroppedColumns)
- .row(table.cfName, column.name)
+ .row(table.name, column.column.name.toString())
.add("dropped_time", new Date(TimeUnit.MICROSECONDS.toMillis(column.droppedTime)))
- .add("type", expandUserTypes(column.type).asCQL3Type().toString());
+ .add("type", expandUserTypes(column.column.type).asCQL3Type().toString())
+ .add("kind", column.column.kind.toString().toLowerCase());
}
- private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation.SimpleBuilder builder)
++ private static void dropDroppedColumnFromSchemaMutation(TableMetadata table, DroppedColumn column, Mutation.SimpleBuilder builder)
+ {
- builder.update(DroppedColumns).row(table.cfName, column.name).delete();
++ builder.update(DroppedColumns).row(table.name, column.column.name.toString()).delete();
+ }
+
- private static void addTriggerToSchemaMutation(CFMetaData table, TriggerMetadata trigger, Mutation.SimpleBuilder builder)
+ private static void addTriggerToSchemaMutation(TableMetadata table, TriggerMetadata trigger, Mutation.SimpleBuilder builder)
{
builder.update(Triggers)
- .row(table.cfName, trigger.name)
+ .row(table.name, trigger.name)
.add("options", Collections.singletonMap("class", trigger.classOption));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[2/6] cassandra git commit: Drop table should remove corresponding
entries in dropped_columns table
Posted by al...@apache.org.
Drop table should remove corresponding entries in dropped_columns table
patch by Zhao Yang; reviewed by Aleksey Yeschenko for CASSANDRA-13730
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d9eabd3d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d9eabd3d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d9eabd3d
Branch: refs/heads/cassandra-3.11
Commit: d9eabd3d0cbf1287aa7d01bc23dd8e39c3acf232
Parents: d74ed4b
Author: Zhao Yang <zh...@gmail.com>
Authored: Sun Jul 30 12:24:46 2017 +0800
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Thu Aug 3 12:32:13 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/schema/SchemaKeyspace.java | 9 +++++++++
.../cassandra/cql3/validation/operations/DropTest.java | 13 +++++++++++++
3 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7e518ed..799e7f4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.15
+ * Drop table should remove corresponding entries in dropped_columns table (CASSANDRA-13730)
* Log warn message until legacy auth tables have been migrated (CASSANDRA-13371)
* Fix incorrect [2.1 <- 3.0] serialization of counter cells created in 2.0 (CASSANDRA-13691)
* Fix invalid writetime for null cells (CASSANDRA-13711)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/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 63017ec..06450f1 100644
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.config.*;
+import org.apache.cassandra.config.CFMetaData.DroppedColumn;
import org.apache.cassandra.config.ColumnDefinition.ClusteringOrder;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.functions.*;
@@ -626,6 +627,9 @@ public final class SchemaKeyspace
for (ColumnDefinition column : table.allColumns())
dropColumnFromSchemaMutation(table, column, timestamp, mutation);
+ for (CFMetaData.DroppedColumn column : table.getDroppedColumns().values())
+ dropDroppedColumnFromSchemaMutation(table, column, timestamp, mutation);
+
for (TriggerMetadata trigger : table.getTriggers())
dropTriggerFromSchemaMutation(table, trigger, timestamp, mutation);
@@ -657,6 +661,11 @@ public final class SchemaKeyspace
RowUpdateBuilder.deleteRow(Columns, timestamp, mutation, table.cfName, column.name.toString());
}
+ private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation mutation)
+ {
+ RowUpdateBuilder.deleteRow(DroppedColumns, timestamp, mutation, table.cfName, column.name);
+ }
+
private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, long timestamp, Mutation mutation)
{
RowUpdateBuilder adder = new RowUpdateBuilder(DroppedColumns, timestamp, mutation).clustering(table.cfName, column.name);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9eabd3d/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
index e5c7089..692eb45 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
@@ -34,4 +34,17 @@ public class DropTest extends CQLTester
execute("DROP TABLE IF EXISTS keyspace_does_not_exist.table_does_not_exist");
}
+ @Test
+ public void testDropTableWithDroppedColumns() throws Throwable
+ {
+ // CASSANDRA-13730: entry should be removed from dropped_columns table when table is dropped
+ String cf = createTable("CREATE TABLE %s (k1 int, c1 int , v1 int, v2 int, PRIMARY KEY (k1, c1))");
+
+ execute("ALTER TABLE %s DROP v2");
+ execute("DROP TABLE %s");
+
+ assertRowsIgnoringOrder(execute("select * from system_schema.dropped_columns where keyspace_name = '"
+ + keyspace()
+ + "' and table_name = '" + cf + "'"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[4/6] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.11
Posted by al...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2fd33ba9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2fd33ba9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2fd33ba9
Branch: refs/heads/trunk
Commit: 2fd33ba9d70684b6b2da22d045df49bfe70451fa
Parents: 61a47af d9eabd3
Author: Aleksey Yeschenko <al...@yeschenko.com>
Authored: Thu Aug 3 14:15:36 2017 +0100
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Thu Aug 3 14:15:36 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/schema/SchemaKeyspace.java | 9 +++++++++
.../cassandra/cql3/validation/operations/DropTest.java | 13 +++++++++++++
3 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd33ba9/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 3b0524b,799e7f4..45ed523
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,9 -1,5 +1,10 @@@
-3.0.15
+3.11.1
+ * "ignore" option is ignored in sstableloader (CASSANDRA-13721)
+ * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652)
+ * Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512)
+ * Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
+Merged from 3.0:
+ * Drop table should remove corresponding entries in dropped_columns table (CASSANDRA-13730)
* Log warn message until legacy auth tables have been migrated (CASSANDRA-13371)
* Fix incorrect [2.1 <- 3.0] serialization of counter cells created in 2.0 (CASSANDRA-13691)
* Fix invalid writetime for null cells (CASSANDRA-13711)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd33ba9/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index 03c393f,06450f1..1f8d2fc
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@@ -646,86 -617,99 +647,94 @@@ public final class SchemaKeyspac
return Maps.difference(beforeMap, afterMap);
}
- public static Mutation makeDropTableMutation(KeyspaceMetadata keyspace, CFMetaData table, long timestamp)
+ public static Mutation.SimpleBuilder makeDropTableMutation(KeyspaceMetadata keyspace, CFMetaData table, long timestamp)
{
// Include the serialized keyspace in case the target node missed a CREATE KEYSPACE migration (see CASSANDRA-5631).
- Mutation mutation = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
+ Mutation.SimpleBuilder builder = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
- RowUpdateBuilder.deleteRow(Tables, timestamp, mutation, table.cfName);
+ builder.update(Tables).row(table.cfName).delete();
for (ColumnDefinition column : table.allColumns())
- dropColumnFromSchemaMutation(table, column, timestamp, mutation);
+ dropColumnFromSchemaMutation(table, column, builder);
+ for (CFMetaData.DroppedColumn column : table.getDroppedColumns().values())
- dropDroppedColumnFromSchemaMutation(table, column, timestamp, mutation);
++ dropDroppedColumnFromSchemaMutation(table, column, timestamp, builder);
+
for (TriggerMetadata trigger : table.getTriggers())
- dropTriggerFromSchemaMutation(table, trigger, timestamp, mutation);
+ dropTriggerFromSchemaMutation(table, trigger, builder);
for (IndexMetadata index : table.getIndexes())
- dropIndexFromSchemaMutation(table, index, timestamp, mutation);
+ dropIndexFromSchemaMutation(table, index, builder);
- return mutation;
+ return builder;
}
- private static void addColumnToSchemaMutation(CFMetaData table, ColumnDefinition column, long timestamp, Mutation mutation)
+ private static void addColumnToSchemaMutation(CFMetaData table, ColumnDefinition column, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder adder = new RowUpdateBuilder(Columns, timestamp, mutation).clustering(table.cfName, column.name.toString());
-
AbstractType<?> type = column.type;
if (type instanceof ReversedType)
type = ((ReversedType) type).baseType;
- adder.add("column_name_bytes", column.name.bytes)
- .add("kind", column.kind.toString().toLowerCase())
- .add("position", column.position())
- .add("clustering_order", column.clusteringOrder().toString().toLowerCase())
- .add("type", type.asCQL3Type().toString())
- .build();
+ builder.update(Columns)
+ .row(table.cfName, column.name.toString())
+ .add("column_name_bytes", column.name.bytes)
+ .add("kind", column.kind.toString().toLowerCase())
+ .add("position", column.position())
+ .add("clustering_order", column.clusteringOrder().toString().toLowerCase())
+ .add("type", type.asCQL3Type().toString());
}
- private static void dropColumnFromSchemaMutation(CFMetaData table, ColumnDefinition column, long timestamp, Mutation mutation)
+ private static void dropColumnFromSchemaMutation(CFMetaData table, ColumnDefinition column, Mutation.SimpleBuilder builder)
{
// Note: we do want to use name.toString(), not name.bytes directly for backward compatibility (For CQL3, this won't make a difference).
- RowUpdateBuilder.deleteRow(Columns, timestamp, mutation, table.cfName, column.name.toString());
+ builder.update(Columns).row(table.cfName, column.name.toString()).delete();
}
- private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation mutation)
+ private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder.deleteRow(DroppedColumns, timestamp, mutation, table.cfName, column.name);
+ builder.update(DroppedColumns)
+ .row(table.cfName, column.name)
+ .add("dropped_time", new Date(TimeUnit.MICROSECONDS.toMillis(column.droppedTime)))
+ .add("type", expandUserTypes(column.type).asCQL3Type().toString());
}
- private static void addDroppedColumnToSchemaMutation(CFMetaData table, CFMetaData.DroppedColumn column, long timestamp, Mutation mutation)
++ private static void dropDroppedColumnFromSchemaMutation(CFMetaData table, DroppedColumn column, long timestamp, Mutation.SimpleBuilder builder)
+ {
- RowUpdateBuilder adder = new RowUpdateBuilder(DroppedColumns, timestamp, mutation).clustering(table.cfName, column.name);
-
- adder.add("dropped_time", new Date(TimeUnit.MICROSECONDS.toMillis(column.droppedTime)))
- .add("type", expandUserTypes(column.type).asCQL3Type().toString())
- .build();
++ builder.update(DroppedColumns).row(table.cfName, column.name).delete();
+ }
+
- private static void addTriggerToSchemaMutation(CFMetaData table, TriggerMetadata trigger, long timestamp, Mutation mutation)
+ private static void addTriggerToSchemaMutation(CFMetaData table, TriggerMetadata trigger, Mutation.SimpleBuilder builder)
{
- new RowUpdateBuilder(Triggers, timestamp, mutation)
- .clustering(table.cfName, trigger.name)
- .frozenMap("options", Collections.singletonMap("class", trigger.classOption))
- .build();
+ builder.update(Triggers)
+ .row(table.cfName, trigger.name)
+ .add("options", Collections.singletonMap("class", trigger.classOption));
}
- private static void dropTriggerFromSchemaMutation(CFMetaData table, TriggerMetadata trigger, long timestamp, Mutation mutation)
+ private static void dropTriggerFromSchemaMutation(CFMetaData table, TriggerMetadata trigger, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder.deleteRow(Triggers, timestamp, mutation, table.cfName, trigger.name);
+ builder.update(Triggers).row(table.cfName, trigger.name).delete();
}
- public static Mutation makeCreateViewMutation(KeyspaceMetadata keyspace, ViewDefinition view, long timestamp)
+ public static Mutation.SimpleBuilder makeCreateViewMutation(KeyspaceMetadata keyspace, ViewDefinition view, long timestamp)
{
// Include the serialized keyspace in case the target node missed a CREATE KEYSPACE migration (see CASSANDRA-5631).
- Mutation mutation = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
- addViewToSchemaMutation(view, timestamp, true, mutation);
- return mutation;
+ Mutation.SimpleBuilder builder = makeCreateKeyspaceMutation(keyspace.name, keyspace.params, timestamp);
+ addViewToSchemaMutation(view, true, builder);
+ return builder;
}
- private static void addViewToSchemaMutation(ViewDefinition view, long timestamp, boolean includeColumns, Mutation mutation)
+ private static void addViewToSchemaMutation(ViewDefinition view, boolean includeColumns, Mutation.SimpleBuilder builder)
{
- RowUpdateBuilder builder = new RowUpdateBuilder(Views, timestamp, mutation)
- .clustering(view.viewName);
-
CFMetaData table = view.metadata;
+ Row.SimpleBuilder rowBuilder = builder.update(Views)
+ .row(view.viewName)
+ .add("include_all_columns", view.includeAllColumns)
+ .add("base_table_id", view.baseTableId)
+ .add("base_table_name", view.baseTableMetadata().cfName)
+ .add("where_clause", view.whereClause)
+ .add("id", table.cfId);
- builder.add("include_all_columns", view.includeAllColumns)
- .add("base_table_id", view.baseTableId)
- .add("base_table_name", view.baseTableMetadata().cfName)
- .add("where_clause", view.whereClause)
- .add("id", table.cfId);
-
- addTableParamsToSchemaMutation(table.params, builder);
+ addTableParamsToRowBuilder(table.params, rowBuilder);
if (includeColumns)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org