mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.0' into trunk
This commit is contained in:
commit
e75ebc4f6b
|
|
@ -17,7 +17,7 @@ Merged from 2.2:
|
|||
* Defer default role manager setup until all nodes are on 2.2+ (CASSANDRA-9761)
|
||||
* Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209)
|
||||
Merged from 2.1:
|
||||
* Fix cache handling of 2i and base tables (CASSANDRA-10155)
|
||||
* Fix cache handling of 2i and base tables (CASSANDRA-10155, 10359)
|
||||
* Fix NPE in nodetool compactionhistory (CASSANDRA-9758)
|
||||
* (Pig) support BulkOutputFormat as a URL parameter (CASSANDRA-7410)
|
||||
* BATCH statement is broken in cqlsh (CASSANDRA-10272)
|
||||
|
|
|
|||
|
|
@ -188,6 +188,15 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
|
|||
{
|
||||
logger.info(String.format("reading saved cache %s", dataPath));
|
||||
in = new DataInputStreamPlus(new LengthAvailableInputStream(new BufferedInputStream(streamFactory.getInputStream(dataPath, crcPath)), dataPath.length()));
|
||||
|
||||
//Check the schema has not changed since CFs are looked up by name which is ambiguous
|
||||
UUID schemaVersion = new UUID(in.readLong(), in.readLong());
|
||||
if (!schemaVersion.equals(Schema.instance.getVersion()))
|
||||
throw new RuntimeException("Cache schema version "
|
||||
+ schemaVersion.toString()
|
||||
+ " does not match current schema version "
|
||||
+ Schema.instance.getVersion());
|
||||
|
||||
ArrayDeque<Future<Pair<K, V>>> futures = new ArrayDeque<Future<Pair<K, V>>>();
|
||||
while (in.available() > 0)
|
||||
{
|
||||
|
|
@ -337,27 +346,38 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
while (keyIterator.hasNext())
|
||||
try
|
||||
{
|
||||
K key = keyIterator.next();
|
||||
|
||||
ColumnFamilyStore cfs = Schema.instance.getColumnFamilyStoreIncludingIndexes(key.ksAndCFName);
|
||||
if (cfs == null)
|
||||
continue; // the table or 2i has been dropped.
|
||||
|
||||
try
|
||||
//Need to be able to check schema version because CF names are ambiguous
|
||||
UUID schemaVersion = Schema.instance.getVersion();
|
||||
if (schemaVersion == null)
|
||||
{
|
||||
Schema.instance.updateVersion();
|
||||
schemaVersion = Schema.instance.getVersion();
|
||||
}
|
||||
writer.writeLong(schemaVersion.getMostSignificantBits());
|
||||
writer.writeLong(schemaVersion.getLeastSignificantBits());
|
||||
|
||||
while (keyIterator.hasNext())
|
||||
{
|
||||
K key = keyIterator.next();
|
||||
|
||||
ColumnFamilyStore cfs = Schema.instance.getColumnFamilyStoreIncludingIndexes(key.ksAndCFName);
|
||||
if (cfs == null)
|
||||
continue; // the table or 2i has been dropped.
|
||||
|
||||
cacheLoader.serialize(key, writer, cfs);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new FSWriteError(e, cacheFilePaths.left);
|
||||
}
|
||||
|
||||
keysWritten++;
|
||||
if (keysWritten >= keysEstimate)
|
||||
break;
|
||||
keysWritten++;
|
||||
if (keysWritten >= keysEstimate)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new FSWriteError(e, cacheFilePaths.left);
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
|||
|
|
@ -228,6 +228,7 @@ public class KeyCacheCqlTest extends CQLTester
|
|||
assertNull(Schema.instance.getColumnFamilyStoreIncludingIndexes(Pair.create(KEYSPACE, "bar")));
|
||||
|
||||
dropTable("DROP TABLE %s");
|
||||
Schema.instance.updateVersion();
|
||||
|
||||
//Test loading for a dropped 2i/table
|
||||
CacheService.instance.keyCache.clear();
|
||||
|
|
|
|||
Loading…
Reference in New Issue