cockroach-go
cockroach-go copied to clipboard
Flexible retry backoff policies
Extends the existing retry limit mechanism to allow for delays between retries. Includes implementations for fixed delays and exponential backoff.
We haven’t implemented this because cockroachdb-go uses save point based retries and because of savepoint-based retries, a transaction can continue holding locks in between retries. So that means with exponential backoff, you'll be holding locks for longer, thus putting the app at even greater risk of contention.
If you could show us that this is not the case with backoffs, we will consider adding this! Thanks!
We haven’t implemented this because cockroachdb-go uses save point based retries and because of savepoint-based retries, a transaction can continue holding locks in between retries. So that means with exponential backoff, you'll be holding locks for longer, thus putting the app at even greater risk of contention.
If you could show us that this is not the case with backoffs, we will consider adding this! Thanks!
I just pushed 9dda97b. Could you take a look at that? I'm not sure what all the implications are of separating the database transaction lifecycle from the Tx object, but aside from that, I think it's sound, and avoids the problem with holding locks during backoff.