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

Bug #1308016: Duplicate UK values in READ-COMMITTED (again) #83

Merged
merged 1 commit into from May 26, 2015

Conversation

Projects
None yet
1 participant
@akopytov
Contributor

akopytov commented May 26, 2015

The problem was with lock_rec_inherit_to_gap(() assuming that only
shared record locks can be set by a consistency constraint and thus,
only that type of locks should be inherited in the gap mode when an
index record is delete.

However, REPLACE, LOAD DATA REPLACE and INSERT ON DUPLICATE KEY UPDATE
set exclusive record locks. So when a record was deleted by purge, all
record locks acquired by in-progress concurrent statements of those
types were lost which might lead to a UK constraint violation.

Fixed by changing lock_rec_inherit_to_gap() to take trx_t::duplicates
into account. When it ha a non-zero value (i.e. TRX_DUP_IGNORE or
TRX_DUP_REPLACE), exclusive rather than shared locks are now inherited as
gap locks.

Bug #1308016: Duplicate UK values in READ-COMMITTED (again)
The problem was with lock_rec_inherit_to_gap(() assuming that only
shared record locks can be set by a consistency constraint and thus,
only that type of locks should be inherited in the gap mode when an
index record is delete.

However, REPLACE, LOAD DATA REPLACE and INSERT ON DUPLICATE KEY UPDATE
set exclusive record locks. So when a record was deleted by purge, all
record locks acquired by in-progress concurrent statements of those
types were lost which might lead to a UK constraint violation.

Fixed by changing lock_rec_inherit_to_gap() to take trx_t::duplicates
into account. When it ha a non-zero value (i.e. TRX_DUP_IGNORE or
TRX_DUP_REPLACE), exclusive rather than shared locks are now inherited as
gap locks.
@akopytov

This comment has been minimized.

Show comment
Hide comment

akopytov added a commit that referenced this pull request May 26, 2015

Merge pull request #83 from akopytov/5.6
Bug #1308016: Duplicate UK values in READ-COMMITTED (again)

@akopytov akopytov merged commit 50b4f9e into percona:5.6 May 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment