cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: Use range tombstones when dropping cfs/columns from schema
Date Mon, 20 May 2013 08:16:09 GMT
Updated Branches:
  refs/heads/trunk cfe4c5963 -> 2d99a7d77


Use range tombstones when dropping cfs/columns from schema

patch by Aleksey Yeschenko; reviewed by Sylvain Lebresne for
CASSANDRA-5579


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2d99a7d7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2d99a7d7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2d99a7d7

Branch: refs/heads/trunk
Commit: 2d99a7d774c069c89a181e96fc266875a3eefca8
Parents: cfe4c59
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Mon May 20 11:13:32 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon May 20 11:14:26 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/config/CFMetaData.java    |   35 +-------------
 .../apache/cassandra/config/ColumnDefinition.java  |   11 ++---
 3 files changed, 8 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d99a7d7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2e02da8..48bec35 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -46,6 +46,7 @@
  * Swap THshaServer for TThreadedSelectorServer (CASSANDRA-5530)
  * Add alias support to SELECT statement (CASSANDRA-5075)
  * Don't create empty RowMutations in CommitLogReplayer (CASSANDRA-5541)
+ * Use range tombstones when dropping cfs/columns from schema (CASSANDRA-5579)
 
 
 1.2.6

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d99a7d7/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 0af6c77..9d35a70 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -1446,38 +1446,9 @@ public final class CFMetaData
         ColumnFamily cf = rm.addOrGet(SystemTable.SCHEMA_COLUMNFAMILIES_CF);
         int ldt = (int) (System.currentTimeMillis() / 1000);
 
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, ""));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "id"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "type"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "comparator"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "subcomparator"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "comment"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "read_repair_chance"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "local_read_repair_chance"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "replicate_on_write"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "populate_io_cache_on_flush"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "gc_grace_seconds"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "default_validator"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "key_validator"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "min_compaction_threshold"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "max_compaction_threshold"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "memtable_flush_period_in_ms"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "key_alias"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "key_aliases"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "bloom_filter_fp_chance"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "caching"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "default_time_to_live"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "speculative_retry"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "compaction_strategy_class"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "compression_parameters"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "value_alias"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "column_aliases"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "compaction_strategy_options"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "index_interval"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "trigger_class"));
-
-        for (Map.Entry<ByteBuffer, Long> entry : droppedColumns.entrySet())
-            cf.addColumn(new DeletedColumn(makeDroppedColumnName(entry.getKey()), ldt, timestamp));
+        ColumnNameBuilder builder = SchemaColumnFamiliesCf.getCfDef().getColumnNameBuilder();
+        builder.add(ByteBufferUtil.bytes(cfName));
+        cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp,
ldt));
 
         for (ColumnDefinition cd : column_metadata.values())
             cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(cd), timestamp);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d99a7d7/src/java/org/apache/cassandra/config/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java
index 64edfd4..9d21435 100644
--- a/src/java/org/apache/cassandra/config/ColumnDefinition.java
+++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java
@@ -24,6 +24,7 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Objects;
 import com.google.common.collect.Maps;
 
+import org.apache.cassandra.cql3.ColumnNameBuilder;
 import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.db.*;
@@ -200,13 +201,9 @@ public class ColumnDefinition
         ColumnFamily cf = rm.addOrGet(SystemTable.SCHEMA_COLUMNS_CF);
         int ldt = (int) (System.currentTimeMillis() / 1000);
 
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name),
""));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name),
"validator"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name),
"index_type"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name),
"index_options"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name),
"index_name"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name),
"component_index"));
-        cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name),
"type"));
+        ColumnNameBuilder builder = CFMetaData.SchemaColumnsCf.getCfDef().getColumnNameBuilder();
+        builder.add(ByteBufferUtil.bytes(cfName)).add(name);
+        cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp,
ldt));
     }
 
     public void toSchema(RowMutation rm, String cfName, AbstractType<?> comparator,
long timestamp)


Mime
View raw message