Skip to content

Add upgrade test to ensure oid-less doc references load correctly #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
51 changes: 51 additions & 0 deletions tests/bwc/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,3 +566,54 @@ def test_snapshot_compatibility(self):
self._process_on_stop()
prev_version = version
num_snapshot += 1

class PreOidsFetchValueTest(NodeProvider, unittest.TestCase):

def test_pre_oid_references(self):
cluster = self._new_cluster('5.4.x', 3)
cluster.start()

with connect(cluster.node().http_url, error_trace=True) as conn:
c = conn.cursor()
c.execute("create table tbl (a text, b text) partitioned by (a)")
c.execute("insert into tbl (a, b) values ('foo1', 'bar1')")

for idx, node in enumerate(cluster):
new_node = self.upgrade_node(node, '5.8.5')
cluster[idx] = new_node

with connect(cluster.node().http_url, error_trace=True) as conn:
c = conn.cursor()
c.execute("alter table tbl add column c text")
c.execute("insert into tbl (a, b, c) values ('foo1', 'bar2', 'baz2')")
c.execute("insert into tbl (a, b, c) values ('foo2', 'bar1', 'baz1')")

for idx, node in enumerate(cluster):
new_node = self.upgrade_node(node, '5.9.x')
cluster[idx] = new_node

with connect(cluster.node().http_url, error_trace=True) as conn:
c = conn.cursor()
c.execute("insert into tbl (a, b, c) values ('foo1', 'bar3', 'baz3')")
c.execute("insert into tbl (a, b, c) values ('foo2', 'bar2', 'baz2')")
c.execute("insert into tbl (a, b, c) values ('foo3', 'bar1', 'baz1')")

for idx, node in enumerate(cluster):
new_node = self.upgrade_node(node, '5.10')
cluster[idx] = new_node

with connect(cluster.node().http_url, error_trace=True) as conn:
c = conn.cursor()
c.execute("insert into tbl (a, b, c) values ('foo1', 'bar4', 'baz4')")
c.execute("insert into tbl (a, b, c) values ('foo2', 'bar3', 'baz3')")
c.execute("insert into tbl (a, b, c) values ('foo3', 'bar2', 'baz2')")
c.execute("insert into tbl (a, b, c) values ('foo4', 'bar1', 'baz1')")

c.execute("refresh table tbl")

# LIMIT 10 forces the engine to go via _doc, which triggers the bug
# fixed by https://github.com/crate/crate/pull/17819
c.execute("select b from tbl limit 10")
result = c.fetchall()
for row in result:
self.assertIsNotNone(row[0])