Skip to content
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

Test dynamic column names in resultsets #344

Merged
merged 1 commit into from
Mar 24, 2025

Conversation

jeeminso
Copy link
Contributor

@jeeminso jeeminso commented Mar 13, 2025

Summary of the changes / Why this is an improvement

Adding a test for crate/crate#17580.

Checklist

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

@jeeminso jeeminso force-pushed the jeeminso/col-names-in-resultset branch 13 times, most recently from d3455f1 to b97275e Compare March 16, 2025 13:55
@jeeminso
Copy link
Contributor Author

Finally able to reproduce the bug scenario:

ERROR: test_upgrade_paths (test_upgrade.StorageCompatibilityTest.test_upgrade_paths)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 205, in _test_upgrade_path
    self._do_upgrade(cluster, nodes, paths, versions)
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/src/crate/qa/tests.py", line 363, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 266, in _do_upgrade
    self.assert_data_persistence(version_def, nodes, digest, paths, accumulated_dynamic_column_names)
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 328, in assert_data_persistence
    self.assertIn(name, accumulated_dynamic_column_names)
AssertionError: '16' not found in ['t_5_7_x', 't_5_9_11']  ** `16` must be the oid falsely returned instead of the column name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 186, in test_upgrade_paths
    self._test_upgrade_path(path, nodes=1)
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 219, in _test_upgrade_path
    raise Exception(msg).with_traceback(e.__traceback__)
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 205, in _test_upgrade_path
    self._do_upgrade(cluster, nodes, paths, versions)
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/src/crate/qa/tests.py", line 363, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 266, in _do_upgrade
    self.assert_data_persistence(version_def, nodes, digest, paths, accumulated_dynamic_column_names)
  File "/var/lib/jenkins/workspace/CrateDB/qa/crate_qa_on_pr/tests/bwc/test_upgrade.py", line 328, in assert_data_persistence
    self.assertIn(name, accumulated_dynamic_column_names)
2025-03-16T14:05:10 Start version: 5.4.x
2025-03-16T14:05:20 Upgrade to: 5.7.x
2025-03-16T14:05:27 Upgrade to: 5.9.11

@jeeminso jeeminso force-pushed the jeeminso/col-names-in-resultset branch 5 times, most recently from ed12232 to cfdae2e Compare March 17, 2025 07:52
@jeeminso jeeminso changed the title WIP Test dynamic column names in resultsets Mar 17, 2025
@jeeminso jeeminso force-pushed the jeeminso/col-names-in-resultset branch 4 times, most recently from e9ca59c to 0b8bd79 Compare March 17, 2025 10:04
@jeeminso
Copy link
Contributor Author

jeeminso commented Mar 17, 2025

0b8bd79 which picks up the fix passes https://jenkins.crate.io/job/CrateDB/job/qa/job/crate_qa_on_pr/563/execution/node/202/log/

102573c without the fix fails with AssertionError: '16' not found in ['t_5_7_x', 't_5_9_11'] https://jenkins.crate.io/job/CrateDB/job/qa/job/crate_qa_on_pr/559/execution/node/197/log/

Currently the version upgrades are limited to 5.4 > 5.7 > 5.9 to confirm the fix is valid.(Also there are many timeouts occurring...)

@jeeminso
Copy link
Contributor Author

Hi @mfussenegger could you take a look at this test before I start resolving the timeout errors(which will come back when I revert the temporarily removed changes)

@jeeminso jeeminso requested a review from mfussenegger March 17, 2025 10:16
@jeeminso jeeminso force-pushed the jeeminso/col-names-in-resultset branch 3 times, most recently from 92389b8 to 3017537 Compare March 21, 2025 09:53
@jeeminso jeeminso requested a review from matriv March 21, 2025 10:57
@jeeminso
Copy link
Contributor Author

Hi @matriv could you review this?

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.

Looks, good, thank you, left a comment.

cursor.execute('SELECT cols from doc.parted')
result = cursor.fetchall()
for row in result:
if row[0] is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't happen, right? wouldn't be better to remove the check and have it throw an error if the result is null?

Also, please do a REFRESH after the INSERT, to make sure that we test all the values for cols.

@jeeminso jeeminso force-pushed the jeeminso/col-names-in-resultset branch 2 times, most recently from 2a0787b to 77a718c Compare March 23, 2025 08:27
@jeeminso jeeminso marked this pull request as ready for review March 23, 2025 10:35
@jeeminso jeeminso requested a review from matriv March 23, 2025 22:36
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.

Thank you!

Copy link
Member

@mfussenegger mfussenegger left a comment

Choose a reason for hiding this comment

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

Isn't this going to stop producing the broken version because we had released a fix that caused it?

I'd think we'd need a dedicated version path that uses the broken version, and then moves to the newer ones which contain mitigations?

@jeeminso
Copy link
Contributor Author

Isn't this going to stop producing the broken version because we had released a fix that caused it?

For all tables created in 5.4.x that are upgraded to 5.7.x and executed an alter followed by add column will have the unwanted oids. So I think the current test will created the broken metadata and continue to test the mitigation is in place for upcoming releases.

@mfussenegger
Copy link
Member

Isn't this going to stop producing the broken version because we had released a fix that caused it?

For all tables created in 5.4.x that are upgraded to 5.7.x and executed an alter followed by add column will have the unwanted oids. So I think the current test will created the broken metadata and continue to test the mitigation is in place for upcoming releases.

Okay, I thought we had backported a fix to 5.7 that prevents that issue from happening?

@jeeminso
Copy link
Contributor Author

Okay, I thought we had backported a fix to 5.7 that prevents that issue from happening?

The fix is crate/crate#17178 and is only merged to 5.9. The commit that caused the corrupted createdVersion is crate/crate@5a3fa0f which exists since 4.8.

@jeeminso jeeminso force-pushed the jeeminso/col-names-in-resultset branch from 77a718c to 318a628 Compare March 24, 2025 17:12
@jeeminso jeeminso merged commit a5f3a3f into master Mar 24, 2025
1 check passed
@jeeminso jeeminso deleted the jeeminso/col-names-in-resultset branch March 24, 2025 18:39
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.

3 participants