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

MVCC sometimes loses gap record #8326

Closed
alyapunov opened this issue Feb 15, 2023 · 0 comments · Fixed by #8665
Closed

MVCC sometimes loses gap record #8326

alyapunov opened this issue Feb 15, 2023 · 0 comments · Fixed by #8665
Assignees
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working

Comments

@alyapunov
Copy link
Contributor

Simple reproduce:

box.cfg{memtx_use_mvcc_engine = true}

s = box.schema.space.create('test')
s:create_index('pk', {parts = {{1, 'uint'}, {2, 'uint'}}})

txn_proxy = require('txn_proxy')

tx1 = txn_proxy.new()
tx2 = txn_proxy.new()

tx1:begin()
tx2:begin()

tx1('s:select{1}') -- select by partial key {1}, empty result
tx1('s:replace{1, 1, 1}') -- write right to selected interval

tx2('s:replace{1, 1, 2}') -- overwrite by the second transaction
tx2:commit() -- ok, now tx1 must become conflicted because of the first select

tx1:commit() -- must fail, but it succeeds
s:select{1} -- must have {1, 1, 2}, but it's {1, 1, 1}
@alyapunov alyapunov added the bug Something isn't working label Feb 15, 2023
@alyapunov alyapunov self-assigned this Feb 15, 2023
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 16, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong desision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Fix it, reverting the prevous changes and add a test.

Closes tarantool#8326

NO_DOC=bugfix
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 17, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Fix it, reverting the previous changes and add a test.

Closes tarantool#8326

NO_DOC=bugfix
@kyukhin kyukhin added the 2.10 Target is 2.10 and all newer release/master branches label May 17, 2023
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 7, 2023
Co-authored-by: Pavel Semyonov <p.semyonov@vk.team>
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 7, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Fix it, reverting the previous changes and add a test.

Closes tarantool#8326

NO_DOC=bugfix
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 8, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Fix it, reverting the previous changes and add a test.

Closes tarantool#8326

NO_DOC=bugfix
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 14, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes tarantool#8326

NO_DOC=bugfix
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 21, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes tarantool#8326

NO_DOC=bugfix
alyapunov added a commit that referenced this issue Jun 21, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes #8326

NO_DOC=bugfix
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 21, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes tarantool#8326

NO_DOC=bugfix

(cherry picked from commit b41c454)
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 21, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes tarantool#8326

NO_DOC=bugfix

(cherry picked from commit b41c454)
alyapunov added a commit that referenced this issue Jun 22, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes #8326

NO_DOC=bugfix

(cherry picked from commit b41c454)
alyapunov added a commit to alyapunov/tarantool that referenced this issue Jun 23, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes tarantool#8326

NO_DOC=bugfix

(cherry picked from commit b41c454)
alyapunov added a commit that referenced this issue Jun 23, 2023
By a mistake in 8a56514 a shortcut was added to procedure
that handles gap write: it was considered that if the writing
transaction is the same as reading - there is no actual conflict
that must be stored further. That was a wrong decision: if such
a transaction yields and another transaction comes and commits
a value with the same key - the first one must go to conflicted
state since it has read no more possible state.

Another similar mistake was made in e6f5090, where writing
after full scan of the same transaction was not tracked as read.
Obviously that was wrong: if some other transaction overwrites
the key and commits - this transaction must go to read view since
it did not see anything by this key which is not so anymore.

Fix it, reverting the first commit and an modifying the second and
add a test.

Closes #8326

NO_DOC=bugfix

(cherry picked from commit b41c454)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants