Skip to content

Improve metadata bwc tests #352

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 8 commits into
base: master
Choose a base branch
from
Open

Conversation

jeeminso
Copy link
Contributor

@jeeminso jeeminso commented May 12, 2025

Summary of the changes / Why this is an improvement

Originate from #341. Adds metadata rolling upgrade tests - privileges, views, default expressions, generated columns and constraints. Also partitioned table with aforementioned columns and table/partition versions.

Checklist

  • Link to issue this PR refers to (if applicable): Fixes #???

c.execute("INSERT INTO doc.t1 (title, author, o) VALUES ('prefix_check', {\"dyn_empty_array\" = []}, {\"dyn_ignored_subcol\" = 'hello'})")

if int(path.from_version.split('.')[0]) >= 5:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constraint causes a syntax error and the create fails, iirc 4.6.

@@ -148,8 +161,13 @@ def _test_rolling_upgrade(self, path, nodes):
# Run a query as a user created on an older version (ensure user is read correctly from cluster state, auth works, etc)
with connect(cluster.node().http_url, username='arthur', password='secret', error_trace=True) as custom_user_conn:
c = custom_user_conn.cursor()
wait_for_active_shards(c, expected_active_shards)
wait_for_active_shards(c)
Copy link
Contributor Author

@jeeminso jeeminso May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behaviour change starting 5.6. With deny dql on table doc.t1 to arthur, arthur cannot see t1 anymore -> cannot wait for t1 to be active anymore.

We could add version dependent behaviours or simply wait for all shards to be active.

@jeeminso jeeminso requested a review from matriv May 13, 2025 01:57
Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx!

I know that the purpose is to test the metadata but what do you think about testing the constraint, the generated & default cols for their values as well?

Additionally, I think we should check the same cols on a partitioned table as well.

Please also check the test_upgrade to see if we have any duplicate testing, I see we also have users/privileges there and a parted table with a generated col.

@jeeminso
Copy link
Contributor Author

jeeminso commented May 13, 2025

Thanks for the pointers @matriv.

I took a look at 3df0642 which does overlaps with my commit in terms of testing user persistence. But I think we need to move the test to rolling upgrades in order to also test that the privileges do continue to behave as expected in a mixed cluster.

BTW, I did not parted table with generated cols in test_upgrade.

I will add the same test for parted tables and also test the values, too.

c.execute("refresh table t2")
c.execute(f"select a, b, c>=1 and c<=2, d>a+b from doc.t2 where a = {idx}")
self.assertEqual(c.fetchall(), [[idx, idx, True, True]])
if int(path.from_version.split('.')[1]) >= 4:
Copy link
Contributor Author

@jeeminso jeeminso May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if int(path.from_version.split('.')[1]) >= 4: is needed because there are a few bugs that are fixed in later releases so it cannot be merged with existing parted table and tested for version older than 5.4.

@jeeminso jeeminso marked this pull request as ready for review May 13, 2025 23:31
@jeeminso jeeminso requested a review from matriv May 14, 2025 01:58
@jeeminso
Copy link
Contributor Author

Hi @matriv I am trying cover everything mentioned except publications, subscriptions and FDW. Please check for updates.

old_version = '.'.join(map(str, node.version))
c.execute("select distinct(version['created']) from information_schema.tables where table_name = 't2'")
self.assertEqual(c.fetchall(), [[old_version]])
if int(path.from_version.split('.')[1]) >= 9:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After all nodes are upgraded, newly added partitions' versions follow the newer version, starting 5.9.

@@ -28,14 +30,6 @@
)

ROLLING_UPGRADES_V5 = (
UpgradePath('5.0.x', '5.1.x'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change.

Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'd kindly ask for @mfussenegger to take a look at it as well, though

@matriv matriv requested a review from mfussenegger May 14, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants