Skip to content

Conversation

@pixelspark
Copy link
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)? --> not applicable
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

While testing with CockroachDB as backend database, I encountered a strange situation where the version number used by Sequelize for optimistic locking is (correctly) stored as INT in the table, but is incremented as string, and ends up becoming "1111...". Eventually the version number becomes too large to fit an integer. The exact same code does not show the issue when using MySQL or SQLite as backend store.

This fix ensures that the version number is incremented as a number. It merely makes the existing desired behaviour explicit and should not change the behaviour for backends where it is already working correctly.

I am not sure about how I would go about adding tests for this - more research would be needed to see whether this is CockroachDB or maybe also PostgreSQL-specific. Adding a test suite for Cockroach would be a good idea but out of my reach for now (I barely know the Sequelize source code at this point).

This happens on CockroachDB, where the version is stored as INT in the table, but is incremented as string, and ends up becoming "1111...". Eventually the version number becomes too large to fit an integer.
@codecov
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #10217 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10217   +/-   ##
=======================================
  Coverage   96.34%   96.34%           
=======================================
  Files          63       63           
  Lines        9420     9420           
=======================================
  Hits         9076     9076           
  Misses        344      344
Impacted Files Coverage Δ
lib/model.js 96.77% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61a9b26...4051d4b. Read the comment docs.

@sushantdhiman sushantdhiman merged commit e4218a2 into sequelize:master Dec 3, 2018
@sushantdhiman
Copy link
Contributor

Thanks @pixelspark

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.

2 participants