cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject cassandra-dtest git commit: Drop table should remove corresponding entries in dropped_columns table
Date Thu, 03 Aug 2017 13:32:25 GMT
Repository: cassandra-dtest
Updated Branches:
  refs/heads/master 55c4ca8bd -> 7e3bcfd52


Drop table should remove corresponding entries in dropped_columns table

patch by Zhao Yang; reviewed by Aleksey Yeschenko for CASSANDRA-13730


Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/7e3bcfd5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/7e3bcfd5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/7e3bcfd5

Branch: refs/heads/master
Commit: 7e3bcfd52fbc926b4c43e258a7e0efa19e1ca13d
Parents: 55c4ca8
Author: Zhao Yang <zhaoyangsingapore@gmail.com>
Authored: Sun Jul 30 11:54:29 2017 +0800
Committer: Aleksey Yeschenko <aleksey@yeschenko.com>
Committed: Thu Aug 3 14:31:47 2017 +0100

----------------------------------------------------------------------
 snapshot_test.py | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7e3bcfd5/snapshot_test.py
----------------------------------------------------------------------
diff --git a/snapshot_test.py b/snapshot_test.py
index 563af81..1aa5a70 100644
--- a/snapshot_test.py
+++ b/snapshot_test.py
@@ -115,6 +115,40 @@ class TestSnapshot(SnapshotTester):
 
         self.assertEqual(rows[0][0], 100)
 
+    @since('3.0')
+    def test_snapshot_and_restore_drop_table_remove_dropped_column(self):
+        """
+        @jira_ticket CASSANDRA-13730
+
+        Dropping table should clear entries in dropped_column table
+        """
+        cluster = self.cluster
+        cluster.populate(1).start()
+        node1, = cluster.nodelist()
+        session = self.patient_cql_connection(node1)
+
+        # Create schema and insert some data
+        create_ks(session, 'ks', 1)
+        session.execute("CREATE TABLE ks.cf (k int PRIMARY KEY, a text, b text)")
+        session.execute("INSERT INTO ks.cf (k, a, b) VALUES (1, 'a', 'b')")
+        assert_one(session, "SELECT * FROM ks.cf", [1, "a", "b"])
+
+        # Take a snapshot and drop the column and then drop table
+        snapshot_dir = self.make_snapshot(node1, 'ks', 'cf', 'basic')
+        session.execute("ALTER TABLE ks.cf DROP b")
+        assert_one(session, "SELECT * FROM ks.cf", [1, "a"])
+        session.execute("DROP TABLE ks.cf")
+
+        # Restore schema and data from snapshot, data should be the same as input
+        self.restore_snapshot_schema(snapshot_dir, node1, 'ks', 'cf')
+        self.restore_snapshot(snapshot_dir, node1, 'ks', 'cf')
+        node1.nodetool('refresh ks cf')
+        assert_one(session, "SELECT * FROM ks.cf", [1, "a", "b"])
+
+        # Clean up
+        debug("removing snapshot_dir: " + snapshot_dir)
+        shutil.rmtree(snapshot_dir)
+
     @since('3.11')
     def test_snapshot_and_restore_dropping_a_column(self):
         """


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message