-
Notifications
You must be signed in to change notification settings - Fork 605
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
spanner: Transaction was aborted. It was wounded by a higher priority transaction due to conflict on keys in range #2176
Comments
when i change select by userId (primary key) Condition everything is ok |
I am amused by "it was wounded" as part of the error message. :-p My best assessment here is that this is the API working in the way it is supposed to work. Think about transactions: they are concurrent groups of reads and writes on the same data. If you are running concurrent transactions on the same data and the database can not figure out how to resolve the conflict, then you are going to get an error like the one you see here. If you think this is still a bug, I recommend opening a ticket with the support for the API itself. This repository is for the client library specifically, but you are getting a backend API error. |
@lukesneeringer I open one transaction by - database.runTransaction((err, tx)
what you meen by groups? inside two transaction i read and write difference records you can see this in log (there are difference userId) when i select by eMail - spanner start look all records in transaction and that this may be the cause??? Thank you |
According this spanner must resolve:
|
@Chipintoza You are right. The client should retry on such errors and they should not be propagated up to the user. |
@lukesneeringer wounded refers to the standards "wound and wait" algorithm used by Cloud Spanner to resolve deadlocks: |
@callmehiphop irrespective of how we compute the backoff, we should still retry till the user specified deadline and after that we should fail with deadline exceeded rather than the abort error. |
@lukesneeringer i do not know what meens - priority: p2 I have one questions:
and secondary index
and i select record by: spanner will automatically look at index, take userId and give me a record ?. or i need to create
and first take userId by: and then i take a record by: Question is automatically use or not spanner secondary indices for standard select if condition match secondary index keys? Thank you |
You do not need to explicitly store userId in the index since spanner indexes contain all key columns. But you do need to add the FORCE_INDEX directive to your query. So your query would be:
This page talks more about indexes |
@callmehiphop @lukesneeringer Any updates here. I agree with @Chipintoza here that the whole point of |
@vkedia thank you very much |
I think Dave is still waiting on some info from @landrito: #2176 (comment) |
@vkedia actually I think it is retrying, however I'm guessing it was assumed that the retry info would be available from gRPC (which it is not) and I did not know that we would need to throw a different error after the deadline was exceeded. We need some changes to this code for sure, however if retry info is coming to gRPC soon then I'd think that we could punt on this. |
Tank you, @stephenplusplus @vkedia |
Environment details
"@google-cloud/spanner":"^0.3.0",
"@google-cloud/datastore":"^0.7.0",
I have Users Table:
first i check user on database and then do upsert
When i call many requests at same time - a Error occurs:
Error occurred on sometime on - select sometime on - commit
log:
when selecting - "userId":"140da3b6-f213-4627-938a-d3b93f6f101f"
error is:
conflict on keys in range [[889df848-9a2e-4ed9-8126-a45c0c33a101], [889df848-9a2e-4ed9-8126-a45c0c33a101]), column isActive in table users
if i remove
tx.run(
SELECT * FROM ${tableName} WHERE eMail = '${user.eMail}' AND isActive = TRUE
,(err, rows) =>
everything is ok
Thank you
The text was updated successfully, but these errors were encountered: