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 2014/11/07 19:36:50 UTC
[1/3] cassandra git commit: Add schema_triggers cleanup to
SystemKeyspace#finishStartup()
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 cb9d3881f -> 7920ebebe
Add schema_triggers cleanup to SystemKeyspace#finishStartup()
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c3a80958
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c3a80958
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c3a80958
Branch: refs/heads/cassandra-2.1
Commit: c3a809584a131bb665f32e93256b3c473570139f
Parents: 4868854
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Nov 7 21:28:33 2014 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Nov 7 21:28:33 2014 +0300
----------------------------------------------------------------------
.../org/apache/cassandra/db/SystemKeyspace.java | 21 +++++++++-----------
1 file changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c3a80958/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java
index 30e6d47..64a487c 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -112,20 +112,17 @@ public class SystemKeyspace
copyAllAliasesToColumnsProper();
// add entries to system schema columnfamilies for the hardcoded system definitions
- for (String ksname : Schema.systemKeyspaceNames)
- {
- KSMetaData ksmd = Schema.instance.getKSMetaData(ksname);
+ KSMetaData ksmd = Schema.instance.getKSMetaData(Keyspace.SYSTEM_KS);
- // delete old, possibly obsolete entries in schema columnfamilies
- for (String cfname : Arrays.asList(SystemKeyspace.SCHEMA_KEYSPACES_CF, SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF, SystemKeyspace.SCHEMA_COLUMNS_CF))
- {
- String req = String.format("DELETE FROM system.%s WHERE keyspace_name = '%s'", cfname, ksmd.name);
- processInternal(req);
- }
+ // delete old, possibly obsolete entries in schema columnfamilies
+ for (String cfname : Arrays.asList(SystemKeyspace.SCHEMA_KEYSPACES_CF,
+ SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
+ SystemKeyspace.SCHEMA_COLUMNS_CF,
+ SystemKeyspace.SCHEMA_TRIGGERS_CF))
+ processInternal(String.format("DELETE FROM system.%s WHERE keyspace_name = '%s'", cfname, ksmd.name));
- // (+1 to timestamp to make sure we don't get shadowed by the tombstones we just added)
- ksmd.toSchema(FBUtilities.timestampMicros() + 1).apply();
- }
+ // (+1 to timestamp to make sure we don't get shadowed by the tombstones we just added)
+ ksmd.toSchema(FBUtilities.timestampMicros() + 1).apply();
}
// Starting with 2.0 (CASSANDRA-5125) we keep all the 'aliases' in system.schema_columns together with the regular columns,
[2/3] cassandra git commit: Merge branch 'cassandra-2.0' into
cassandra-2.1
Posted by al...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Conflicts:
src/java/org/apache/cassandra/db/SystemKeyspace.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6d2d60aa
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6d2d60aa
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6d2d60aa
Branch: refs/heads/cassandra-2.1
Commit: 6d2d60aa6de3de9edb0a540dddcae3aaca41ea68
Parents: cb9d388 c3a8095
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Nov 7 21:33:38 2014 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Nov 7 21:33:38 2014 +0300
----------------------------------------------------------------------
.../org/apache/cassandra/db/SystemKeyspace.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6d2d60aa/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SystemKeyspace.java
index 8b16564,64a487c..02a9530
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@@ -111,51 -109,36 +111,51 @@@ public class SystemKeyspac
{
setupVersion();
- copyAllAliasesToColumnsProper();
-
+ migrateIndexInterval();
+ migrateCachingOption();
// add entries to system schema columnfamilies for the hardcoded system definitions
- for (String ksname : Schema.systemKeyspaceNames)
- {
- KSMetaData ksmd = Schema.instance.getKSMetaData(ksname);
+ KSMetaData ksmd = Schema.instance.getKSMetaData(Keyspace.SYSTEM_KS);
- // delete old, possibly obsolete entries in schema columnfamilies
- for (String cfname : Arrays.asList(SystemKeyspace.SCHEMA_KEYSPACES_CF, SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF, SystemKeyspace.SCHEMA_COLUMNS_CF))
- executeOnceInternal(String.format("DELETE FROM system.%s WHERE keyspace_name = ?", cfname), ksmd.name);
+ // delete old, possibly obsolete entries in schema columnfamilies
+ for (String cfname : Arrays.asList(SystemKeyspace.SCHEMA_KEYSPACES_CF,
+ SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
+ SystemKeyspace.SCHEMA_COLUMNS_CF,
+ SystemKeyspace.SCHEMA_TRIGGERS_CF))
- processInternal(String.format("DELETE FROM system.%s WHERE keyspace_name = '%s'", cfname, ksmd.name));
++ executeOnceInternal(String.format("DELETE FROM system.%s WHERE keyspace_name = ?", cfname), ksmd.name);
- // (+1 to timestamp to make sure we don't get shadowed by the tombstones we just added)
- ksmd.toSchema(FBUtilities.timestampMicros() + 1).apply();
- }
+ // (+1 to timestamp to make sure we don't get shadowed by the tombstones we just added)
+ ksmd.toSchema(FBUtilities.timestampMicros() + 1).apply();
}
- // Starting with 2.0 (CASSANDRA-5125) we keep all the 'aliases' in system.schema_columns together with the regular columns,
- // but only for the newly-created tables. This migration is for the pre-2.0 created tables.
- private static void copyAllAliasesToColumnsProper()
+ private static void setupVersion()
{
- for (UntypedResultSet.Row row : processInternal(String.format("SELECT * FROM system.%s", SCHEMA_COLUMNFAMILIES_CF)))
+ String req = "INSERT INTO system.%s (key, release_version, cql_version, thrift_version, native_protocol_version, data_center, rack, partitioner) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
+ IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
+ executeOnceInternal(String.format(req, LOCAL_CF),
+ LOCAL_KEY,
+ FBUtilities.getReleaseVersionString(),
+ QueryProcessor.CQL_VERSION.toString(),
+ cassandraConstants.VERSION,
+ String.valueOf(Server.CURRENT_VERSION),
+ snitch.getDatacenter(FBUtilities.getBroadcastAddress()),
+ snitch.getRack(FBUtilities.getBroadcastAddress()),
+ DatabaseDescriptor.getPartitioner().getClass().getName());
+ }
+
+ // TODO: In 3.0, remove this and the index_interval column from system.schema_columnfamilies
+ /** Migrates index_interval values to min_index_interval and sets index_interval to null */
+ private static void migrateIndexInterval()
+ {
+ for (UntypedResultSet.Row row : executeOnceInternal(String.format("SELECT * FROM system.%s", SCHEMA_COLUMNFAMILIES_CF)))
{
+ if (!row.has("index_interval"))
+ continue;
+
+ logger.debug("Migrating index_interval to min_index_interval");
+
CFMetaData table = CFMetaData.fromSchema(row);
- String query = String.format("SELECT writetime(type) "
- + "FROM system.%s "
- + "WHERE keyspace_name = '%s' AND columnfamily_name = '%s'",
- SCHEMA_COLUMNFAMILIES_CF,
- table.ksName,
- table.cfName);
- long timestamp = processInternal(query).one().getLong("writetime(type)");
+ String query = String.format("SELECT writetime(type) FROM system.%s WHERE keyspace_name = ? AND columnfamily_name = ?", SCHEMA_COLUMNFAMILIES_CF);
+ long timestamp = executeOnceInternal(query, table.ksName, table.cfName).one().getLong("writetime(type)");
try
{
table.toSchema(timestamp).apply();
[3/3] cassandra git commit: Add schema_usertypes cleanup to
SystemKeyspace#finishStartup()
Posted by al...@apache.org.
Add schema_usertypes cleanup to SystemKeyspace#finishStartup()
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7920ebeb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7920ebeb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7920ebeb
Branch: refs/heads/cassandra-2.1
Commit: 7920ebebe2640ffb59225b7d32d5d818ce76dd12
Parents: 6d2d60a
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Nov 7 21:36:40 2014 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Nov 7 21:36:40 2014 +0300
----------------------------------------------------------------------
src/java/org/apache/cassandra/db/SystemKeyspace.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7920ebeb/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java
index 02a9530..2a3535a 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -120,7 +120,8 @@ public class SystemKeyspace
for (String cfname : Arrays.asList(SystemKeyspace.SCHEMA_KEYSPACES_CF,
SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
SystemKeyspace.SCHEMA_COLUMNS_CF,
- SystemKeyspace.SCHEMA_TRIGGERS_CF))
+ SystemKeyspace.SCHEMA_TRIGGERS_CF,
+ SystemKeyspace.SCHEMA_USER_TYPES_CF))
executeOnceInternal(String.format("DELETE FROM system.%s WHERE keyspace_name = ?", cfname), ksmd.name);
// (+1 to timestamp to make sure we don't get shadowed by the tombstones we just added)