Spanner: Prevents Conflict from having the same database name#4417
Closed
chemelnucfin wants to merge 1 commit intogoogleapis:masterfrom
Closed
Spanner: Prevents Conflict from having the same database name#4417chemelnucfin wants to merge 1 commit intogoogleapis:masterfrom
chemelnucfin wants to merge 1 commit intogoogleapis:masterfrom
Conversation
dhermes
reviewed
Nov 18, 2017
| 'test_read_w_index', ddl_statements=DDL_STATEMENTS + EXTRA_DDL, | ||
| pool=pool) | ||
| operation = temp_db.create() | ||
| if not temp_db.exists(): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Contributor
Author
|
You are right, I wasn't thinking about race conditions, since it was just a test, but only locally
where I was reusing the same name. Should just close this issue or try to deal with the race conditions?
Thanks.
…On Sat, Nov 18, 2017, 1:45 PM Danny Hermes ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In spanner/tests/system/test_system.py
<#4417 (comment)>
:
> @@ -845,12 +845,11 @@ def test_read_w_index(self):
temp_db = Config.INSTANCE.database(
'test_read_w_index', ddl_statements=DDL_STATEMENTS + EXTRA_DDL,
pool=pool)
- operation = temp_db.create()
+ if not temp_db.exists():
@chemelnucfin <https://github.com/chemelnucfin> This won't help
contention, because if it exists, then (at least) two tests would be trying
to modify the same database.
You'd be better of just failing the test if temp_db.exists(). (Even this
is not quite sufficient due to race conditions.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4417 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADzDDB_eZB-F1a6dKHs4xlFPIuTcAVG3ks5s30_kgaJpZM4QjALB>
.
|
Contributor
Author
|
Closing in favor of #4435 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Somehow this conflict occurs occasionally. I might have created another temp_db database while working on the tests.
This PR guards against it.