feat(messagequeue): supervisor ticks use tenant IN-list - #702
Merged
Conversation
behinddwalls
marked this pull request as ready for review
September 11, 2026 17:30
behinddwalls
force-pushed
the
preetam/mq-tenant-in-list
branch
from
September 11, 2026 17:51
4bc299d to
92092a0
Compare
## Summary ### Why? Each subscription tick fanned out one goroutine and one `WHERE tenant = ?` round-trip per configured tenant. Tenants that hash onto the same Vitess shard still paid N Go timeouts and N queries. Partial-read failures in that new shared path also dropped poll workers or skipped lease renew, so one listing error could stall every tenant until the next successful tick. ### What? Replace supervisor reads and same-shape writes with `WHERE tenant IN (MQ_TENANTS)`. Go still groups rows by tenant and applies fair-share per `(tenant, topic)`. `TryAcquireLease` and per-partition `ReleaseLease` stay row-local. Poll workers and publish SQL are unchanged. If discovery or the leased-list read fails, cached discovery is kept and unconfirmed workers stop. If GetAllLeases or ActiveSubscribers fails after leases are known, skip acquire and reconcile from this tick's leased list. If the lease tick cannot list owned partitions or active peers, skip rebalance and still renew, heartbeat, and purge. Remove the superseded single-tenant supervisor store methods and their test-only callers so the private interfaces expose only the production paths. ## Test Plan - ✅ `make check-mocks && make check-gazelle && make check-tidy` - ✅ `./tool/bazel test //platform/extension/messagequeue/mysql:go_default_test --test_output=errors` - ✅ `./tool/bazel test //test/integration/extension/messagequeue/mysql:go_default_test --test_output=errors` - ✅ `./tool/bazel test //test/integration/extension/messagequeue/mysql/vitess:go_default_test --test_output=errors --strategy=TestRunner=local` Co-authored-by: Cursor <cursoragent@cursor.com>
behinddwalls
force-pushed
the
preetam/mq-tenant-in-list
branch
from
September 11, 2026 19:56
92092a0 to
65dab07
Compare
mnoah1
approved these changes
Sep 11, 2026
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.
Summary
Why?
Each subscription tick fanned out one goroutine and one
WHERE tenant = ?round-trip per configured tenant. Tenants that hash onto the same Vitess shard still paid N Go timeouts and N queries. Partial-read failures in that new shared path also dropped poll workers or skipped lease renew, so one listing error could stall every tenant until the next successful tick.What?
Replace supervisor reads and same-shape writes with
WHERE tenant IN (MQ_TENANTS). Go still groups rows by tenant and applies fair-share per(tenant, topic).TryAcquireLeaseand per-partitionReleaseLeasestay row-local. Poll workers and publish SQL are unchanged.If discovery or the leased-list read fails, cached discovery is kept and unconfirmed workers stop. If GetAllLeases or ActiveSubscribers fails after leases are known, skip acquire and reconcile from this tick's leased list. If the lease tick cannot list owned partitions or active peers, skip rebalance and still renew, heartbeat, and purge.
Remove the superseded single-tenant supervisor store methods and their test-only callers so the private interfaces expose only the production paths.
Test Plan
make check-mocks && make check-gazelle && make check-tidy./tool/bazel test //platform/extension/messagequeue/mysql:go_default_test --test_output=errors./tool/bazel test //test/integration/extension/messagequeue/mysql:go_default_test --test_output=errors./tool/bazel test //test/integration/extension/messagequeue/mysql/vitess:go_default_test --test_output=errors --strategy=TestRunner=localCo-authored-by: Cursor cursoragent@cursor.com