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

Adding skiplocked support #9197

Merged
merged 6 commits into from May 2, 2018
Merged

Conversation

@joshuacullen
Copy link
Contributor

@joshuacullen joshuacullen commented Mar 18, 2018

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

#8910
Adding SKIP LOCKED to lock queries.

Where should I write tests for this?
Where would you like the docs?

@joshuacullen joshuacullen force-pushed the joshuacullen:skip-locked branch from 66597e1 to dc700c5 Mar 18, 2018
@codecov
Copy link

@codecov codecov bot commented Mar 18, 2018

Codecov Report

Merging #9197 into master will decrease coverage by 9.96%.
The diff coverage is 50%.

@sushantdhiman
Copy link
Contributor

@sushantdhiman sushantdhiman commented Mar 20, 2018

You can add integration tests in this file

describe('row locking', () => {

You can add an example of this option here

If you want you can improve docs further as there is no dedicated section for locks, a subsection about locks in transaction docs will be really nice, but not required to merge this PR

@joshuacullen
Copy link
Contributor Author

@joshuacullen joshuacullen commented Mar 20, 2018

Great thanks.

I'll take a look this weekend.

@joshuacullen joshuacullen force-pushed the joshuacullen:skip-locked branch 2 times, most recently from b095143 to 26df8a5 Apr 2, 2018
@joshuacullen
Copy link
Contributor Author

@joshuacullen joshuacullen commented Apr 2, 2018

Added tests and some simple docs

return User.findAll({
limit: 1,
lock: true,
skipLocked: true,

This comment has been minimized.

@sushantdhiman

sushantdhiman Apr 11, 2018
Contributor

In first transaction there is no need to skip locks, I assume all rows are free at this time.

return Promise.all([
t1.commit(),
t2.commit()
])

This comment has been minimized.

@sushantdhiman

sushantdhiman Apr 11, 2018
Contributor

Missing semi colon failing tests

@sushantdhiman
Copy link
Contributor

@sushantdhiman sushantdhiman commented Apr 11, 2018

You need to add a skip lock example here

@@ -219,3 +219,26 @@ sequelize.transaction({
The `transaction` option goes with most other options, which are usually the first argument of a method.
For methods that take values, like `.create`, `.update()`, `.updateAttributes()` etc. `transaction` should be passed to the option in the second argument.
If unsure, refer to the API documentation for the method you are using to be sure of the signature.

## Locks

This comment has been minimized.

@sushantdhiman

sushantdhiman Apr 11, 2018
Contributor

Can improve this by adding more examples from here

Copy link
Contributor

@sushantdhiman sushantdhiman left a comment

A few changes otherwise looks good

@joshuacullen
Copy link
Contributor Author

@joshuacullen joshuacullen commented Apr 29, 2018

@sushantdhiman Pushed some changes for the above

username: Support.Sequelize.STRING,
awesome: Support.Sequelize.BOOLEAN
}),
self = this;

This comment has been minimized.

@sushantdhiman

sushantdhiman Apr 29, 2018
Contributor

remove self = this, it should not be required with arrow functions

Copy link
Contributor

@sushantdhiman sushantdhiman left a comment

Tests for MySQL case are failing for incorrect SQL

@joshuacullen
Copy link
Contributor Author

@joshuacullen joshuacullen commented Apr 30, 2018

Okay cool, will have a look. Looks like skip locked is only available in MYSQL 8.

I'll remove for mysql and fix up tomorrow.

@joshuacullen joshuacullen force-pushed the joshuacullen:skip-locked branch 3 times, most recently from 9a34b60 to 554783b May 1, 2018
@joshuacullen joshuacullen force-pushed the joshuacullen:skip-locked branch from 554783b to f0fc268 May 1, 2018
@joshuacullen
Copy link
Contributor Author

@joshuacullen joshuacullen commented May 1, 2018

@sushantdhiman Removed support for mysql

@sushantdhiman sushantdhiman merged commit 7b16308 into sequelize:master May 2, 2018
4 checks passed
4 checks passed
codecov/patch 100% of diff hit (target 95.94%)
Details
codecov/project 95.94% (+<.01%) compared to 2752bf7
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
gabegorelick added a commit to gabegorelick/sequelize that referenced this pull request Aug 27, 2019
This was added in sequelize#9197 but not added to the docs for `findAll`.
@gabegorelick gabegorelick mentioned this pull request Aug 27, 2019
5 of 6 tasks complete
gabegorelick added a commit to gabegorelick/sequelize that referenced this pull request Aug 28, 2019
This was added in sequelize#9197 but not added to the docs for `findAll`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants