Add test verifying that a schema propagation adding a view over a non existing table doesn't prevent a node from start
patch by Andres de la Peña; reviewed by Jake Luciani for CASSANDRA-13737 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/95920874 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/95920874 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/95920874 Branch: refs/heads/master Commit: 959208749d70e5808aec144e87b73e90d56a7f91 Parents: 7e3bcfd Author: AndreÌs de la PenÌa <a.penya.gar...@gmail.com> Authored: Tue Aug 8 10:01:15 2017 +0100 Committer: AndreÌs de la PenÌa <a.penya.gar...@gmail.com> Committed: Tue Aug 8 10:01:15 2017 +0100 ---------------------------------------------------------------------- materialized_views_test.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/95920874/materialized_views_test.py ---------------------------------------------------------------------- diff --git a/materialized_views_test.py b/materialized_views_test.py index 306d719..77b20e6 100644 --- a/materialized_views_test.py +++ b/materialized_views_test.py @@ -1532,6 +1532,41 @@ class TestMaterializedViews(Tester): session.execute("DROP MATERIALIZED VIEW mv") session.execute("DROP TABLE test") + def propagate_view_creation_over_non_existing_table(self): + """ + The internal addition of a view over a non existing table should be ignored + @jira_ticket CASSANDRA-13737 + """ + + cluster = self.cluster + cluster.populate(3) + cluster.start() + node1, node2, node3 = self.cluster.nodelist() + session = self.patient_cql_connection(node1, consistency_level=ConsistencyLevel.QUORUM) + create_ks(session, 'ks', 3) + + session.execute('CREATE TABLE users (username varchar PRIMARY KEY, state varchar)') + + # create a materialized view only in nodes 1 and 2 + node3.stop(wait_other_notice=True) + session.execute(('CREATE MATERIALIZED VIEW users_by_state AS ' + 'SELECT * FROM users WHERE state IS NOT NULL AND username IS NOT NULL ' + 'PRIMARY KEY (state, username)')) + + # drop the base table only in node 3 + node1.stop(wait_other_notice=True) + node2.stop(wait_other_notice=True) + node3.start(wait_for_binary_proto=True) + session = self.patient_cql_connection(node3, consistency_level=ConsistencyLevel.QUORUM) + session.execute('DROP TABLE ks.users') + + # restart the cluster + cluster.stop() + cluster.start() + + # node3 should have received and ignored the creation of the MV over the dropped table + self.assertTrue(node3.grep_log('Not adding view users_by_state because the base table')) + # For read verification class MutationPresence(Enum): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org