mirror of https://github.com/apache/cassandra
Update indexInterval in CFMetadata.apply()
Patch by Stefania Alborghetti; reviewed by Tyler Hobbs for CASSANDRA-7976
This commit is contained in:
parent
f7116c91b2
commit
88b2f38326
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}}
|
||||
Loading…
Reference in New Issue