Skip to content

fix: resolve various db2 issues - #14453

Merged
WikiRik merged 45 commits into
mainfrom
ephys/db2-debug-please-ignore
Jun 15, 2022
Merged

WikiRik merged 45 commits into
mainfrom
ephys/db2-debug-please-ignore

Conversation

@ephys

@ephys ephys commented Apr 26, 2022 •

Copy link
Copy Markdown
Member

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

ephys commented Jun 13, 2022 •

Copy link
Copy Markdown
Member Author

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

WikiRik commented Jun 14, 2022

Copy link
Copy Markdown
Member

@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

ephys commented Jun 14, 2022

Copy link
Copy Markdown
Member Author

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

Comment thread src/dialects/db2/query-interface.js Resolved
Comment thread src/dialects/db2/query-interface.js Resolved
@ephys
ephys requested a review from WikiRik June 15, 2022 08:16
WikiRik
WikiRik previously approved these changes Jun 15, 2022
Comment thread src/dialects/db2/query-interface.js 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
Copy Markdown
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 DEPRECATED: replace with the "bug" issue type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants