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

Fix concurrency issue in createTableIfNotExists (DynamoDB adapter) #118

Conversation

DannyRyman
Copy link
Contributor

During concurrent operations there is no guarantee that a table is not created between checking it's existance (using describeTable) and making the call to create the table. Currently, when this happens, it is erroring out with the 'Cannot create preexisting table' error.

Even ensuring that the init promise is resolved before calling it again is not enough because the call to describeTable is eventually consistent.

The fix is to swallow the error when the table already exists. At the end of the day, the system is in the state that we want it to be anyway (the table exists).

During concurrent operations there is no guarantee that a table is not
created between checking it's existance (using describeTable) and making
the call to create the table. Currently, when this happens, it is
erroring out with the 'Cannot create preexisting table' error.

Even ensuring that the init promise is resolved before calling it again
is not enough because the call to describeTable is eventually
consistent.

The fix is to swallow the error when the table already exists. At the
end of the day, the system is in the state that we want it to be anyway
(the table exists).
@DannyRyman DannyRyman changed the title Fix concurrency issue in createTableIfNotExists Fix concurrency issue in createTableIfNotExists (DynamoDB adapter) Dec 28, 2017
@adrai adrai merged commit 7b460dd into thenativeweb:master Dec 28, 2017
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