pgadapter
pgadapter copied to clipboard
feat: emit warning when read/write transaction is retried
- Cloud Spanner can abort any read/write transaction.
- PGAdapter will by default try to retry any aborted read/write transaction, unless
spanner.retry_aborts_internally=false
. - 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:
- 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. - Record the transaction retry using OpenTelemetry (being added in #1182)
- 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.