Skip to content

docs: describe the PostgreSQL read replica mode as a proposal - #584

Open
LeeroyHannigan wants to merge 1 commit into
mainfrom
docs/postgres-read-replica
Open

LeeroyHannigan wants to merge 1 commit into
mainfrom
docs/postgres-read-replica

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

Four design documents and the technical debt register described a PostgreSQL read replica mode as current behaviour: a storage.postgres.read_replica_url setting, a read_replica_pool_size, a read_pool() selected per read, and ConsistentRead=false reads routed to a streaming replica. None of that is in the repository. The PostgreSQL backend serves every item read and write from data_pool, and PostgresStorageConfig carries #[serde(deny_unknown_fields)], so a configuration that copies read_replica_url from the documents stops the server at startup.

The documents now state what the backend does and label the replica mode a proposal.

  • docs/design/01-requirements.md: REQ-DATA-015 states that the parameter is accepted and charged and that no in-tree backend routes a read on it. REQ-PG-008 is marked proposed, names the struct that refuses the keys, says every item read and write runs on data_pool, and points at both proposals (document 04 section 5.3 with one replica URL, document 11 Stage 2 with a replicas list).
  • docs/design/02-high-level-design.md: section 4.7 states the decision as the PostgreSQL backend serving every item read from the pool that takes the writes, with the replica routing as a proposal; the rationale bullets are rewritten in that tense.
  • docs/design/04-component-storage.md: the section 5.2 sketch carries a label saying it is a proposal, that its pool predates the catalog and data pool split and stands for today's data_pool, and that the two keys stop the server. Section 5.3 is left to feat(storage): carry ConsistentRead to the data engine as ReadOptions #559, which rewrites it.
  • docs/design/08-component-config.md: the read_replica_url environment variable row and the two sample lines are removed, since a configuration carrying them does not load.
  • docs/technical-debt.md: the F-2 row says the two ConsistentRead values are served the same way on every backend, and its line reference is corrected to item.rs:176.

Why

Closes #561.

An operator who followed document 08 got a server that refused to start. A backend author reading documents 01, 02 or 04 would have built against a read_pool and a configuration field that do not exist. The TODO at crates/core/src/types/item.rs:176 is the only trace of the mode in code and it is future tense.

Testing done

Documentation only; no code or test changes. Each statement in the new text was checked against the source at 744ea291: git grep read_replica and git grep read_pool under crates/ return nothing; deny_unknown_fields is on PostgresStorageConfig in crates/storage-postgres/src/config.rs; get_item_impl, query_impl, scan_impl and the item writes use self.data_pool; the capacity charge is in crates/engine/src/capacity_helpers.rs. The new text does not depend on #559: it names neither ReadOptions nor ADR-0024, and git merge-tree of this branch with feat/read-options produces a clean tree in either order.

git grep -n -E 'read_replica|read_pool' -- crates/   # no matches
git diff 744ea291 HEAD --stat                        # 5 files, 15 insertions, 15 deletions

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (no code change)
  • Code is formatted (no code change)
  • Clippy is clean (no code change)
  • I have added or updated tests for new functionality (none needed)
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (none)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a (documentation correction; the decision the documents now describe is the one in the code)


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

…rrent behaviour

Four design documents stated a read replica mode in the present tense: a
storage.postgres.read_replica_url setting with read_replica_pool_size, a
read_pool field on PostgresEngine, a read_pool() helper, and
ConsistentRead=false reads routed to a streaming replica. None of it exists:
grep read_replica over crates/ returns nothing, PostgresConfig carries
deny_unknown_fields, and every item read and write runs on data_pool. An
operator who copied read_replica_url from the configuration reference got a
server that refused to start.

- 01-requirements: REQ-DATA-015 states what the backends do (the flag reaches
  storage as ReadOptions::consistent_read; every in-tree backend serves both
  values from the copy that took the write) and REQ-PG-008 is marked proposed
  with the startup refusal named.
- 02-high-level-design 4.7: the decision is strongly consistent reads today,
  the replica route a proposal; the rationale bullets are in the conditional.
- 04-component-storage 5.2: the pool sketch is labelled a proposal (5.3 is
  rewritten by #559).
- 08-component-config: the read_replica_url environment row and the two
  sample lines are removed, since the setting stops the server.
- technical-debt F-2 and the TODO index line say the same in the same tense.

Closes #561

This branch has not been deployed

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

Labels

v1 Needed for the 1.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Docs describe a PostgreSQL read replica mode (read_replica_url) the backend does not have

2 participants