Skip to content

fix(sequelize/query): retry entire query - #8991

Merged
sushantdhiman merged 5 commits into
masterfrom
reconnect-bug
Feb 6, 2018
Merged

sushantdhiman merged 5 commits into
masterfrom
reconnect-bug

Conversation

@sushantdhiman

@sushantdhiman sushantdhiman commented Feb 3, 2018 •

Copy link
Copy Markdown
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

  1. Wraps the entire query process in retry, instead of just the query.
  2. Failed queries will yield the connection back to the pool, and request another one on the next retry
    This allows the retry functionality to work with the pool reconnect functionality 💯

Continued from #8961

Closes #2113
Closes #8022
Closes #8014

Comment thread test/unit/query.test.js
@@ -1,37 +0,0 @@
'use strict';

@sushantdhiman sushantdhiman Feb 3, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As noted in original PR this test was added to ensure connection is only released once and there is no Resource not currently part of this pool error.

Now each retry fetch new connection so this test is not required. Also that error was already handled here

Comment thread lib/sequelize.js
}

if (this.test._trackRunningQueries) {
if (isFirstTry && this.test._trackRunningQueries) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not related to this PR but a possible fix for randomly failing tests due to tracking queries //cc @janmeier

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could very well be!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that would be awesome!

@sushantdhiman
sushantdhiman requested review from a team and janmeier February 3, 2018 13:38
@codecov

codecov Bot commented Feb 3, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #8991 into master will increase coverage by <.01%.
The diff coverage is 100%.

@yocontra

yocontra commented Feb 3, 2018

Copy link
Copy Markdown
Contributor

found one broken case here - retry-as-promised seems to start the timeout counter before any retries have happened, so if you try to run a really long query (lets say 120s) and you set the retry timeout for 60s it will fail with a timeout, even though 0 retries happened. seems like something that needs to be fixed in retry-as-promised.

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

found one broken case here - retry-as-promised seems to start the timeout counter before any retries have happened, so if you try to run a really long query (lets say 120s) and you set the retry timeout for 60s it will fail with a timeout, even though 0 retries happened. seems like something that needs to be fixed in retry-as-promised.

Current default timeout is undefined which means no timeout. But with timeout if there is such bug it should be fixed in https://github.com/mickhansen/retry-as-promised

@yocontra

yocontra commented Feb 5, 2018

Copy link
Copy Markdown
Contributor

@sushantdhiman Yep, understood where the fault lies - I think this can be merged without the fix, just wanted to mention it. I've opened the ticket there and will probably send a PR if I have time to mickhansen/retry-as-promised#14.

Comment thread lib/sequelize.js
}

if (this.test._trackRunningQueries) {
if (isFirstTry && this.test._trackRunningQueries) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could very well be!

@sushantdhiman
sushantdhiman merged commit 0cf1911 into master Feb 6, 2018
@sushantdhiman
sushantdhiman deleted the reconnect-bug branch February 6, 2018 03:32
@cladjules

Copy link
Copy Markdown

Great that is resolved :)
Do you know what version it's going to be released?

Thanks :)

@reiz

reiz commented Feb 6, 2018

Copy link
Copy Markdown

We need this fix ASAP :-) We are affected by this and looking forward to this fix!

@eseliger

eseliger commented Feb 6, 2018

Copy link
Copy Markdown
Member

mkaufmaner added a commit to mkaufmaner/sequelize that referenced this pull request Feb 19, 2018
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.

6 participants