Skip to content
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

ExecuteInTx PostgreSQL version #1045

Merged
merged 2 commits into from
Jul 11, 2023
Merged

ExecuteInTx PostgreSQL version #1045

merged 2 commits into from
Jul 11, 2023

Commits on Jul 10, 2023

  1. Enforce contract of ExecuteInTx at the API level

    Previously ExecuteInTx accepted open transaction, but required
    users never to execute any commands on it prior to calling
    ExecuteInTx. This API change enforces this contract by making
    ExecuteInTx to open transaction internally and pass it to the
    callback func.
    redbaron committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    e92c536 View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2023

  1. Implement PG version of ExecuteInTx which does fewer roundtrips to th…

    …e Server
    
    PostgreSQL doesn't benefit from SAVEPOINT/ROLLBACK logic like CockroachDB
    does. With this change Nakama checks server DB engine and enables CockroachDB
    optimization only when necessary.
    
    There are 2 behviour change in the PG version of ExecuteInTx:
    
    - it retries on all "Class 40" (a.k.a retriable) codes, not just
      serialization error:
    
    	40000 	transaction_rollback
    	40002 	transaction_integrity_constraint_violation
    	40001 	serialization_failure
    	40003 	statement_completion_unknown
    	40P01 	deadlock_detected
    
    - It doesn't ignore COMMIT result code anymore
    redbaron committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    b8c8707 View commit details
    Browse the repository at this point in the history