Migrate key_alias->key_aliases on every schema migration (1.2)

Another follow-up to 5800
This commit is contained in:
Aleksey Yeschenko 2013-08-13 20:52:34 +02:00
parent 2d2099751c
commit 82081c7b4b
2 changed files with 5 additions and 2 deletions

View File

@ -341,6 +341,10 @@ public class DefsTable
for (RowMutation mutation : mutations)
mutation.apply();
// Must be called after each schema pull and not just on startup to guarantee the migration.
// See CASSANDRA-5800 comments for the details.
SystemTable.migrateKeyAlias();
if (!StorageService.instance.isClientMode())
flushSchemaCFs();

View File

@ -184,11 +184,10 @@ public class SystemTable
migrateKeyAlias();
}
/**
* 1.1 used a key_alias column; 1.2 changed that to key_aliases as part of CQL3
*/
private static void migrateKeyAlias()
public static void migrateKeyAlias()
{
String selectQuery = String.format("SELECT keyspace_name, columnfamily_name, writetime(type), key_aliases, key_alias FROM %s.%s",
Table.SYSTEM_KS,