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

fix: resolve various db2 issues #14453

Merged
merged 45 commits into from Jun 15, 2022
Merged

fix: resolve various db2 issues #14453

merged 45 commits into from Jun 15, 2022

Conversation

ephys
Copy link
Member

@ephys ephys commented Apr 26, 2022

This PR (hopefully) fixes the underlying issue that caused DB2 tests to be flaky: Db2Query was silencing errors emitted by DB2 in an attempt to fix them automatically.

This PR removes that. It appears the flakiness is gone, and this PR fixes the issues that were hidden by that behavior.

List of fixed issues:

  • DB2's Db2Query muted errors. This has been removed.
  • DB2's createTable used CREATE TABLE instead of CREATE TABLE IF NOT EXISTS (like the other dialects did)
  • DB2's dropTable used DROP TABLE instead of DROP TABLE IF EXISTS (like the other dialects did)

The rest of the changes are adapting the tests to make them work properly with db2.


There is one change we may want to preserve:

in db2, an "ALTER TABLE" query will cause the table to be put in "reorg pending state"
and subsequent "ALTER TABLE" queries on said table will fail with code 7.
The user either needs to wait for the reorg to happen, or CALL SYSPROC.ADMIN_CMD('REORG TABLE tablename') must be executed.

This REORG TABLE operation was done in Db2Query. Do we want to preserve it?


  • Research what to do with REORG TABLE
  • Research what to do with ERRORSCHEMA.ERRORTABLE
  • (test suite) only run CREATE TABLESPACE SYSTOOLSPACE if the tablespace does not exist

@WikiRik

This comment was marked as outdated.

@ephys

This comment was marked as outdated.

@WikiRik

This comment was marked as outdated.

@ephys

This comment was marked as outdated.

@ephys

This comment was marked as outdated.

@ephys ephys force-pushed the ephys/db2-debug-please-ignore branch from 946687f to 4c9c546 Compare April 26, 2022 12:56
@ephys

This comment was marked as outdated.

@ephys

This comment was marked as outdated.

@ephys

This comment was marked as outdated.

@ephys

This comment was marked as outdated.

@ephys

This comment was marked as outdated.

@ephys
Copy link
Member Author

ephys commented Jun 13, 2022

I've changed how deleting ERRORSCHEMA.ERRORTABLE is handled. It's handled by dropSchema if db2 signals that it has been created. It also uses a serial number in the table name to prevent to concurrent calls to dropSchema from using the same error table.

I've also re-added forced table reorg inside queryInterface, instead of tests (note that before it was in Db2Query but I believe queryInterface should be the "smart" API, and sequelize.query the barebone API that doesn't try to be smarter than you).

Only finger crossing left to be done

@WikiRik
Copy link
Member

WikiRik commented Jun 14, 2022

@ephys can you check out the failed tests? I think they are due to this PR

@ephys ephys requested review from WikiRik and sdepold June 14, 2022 18:15
@ephys
Copy link
Member Author

ephys commented Jun 14, 2022

Hmm that's annoying. ADMIN_DROP_SCHEMA is failing on that test with error

-911 THE CURRENT UNIT OF WORK HAS BEEN ROLLED BACK DUE TO DEADLOCK OR TIMEOUT. REASON reason-code, TYPE OF RESOURCE resource-type, AND RESOURCE NAME resource-name

https://www.ibm.com/docs/en/db2-for-zos/11?topic=codes-911

src/dialects/db2/query-interface.js Outdated Show resolved Hide resolved
src/dialects/db2/query-interface.js Outdated Show resolved Hide resolved
@ephys ephys requested a review from WikiRik June 15, 2022 08:16
WikiRik
WikiRik previously approved these changes Jun 15, 2022
src/dialects/db2/query-interface.js Show resolved Hide resolved
@WikiRik WikiRik merged commit 5055357 into main Jun 15, 2022
@WikiRik WikiRik deleted the ephys/db2-debug-please-ignore branch June 15, 2022 13:23
@github-actions
Copy link
Contributor

🎉 This PR is included in version 7.0.0-alpha.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialect: db2 For issues and PRs. Things that involve db2 (and do not involve all dialects). released on @v7 type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants