You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sn...@apache.org on 2015/09/17 23:27:40 UTC
[1/3] cassandra git commit: Saved caches use ambigous keyspace and CF
name to identify tables
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.0 90661a325 -> 6e5d16b37
Saved caches use ambigous keyspace and CF name to identify tables
patch by Ariel Weisberg; reviewed by Robert Stupp for CASSANDRA-10359
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0b8b67bf
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0b8b67bf
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0b8b67bf
Branch: refs/heads/cassandra-3.0
Commit: 0b8b67bfe28db8e6b2aa0ab91cf76da5ff55fea3
Parents: 4e3555c
Author: Ariel Weisberg <ar...@datastax.com>
Authored: Thu Sep 17 23:22:56 2015 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Thu Sep 17 23:22:56 2015 +0200
----------------------------------------------------------------------
CHANGES.txt | 2 +-
.../apache/cassandra/cache/AutoSavingCache.java | 43 ++++++++++++++------
.../apache/cassandra/cql3/KeyCacheCqlTest.java | 1 +
3 files changed, 33 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b8b67bf/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 207f16a..e2dd83a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,5 @@
2.1.10
- * 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)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b8b67bf/src/java/org/apache/cassandra/cache/AutoSavingCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/AutoSavingCache.java b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
index 3ebbc76..1174c44 100644
--- a/src/java/org/apache/cassandra/cache/AutoSavingCache.java
+++ b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
@@ -178,6 +178,15 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
{
logger.info(String.format("reading saved cache %s", path));
in = new DataInputStream(new LengthAvailableInputStream(new BufferedInputStream(streamFactory.getInputStream(path)), path.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)
@@ -313,23 +322,33 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
throw new RuntimeException(e);
}
- for (K key : keys)
+ try
{
-
- 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)
{
- cacheLoader.serialize(key, writer, cfs);
+ Schema.instance.updateVersion();
+ schemaVersion = Schema.instance.getVersion();
}
- catch (IOException e)
+ writer.writeLong(schemaVersion.getMostSignificantBits());
+ writer.writeLong(schemaVersion.getLeastSignificantBits());
+
+ for (K key : keys)
{
- throw new FSWriteError(e, tempCacheFile);
- }
- keysWritten++;
+ ColumnFamilyStore cfs = Schema.instance.getColumnFamilyStoreIncludingIndexes(key.ksAndCFName);
+ if (cfs == null)
+ continue; // the table or 2i has been dropped.
+
+ cacheLoader.serialize(key, writer, cfs);
+
+ keysWritten++;
+ }
+ }
+ catch (IOException e)
+ {
+ throw new FSWriteError(e, tempCacheFile);
}
}
finally
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b8b67bf/test/unit/org/apache/cassandra/cql3/KeyCacheCqlTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/KeyCacheCqlTest.java b/test/unit/org/apache/cassandra/cql3/KeyCacheCqlTest.java
index 0e879e9..f2bea8e 100644
--- a/test/unit/org/apache/cassandra/cql3/KeyCacheCqlTest.java
+++ b/test/unit/org/apache/cassandra/cql3/KeyCacheCqlTest.java
@@ -129,6 +129,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();
[3/3] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sn...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6e5d16b3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6e5d16b3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6e5d16b3
Branch: refs/heads/cassandra-3.0
Commit: 6e5d16b373a53dabb0419a5b5a061a93a690d277
Parents: 90661a3 93745c0
Author: Robert Stupp <sn...@snazy.de>
Authored: Thu Sep 17 23:24:14 2015 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Thu Sep 17 23:24:14 2015 +0200
----------------------------------------------------------------------
CHANGES.txt | 2 +-
.../apache/cassandra/cache/AutoSavingCache.java | 50 ++++++++++++++------
.../apache/cassandra/cql3/KeyCacheCqlTest.java | 1 +
3 files changed, 37 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6e5d16b3/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0cbe919,59a50a5..6a630fd
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,19 -1,15 +1,19 @@@
-2.2.2
+3.0.0-rc1
+ * Improve MV schema representation (CASSANDRA-9921)
+ * Add flag to enable/disable coordinator batchlog for MV writes (CASSANDRA-10230)
+ * Update cqlsh COPY for new internal driver serialization interface (CASSANDRA-10318)
+ * Give index implementations more control over rebuild operations (CASSANDRA-10312)
+ * Update index file format (CASSANDRA-10314)
+ * Add "shadowable" row tombstones to deal with mv timestamp issues (CASSANDRA-10261)
+ * CFS.loadNewSSTables() broken for pre-3.0 sstables
+ * Cache selected index in read command to reduce lookups (CASSANDRA-10215)
+ * Small optimizations of sstable index serialization (CASSANDRA-10232)
+ * Support for both encrypted and unencrypted native transport connections (CASSANDRA-9590)
+Merged from 2.2:
* Defer default role manager setup until all nodes are on 2.2+ (CASSANDRA-9761)
- * Cancel transaction for sstables we wont redistribute index summary
- for (CASSANDRA-10270)
- * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209)
- * Retry snapshot deletion after compaction and gc on Windows (CASSANDRA-10222)
- * Fix failure to start with space in directory path on Windows (CASSANDRA-10239)
- * Fix repair hang when snapshot failed (CASSANDRA-10057)
- * Fall back to 1/4 commitlog volume for commitlog_total_space on small disks
- (CASSANDRA-10199)
+ * 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)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6e5d16b3/src/java/org/apache/cassandra/cache/AutoSavingCache.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cache/AutoSavingCache.java
index 4558bb7,48d60b7..58ddc2c
--- a/src/java/org/apache/cassandra/cache/AutoSavingCache.java
+++ b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
@@@ -187,7 -185,16 +187,16 @@@ public class AutoSavingCache<K extends
try
{
logger.info(String.format("reading saved cache %s", dataPath));
- in = new DataInputStream(new LengthAvailableInputStream(new BufferedInputStream(streamFactory.getInputStream(dataPath, crcPath)), dataPath.length()));
+ 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)
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6e5d16b3/test/unit/org/apache/cassandra/cql3/KeyCacheCqlTest.java
----------------------------------------------------------------------
[2/3] cassandra git commit: Merge branch 'cassandra-2.1' into
cassandra-2.2
Posted by sn...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/93745c05
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/93745c05
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/93745c05
Branch: refs/heads/cassandra-3.0
Commit: 93745c05c7dd7ad841d6f5dc79f2140891ca75a0
Parents: eecfb07 0b8b67b
Author: Robert Stupp <sn...@snazy.de>
Authored: Thu Sep 17 23:23:35 2015 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Thu Sep 17 23:23:35 2015 +0200
----------------------------------------------------------------------
CHANGES.txt | 2 +-
.../apache/cassandra/cache/AutoSavingCache.java | 50 ++++++++++++++------
.../apache/cassandra/cql3/KeyCacheCqlTest.java | 1 +
3 files changed, 37 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/93745c05/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index f9314f6,e2dd83a..59a50a5
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,15 -1,5 +1,15 @@@
-2.1.10
+2.2.2
+ * Defer default role manager setup until all nodes are on 2.2+ (CASSANDRA-9761)
+ * Cancel transaction for sstables we wont redistribute index summary
+ for (CASSANDRA-10270)
+ * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209)
+ * Retry snapshot deletion after compaction and gc on Windows (CASSANDRA-10222)
+ * Fix failure to start with space in directory path on Windows (CASSANDRA-10239)
+ * Fix repair hang when snapshot failed (CASSANDRA-10057)
+ * Fall back to 1/4 commitlog volume for commitlog_total_space on small disks
+ (CASSANDRA-10199)
+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)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/93745c05/src/java/org/apache/cassandra/cache/AutoSavingCache.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cache/AutoSavingCache.java
index 3ec9d4e,1174c44..48d60b7
--- a/src/java/org/apache/cassandra/cache/AutoSavingCache.java
+++ b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
@@@ -184,9 -176,19 +184,18 @@@ public class AutoSavingCache<K extends
DataInputStream in = null;
try
{
- logger.info(String.format("reading saved cache %s", path));
- in = new DataInputStream(new LengthAvailableInputStream(new BufferedInputStream(streamFactory.getInputStream(path)), path.length()));
+ logger.info(String.format("reading saved cache %s", dataPath));
+ in = new DataInputStream(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)
{
//ksname and cfname are serialized by the serializers in CacheService
@@@ -335,27 -322,34 +344,38 @@@
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)
{
- cacheLoader.serialize(key, writer, cfs);
+ Schema.instance.updateVersion();
+ schemaVersion = Schema.instance.getVersion();
}
- catch (IOException e)
+ writer.writeLong(schemaVersion.getMostSignificantBits());
+ writer.writeLong(schemaVersion.getLeastSignificantBits());
+
- for (K key : keys)
++ while (keyIterator.hasNext())
{
- throw new FSWriteError(e, cacheFilePaths.left);
- }
++ K key = keyIterator.next();
- keysWritten++;
- if (keysWritten >= keysEstimate)
- break;
+ ColumnFamilyStore cfs = Schema.instance.getColumnFamilyStoreIncludingIndexes(key.ksAndCFName);
+ if (cfs == null)
+ continue; // the table or 2i has been dropped.
+
+ cacheLoader.serialize(key, writer, cfs);
+
+ keysWritten++;
++ if (keysWritten >= keysEstimate)
++ break;
+ }
}
+ catch (IOException e)
+ {
- throw new FSWriteError(e, tempCacheFile);
++ throw new FSWriteError(e, cacheFilePaths.left);
+ }
++
}
finally
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/93745c05/test/unit/org/apache/cassandra/cql3/KeyCacheCqlTest.java
----------------------------------------------------------------------