pgadapter icon indicating copy to clipboard operation
pgadapter copied to clipboard

feat: emit warning when read/write transaction is retried

Open olavloite opened this issue 1 year ago • 0 comments

  1. Cloud Spanner can abort any read/write transaction.
  2. PGAdapter will by default try to retry any aborted read/write transaction, unless spanner.retry_aborts_internally=false.
  3. Retrying a read/write transaction makes it seem like a single statement in that transaction took a very long time. This shows up as a large outlier when measured from outside PGAdapter, and often causes confusion during benchmarking.

Possible ways to reduce this problem is to:

  1. Turn off internal transaction retries (i.e. execute set spanner.retry_aborts_internally=false). This will cause the transaction to fail instead of being retried.
  2. Record the transaction retry using OpenTelemetry (being added in #1182)
  3. Let PGAdapter emit a warning when a transaction is being retried. The client can then log this fact along with the long execution time.

This is a request to add support for point 3 above.

olavloite avatar Nov 20 '23 08:11 olavloite