Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions tests/bwc/test_rolling_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,43 @@ def _test_queries_on_new_node(self,
wait_for_active_shards(c, current_shards)
new_shards = 0

# Ensure table swaps work - the 4 swaps are equivalent to no swaps at all
if old_node.version >= (5, 6, 0):
c.execute("""
SELECT table_name, column_name, data_type
FROM information_schema.columns
WHERE table_schema = 'doc' AND table_name IN ('parted', 't1', 't3')
ORDER BY 1, 2
""")
columns = c.fetchall()
c.execute("""
SELECT table_name, number_of_shards, number_of_replicas
FROM information_schema.tables
WHERE table_schema = 'doc' AND table_name IN ('parted', 't1', 't3')
ORDER BY 1
""")
tables = c.fetchall()

c.execute("alter cluster swap table doc.parted to doc.t1")
c.execute("alter cluster swap table doc.t1 to doc.t3")
c.execute("alter cluster swap table doc.t3 to doc.parted")
c.execute("alter cluster swap table doc.t3 to doc.t1")

c.execute("""
SELECT table_name, column_name, data_type
FROM information_schema.columns
WHERE table_schema = 'doc' AND table_name IN ('parted', 't1', 't3')
ORDER BY 1, 2
""")
self.assertEqual(c.fetchall(), columns)
c.execute("""
SELECT table_name, number_of_shards, number_of_replicas
FROM information_schema.tables
WHERE table_schema = 'doc' AND table_name IN ('parted', 't1', 't3')
ORDER BY 1
""")
self.assertEqual(c.fetchall(), tables)

c.execute("select name from sys.users order by 1")
self.assertEqual(c.fetchall(), [["arthur"], ["crate"]])

Expand Down