Skip to content

feat(messagequeue): supervisor ticks use tenant IN-list - #702

Merged
mnoah1 merged 1 commit into
mainfrom
preetam/mq-tenant-in-list
Sep 11, 2026
Merged

feat(messagequeue): supervisor ticks use tenant IN-list#702
mnoah1 merged 1 commit into
mainfrom
preetam/mq-tenant-in-list

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

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
behinddwalls marked this pull request as ready for review September 11, 2026 17:30
@behinddwalls
behinddwalls requested review from a team and sbalabanov as code owners September 11, 2026 17:30
@behinddwalls
behinddwalls force-pushed the preetam/mq-tenant-in-list branch from 4bc299d to 92092a0 Compare September 11, 2026 17:51
## 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
behinddwalls force-pushed the preetam/mq-tenant-in-list branch from 92092a0 to 65dab07 Compare September 11, 2026 19:56
@mnoah1
mnoah1 added this pull request to the merge queue Sep 11, 2026
Merged via the queue into main with commit 40b0609 Sep 11, 2026
15 checks passed
@mnoah1
mnoah1 deployed to stack-rebase September 11, 2026 21:09 — with GitHub Actions Active
@behinddwalls
behinddwalls deleted the preetam/mq-tenant-in-list branch September 11, 2026 21:10
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.

2 participants