mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.11' into cassandra-4.0
This commit is contained in:
commit
e98be8e3ec
|
|
@ -65,9 +65,10 @@ public final class AlterViewStatement extends AlterSchemaStatement
|
||||||
|
|
||||||
if (params.defaultTimeToLive > 0)
|
if (params.defaultTimeToLive > 0)
|
||||||
{
|
{
|
||||||
throw ire("Cannot set or alter default_time_to_live for a materialized view. " +
|
throw ire("Forbidden default_time_to_live detected for a materialized view. " +
|
||||||
"Data in a materialized view always expire at the same time than " +
|
"Data in a materialized view always expire at the same time than " +
|
||||||
"the corresponding data in the parent table.");
|
"the corresponding data in the parent table. default_time_to_live " +
|
||||||
|
"must be set to zero, see CASSANDRA-12868 for more information");
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewMetadata newView = view.copy(view.metadata.withSwapped(params));
|
ViewMetadata newView = view.copy(view.metadata.withSwapped(params));
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ import com.datastax.driver.core.Row;
|
||||||
import org.apache.cassandra.db.Keyspace;
|
import org.apache.cassandra.db.Keyspace;
|
||||||
import org.apache.cassandra.utils.FBUtilities;
|
import org.apache.cassandra.utils.FBUtilities;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test class was too large and used to timeout CASSANDRA-16777. We're splitting it into:
|
* This test class was too large and used to timeout CASSANDRA-16777. We're splitting it into:
|
||||||
* - ViewTest
|
* - ViewTest
|
||||||
|
|
@ -285,16 +287,23 @@ public class ViewTimesTest extends ViewAbstractTest
|
||||||
"c int, " +
|
"c int, " +
|
||||||
"val int) WITH default_time_to_live = 60");
|
"val int) WITH default_time_to_live = 60");
|
||||||
|
|
||||||
|
execute("USE " + keyspace());
|
||||||
|
executeNet("USE " + keyspace());
|
||||||
|
|
||||||
createView("mv_ttl2", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE k IS NOT NULL AND c IS NOT NULL PRIMARY KEY (k,c)");
|
createView("mv_ttl2", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE k IS NOT NULL AND c IS NOT NULL PRIMARY KEY (k,c)");
|
||||||
|
|
||||||
// Must NOT include "default_time_to_live" on alter Materialized View
|
// Must NOT include "default_time_to_live" on alter Materialized View
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
executeNet("ALTER MATERIALIZED VIEW %s WITH default_time_to_live = 30");
|
executeNet("ALTER MATERIALIZED VIEW " + keyspace()+ ".mv_ttl2 WITH default_time_to_live = 30");
|
||||||
Assert.fail("Should fail if TTL is provided while altering materialized view");
|
Assert.fail("Should fail if TTL is provided while altering materialized view");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
// Make sure the message is clear. See CASSANDRA-16960
|
||||||
|
assertEquals("Forbidden default_time_to_live detected for a materialized view. Data in a materialized view always expire at the same time than the corresponding "
|
||||||
|
+ "data in the parent table. default_time_to_live must be set to zero, see CASSANDRA-12868 for more information",
|
||||||
|
e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue