Skip to content

Clean error messages for TransactionRetryError #90114

@Nican

Description

@Nican

Is your feature request related to a problem? Please describe.
I'm always frustrated when I see a TransactionRetryError error message. A retry loop is already implemented to try 3 times, but every once in a while, I get failed tests, or an error report of a failed request with that message.

Example error:

original: error: restart transaction: TransactionRetryWithProtoRefreshError: TransactionRetryError: 
retry txn (RETRY_SERIALIZABLE - failed preemptive refresh due to a conflict: intent on key /Table/145/414/2554649/178/0): 
"sql txn" meta=***id=37ded52b key=/Table/109/164/"\x1f\xcfX\xcaדM\x97\xbd\r/\xa99\xa6\xa9W"/130/0 pri=0.00905739 epo=0 ts=1666064968.620787639,1 min=1666064968.530578460,0 seq=27*** lock=true stat=PENDING rts=1666064968.530578460,0 wto=false gul=1666064969.030578460,0

I sometimes take some effort to debug /Table/145/414/2554649/178/0 or /Table/109/164/"\x1f\xcfX\xcaדM\x97\xbd\r/\xa99\xa6\xa9W"/130/0, but it is not always clear what it is.

Describe the solution you'd like
It would be nice if the error message would give more information about what table (or index) is the serializability problem is happening on. The raw KV key is not very helpful.

Describe alternatives you've considered

  1. I have added a retry loop (as suggested by the official documentation)
  2. Using preemptive locks (Using SELECT ... FOR UPDATE)
  3. debugging the error by translating the key into the corresponding table (Using crdb_internal."ranges"), and finding better ways to handle concurrency on the problematic entities

Additional context
CockroachDB is awesome. I love y'all product.

Jira issue: CRDB-20591

Epic CRDB-5489

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)O-communityOriginated from the communityT-kvKV Team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions