You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2015/03/31 18:18:00 UTC
cassandra git commit: Update indexInterval in CFMetadata.apply()
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.0 f7116c91b -> 88b2f3832
Update indexInterval in CFMetadata.apply()
Patch by Stefania Alborghetti; reviewed by Tyler Hobbs for
CASSANDRA-7976
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/88b2f383
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/88b2f383
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/88b2f383
Branch: refs/heads/cassandra-2.0
Commit: 88b2f383268467cb1756edad0ec50c5bead802a4
Parents: f7116c9
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Tue Mar 31 11:17:15 2015 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Tue Mar 31 11:17:15 2015 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/config/CFMetaData.java | 1 +
.../apache/cassandra/cql3/AlterTableTest.java | 75 ++++++++++++++++++++
3 files changed, 77 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/88b2f383/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0bcc5cb..cdd2c77 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.14:
+ * Fix ignored index_interval change in ALTER TABLE statements (CASSANDRA-7976)
* Do more aggressive compaction in old time windows in DTCS (CASSANDRA-8360)
* java.lang.AssertionError when reading saved cache (CASSANDRA-8740)
* "disk full" when running cleanup (CASSANDRA-9036)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/88b2f383/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 04a5b01..056b305 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -1111,6 +1111,7 @@ public final class CFMetaData
memtableFlushPeriod = cfm.memtableFlushPeriod;
caching = cfm.caching;
defaultTimeToLive = cfm.defaultTimeToLive;
+ indexInterval = cfm.indexInterval;
speculativeRetry = cfm.speculativeRetry;
populateIoCacheOnFlush = cfm.populateIoCacheOnFlush;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/88b2f383/test/unit/org/apache/cassandra/cql3/AlterTableTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/AlterTableTest.java b/test/unit/org/apache/cassandra/cql3/AlterTableTest.java
new file mode 100644
index 0000000..099da54
--- /dev/null
+++ b/test/unit/org/apache/cassandra/cql3/AlterTableTest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.cql3;
+
+import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.service.ClientState;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.apache.cassandra.cql3.QueryProcessor.process;
+import static org.junit.Assert.assertEquals;
+
+public class AlterTableTest
+{
+ private static final String KEYSPACE = "alter_table_test";
+ static ClientState clientState;
+
+ @BeforeClass
+ public static void setUpClass() throws Throwable
+ {
+ SchemaLoader.loadSchema();
+ executeSchemaChange("CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}");
+ clientState = ClientState.forInternalCalls();
+ }
+
+ @AfterClass
+ public static void stopGossiper()
+ {
+ Gossiper.instance.stop();
+ }
+
+ private static void executeSchemaChange(String query) throws Throwable
+ {
+ try
+ {
+ process(String.format(query, KEYSPACE), ConsistencyLevel.ONE);
+ } catch (RuntimeException exc)
+ {
+ throw exc.getCause();
+ }
+ }
+
+ @Test
+ // tests CASSANDRA-7976
+ public void testAlterIndexInterval() throws Throwable
+ {
+ executeSchemaChange("CREATE TABLE IF NOT EXISTS %s.songs (id uuid, album text, artist text, data blob, PRIMARY KEY (id))");
+ ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore("songs");
+
+ executeSchemaChange("ALTER TABLE %s.songs WITH index_interval=256");
+ assertEquals(256, cfs.metadata.getIndexInterval());
+
+ executeSchemaChange("ALTER TABLE %s.songs WITH caching = 'none'");
+ assertEquals(256, cfs.metadata.getIndexInterval());
+ }}