Skip to content

feat: added proposal for mysql-secondary-db-support - #37

Open
chiragsoni-eternal wants to merge 2 commits into
openfga:mainfrom
chiragsoni-eternal:20260907-mysql-secondary-db-support
Open

feat: added proposal for mysql-secondary-db-support#37
chiragsoni-eternal wants to merge 2 commits into
openfga:mainfrom
chiragsoni-eternal:20260907-mysql-secondary-db-support

Conversation

@chiragsoni-eternal

@chiragsoni-eternal chiragsoni-eternal commented Sep 7, 2026

Copy link
Copy Markdown

RFC proposing secondary DB (read replica) support for the MySQL datastore, matching what already exists for PostgreSQL.

Description

What problem is being solved?

The MySQL datastore only supports a single primary DB. Read traffic (Check and other reads) dominates OpenFGA's load, but today it can't be scaled independently of writes the way it already can for PostgreSQL. This is the concern raised in openfga#3282.

How is it being solved?

By reusing the routing pattern PostgreSQL already has: writes always go to the primary DB; reads requesting HIGHER_CONSISTENCY go to the primary DB; other reads go to the secondary DB when one is configured. Configuration reuses the existing shared datastore-secondary-uri/-username/-password flags, so it's opt-in and non-breaking — deployments that don't set a secondary URI are unaffected.

What changes are made to solve it?

Adds 20260903-mysql-secondary-db-support.md, an RFC that covers:

  • Read/write routing rule, including which metadata reads (GetStore, ListStores, etc.) always prefer the secondary, matching current PostgreSQL behavior.
  • Migration: opt-in, no schema/data migration required.
  • Alternatives considered (vertical scaling, sharding) and why this matches the proven PostgreSQL approach instead.

This PR is documentation only. It adds no code.

References

Motivating issue: closes openfga/openfga#3282
PR: openfga/openfga#3290

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 7, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: chiragsoni-eternal / name: Chirag Soni (6cde08c)
  • ✅ login: chiragsoni-eternal / name: chiragsoni-eternal (1b47bd9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Secondary DB Support For MySQL Datastore

1 participant