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

Implement db-uri-read-replicas #3017

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Implement db-uri-read-replicas #3017

wants to merge 2 commits into from

Commits on Oct 27, 2023

  1. Implement db-uri-read-replicas

    - takes a list of URIs to use as read replicas
    - queries are routed based on the transaction mode,
      with read-mode queries going to the read replicas
      if any are configured
    - we configure one pool per database uri, all with
      the same configuration
    - which read replica to use is chosen randomly
    - if you want the master to also be used for read-only
      queries, put it in both db-uri and db-uri-read-replicas
    
    Test coverage is spotty and work-in-progress. It requires a
    replicating setup which is not automated. With a locally set
    up read replica, the integration test suite should pass as
    follows:
    
    PGHOSTREP='/tmp' PGPORTREP=5433 PGHOST='/tmp' PGPORT=5432 \
      postgrest-test-io
    
    You can pass '-k test_readonly' for replication-specific tests.
    robx committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    e424a73 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cdedf26 View commit details
    Browse the repository at this point in the history