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
[YSQL] unexpected transaction conflict errors during concurrent inserts on table with SERIAL column #1783
Comments
If I change primary key to (user_id, username) it does not fail. But there are duplicates in user_id:
|
Thx @spolitov . |
The docs further say that this doesn't automatically add a UNIQUE or NOT NULL constraint.
regards |
Per @hectorgcr : << seems to be a bug with |
Summary: `rescnt` needed to be set to `0` after the `retry` label in order for the code to increment `last` correctly. Without resetting `rescnt`, we were inserting the same last value into the sequences table. There was also an error in the where expression because we were not setting the `AND` operator. Test Plan: New java unit tests that concurrently inserts rows into a table with a serial type. This test verifies that there are not repeated sequence values. Reviewers: mihnea, mikhail, kannan, raju, neha Reviewed By: raju Subscribers: george, yql Differential Revision: https://phabricator.dev.yugabyte.com/D6911
[Tested on: yugabyte-1.2.12.0 release.]
The following test inserts unique rows (and in fact, unique values for columns that have a UNIQUE constraint) from two concurrent threads.
But running this program pretty much always errors out with one of these types of errors:
or
or
Test program:
The text was updated successfully, but these errors were encountered: