handle schema loading when a node has had all keyspaces dropped. Patch by gdusbabek, reviewed by jbellis. CASSANDRA-1203.

git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@959722 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Dusbabek 2010-07-01 16:51:37 +00:00
parent 14e2a114ad
commit ed623da76d
2 changed files with 11 additions and 1 deletions

View File

@ -438,8 +438,15 @@ public class DatabaseDescriptor
Table.open(def.name);
}
// since we loaded definitions from local storage, log a warning if definitions exist in yaml.
// happens when someone manually deletes all tables and restarts.
if (tableDefs.size() == 0)
{
logger.warn("No schema definitions were found in local storage.");
// set defsVersion so that migrations leading up to emptiness aren't replayed.
defsVersion = uuid;
}
// since we loaded definitions from local storage, log a warning if definitions exist in yaml.
if (conf.keyspaces != null && conf.keyspaces.size() > 0)
logger.warn("Schema definitions were defined both locally and in " + STORAGE_CONF_FILE +
". Definitions in " + STORAGE_CONF_FILE + " were ignored.");

View File

@ -72,6 +72,9 @@ public class DefsTable
Collection<KSMetaData> tables = new ArrayList<KSMetaData>();
for (IColumn col : cf.getSortedColumns())
{
// don't allow deleted columns.
if (col instanceof DeletedColumn)
continue;
KSMetaData ks = KSMetaData.deserialize(new ByteArrayInputStream(col.value()));
tables.add(ks);
}