fix(topology): skip unchanged writes and compact etcd history - #677
Merged
Merged
Conversation
- Compare owned topology fields before updating cell and database records. - Configure MVCC compaction with one-hour retention and an explicit backend quota. - Add opt-in defragmentation with health checks and persisted maintenance reservations. Signed-off-by: Verónica López <veronica.lopez@supabase.io>
Verolop
force-pushed
the
fix/topology-growth
branch
from
September 25, 2026 06:50
705a2f0 to
50f8345
Compare
This comment has been minimized.
This comment has been minimized.
- Reconcile Services and the serving Certificate before maintenance health checks. - Keep StatefulSet updates blocked while maintenance recovery is pending. - Test dependency repair and rollout resumption after recovery. Signed-off-by: Verónica López <veronica.lopez@supabase.io>
This comment has been minimized.
This comment has been minimized.
mkindahl
approved these changes
Sep 25, 2026
mkindahl
left a comment
Contributor
There was a problem hiding this comment.
You might want to extend the tests to cover some corner cases. Otherwise looks good, so approving.
- Cover unexpected member counts, learners, and zero member IDs. - Verify status RPC failures abort maintenance without reserving a target. - Verify incomplete leadership transfers block defragmentation and retain the reservation. Signed-off-by: Verónica López <veronica.lopez@supabase.io>
🔬 Go Test Coverage ReportSummary
Status✅ PASS DetailShow New Coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR makes topology registration idempotent and adds storage maintenance to managed etcd. Repeated reconciles currently rewrite unchanged cell and database metadata, accumulating revisions without automatic compaction. The operator now skips those writes and configures etcd to retain one hour of history.
Optional defragmentation reclaims disk space after compaction. It is disabled by default and processes one member at a time, with cluster health checks before and after each operation.
Main changes
etcd.maintenancesettings for compaction mode, retention, backend quota, and defragmentation to global and cell-local topology specs and templates. Support periodic and revision-based compaction; revision mode defaults to 10,000 revisions, and the quota defaults to 2 GiB. Update CRD validation and generated schemas. Applying the new compaction defaults rolls existing managed etcd pods.status.etcdMaintenancebefore starting defragmentation. A resource-version check prevents concurrent maintenance claims. Interrupted operations retain that state across operator restarts; pod rollouts wait for the operation deadline to pass and all members to pass health checks. Ordinary status updates preserve the maintenance record.Testing
Unit tests and the TopoServer, MultigresCluster, and Cell integration suites pass. Registration tests check the stored record versions to verify that unchanged reconciles produce no writes and that changed metadata still updates. Admission and resolver tests cover invalid settings and template overrides. Maintenance tests cover unhealthy members, active rollouts, conflicting reservations, timeouts, TLS credential loading, and status updates that must preserve an active reservation.
A live three-member etcd test verifies that old revisions are compacted, unchanged registrations leave the etcd revision unchanged, and data survives sequential defragmentation and leadership transfers. Changed packages pass lint, and
git diff --checkis clean.