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

driver: fix duplicate id error with mvvc on #211

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

better0fdead
Copy link
Contributor

@better0fdead better0fdead commented Jul 6, 2023

Taking the maximum of the index is an implicit transactions, so it is
always done with 'read-confirmed' mvcc isolation level.
It can lead to errors when trying to make parallel 'put' calls with mvcc enabled.
It is hapenning because 'max' for several puts in parallel will be the same since
read confirmed isolation level makes visible all transactions that finished the commit.
To fix it we wrap it with box.begin/commit and set right isolation level.
Current fix does not resolve that bug in situations when we already are in transaction
since it will open nested transactions.

Further work will be in another PR.
Part of #207

@better0fdead better0fdead force-pushed the better0fdead/gh-207-mvcc branch 3 times, most recently from 19fc693 to 2a5186b Compare July 10, 2023 10:09
queue/abstract/driver/fifo.lua Outdated Show resolved Hide resolved
queue/abstract/driver/fifo.lua Outdated Show resolved Hide resolved
queue/abstract/driver/fifo.lua Outdated Show resolved Hide resolved
@better0fdead better0fdead force-pushed the better0fdead/gh-207-mvcc branch 2 times, most recently from b617331 to fe3ddee Compare July 11, 2023 12:29
@better0fdead better0fdead force-pushed the better0fdead/gh-207-mvcc branch 2 times, most recently from 41a6c02 to fcb50b5 Compare July 27, 2023 12:30
oleg-jukovec added a commit to tarantool/sharded-queue that referenced this pull request Aug 10, 2023
By default idx:max() or idx:min() have read confirmed isolation level.
It could lead to a task duplication or double task take when we
already insert or update a task, commited, but it is not yet
confirmed.

See also:

1. tarantool/queue#207
2. tarantool/queue#211
oleg-jukovec added a commit to tarantool/sharded-queue that referenced this pull request Aug 10, 2023
By default idx:max() or idx:min() have read confirmed isolation level.
It could lead to a task duplication or double task take when we
already insert or update a task, commited, but it is not yet
confirmed.

See also:

1. tarantool/queue#207
2. tarantool/queue#211
oleg-jukovec added a commit to tarantool/sharded-queue that referenced this pull request Aug 10, 2023
By default idx:max() or idx:min() have read confirmed isolation level.
It could lead to a task duplication or double task take when we
already insert or update a task, commited, but it is not yet
confirmed.

See also:

1. tarantool/queue#207
2. tarantool/queue#211
Copy link
Contributor

@LeonidVas LeonidVas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thank you for the patchset.
See several comments bellow.

t/220-mvcc.t Outdated Show resolved Hide resolved
t/220-mvcc.t Outdated Show resolved Hide resolved
t/220-mvcc.t Outdated Show resolved Hide resolved
t/220-mvcc.t Outdated Show resolved Hide resolved
t/220-mvcc.t Outdated Show resolved Hide resolved
t/220-mvcc.t Outdated Show resolved Hide resolved
t/220-mvcc.t Outdated Show resolved Hide resolved
@better0fdead better0fdead force-pushed the better0fdead/gh-207-mvcc branch 3 times, most recently from 48214b9 to a65f81e Compare August 15, 2023 17:16
t/220-mvcc.t Outdated Show resolved Hide resolved
Taking the maximum or minimum of the index is an implicit transactions, so it is
always done with 'read-confirmed' mvcc isolation level.
It can lead to errors when trying to make parallel 'put' or 'take' calls with mvcc enabled.
It is hapenning because 'max' or 'min' for several puts in parallel will be the same since
read confirmed isolation level makes visible all transactions that finished the commit.
To fix it we wrap it with box.begin/commit and set right isolation level.
Current fix does not resolve that bug in situations when we already are in transaction
since it will open nested transactions.

Part of #207
@LeonidVas LeonidVas merged commit 0164ed4 into master Aug 16, 2023
23 checks passed
@LeonidVas LeonidVas deleted the better0fdead/gh-207-mvcc branch August 16, 2023 17:17
oleg-jukovec added a commit to tarantool/sharded-queue that referenced this pull request Sep 6, 2023
By default idx:max() or idx:min() have read confirmed isolation level.
It could lead to a task duplication or double task take when we
already insert or update a task, commited, but it is not yet
confirmed.

See also:

1. tarantool/queue#207
2. tarantool/queue#211
oleg-jukovec added a commit to tarantool/sharded-queue that referenced this pull request Sep 25, 2023
By default idx:max() or idx:min() have read confirmed isolation level.
It could lead to a task duplication or double task take when we
already insert or update a task, commited, but it is not yet
confirmed.

See also:

1. tarantool/queue#207
2. tarantool/queue#211
oleg-jukovec added a commit to tarantool/sharded-queue that referenced this pull request Oct 31, 2023
By default idx:max() or idx:min() have read confirmed isolation level.
It could lead to a task duplication or double task take when we
already insert or update a task, commited, but it is not yet
confirmed.

See also:

1. tarantool/queue#207
2. tarantool/queue#211
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.

5 participants