BobSong-dev opened a new pull request, #7350:
URL: https://github.com/apache/shenyu/pull/7350
Fixes #6810
## Background
Alert dispatch caches receivers in a single list loaded by `selectAll()` —
the whole
`alert_receiver` table with ~20 columns and no `WHERE`, reloaded after every
receiver change
and matched (namespace, levels, labels) in Java per alert.
## Changes
- Add `AlertReceiverMapper.selectByNamespaceId(namespaceId)` returning
namespace-local
receivers plus namespace-free receivers (which match every namespace),
pushing the
namespace filter into SQL;
- The dispatch cache is now keyed by the alert's namespace, so a reload
after a receiver
change only queries that namespace's slice instead of the full table;
`clearCache()`
invalidates all namespaces;
- Alerts without a namespace keep the previous behavior (full list +
in-memory filter);
- The in-memory enable/levels/labels matching is unchanged, so dispatch
semantics are
identical — only the candidate set loaded from the database is narrower.
## Verification
Local:
- `./mvnw test -pl shenyu-admin
-Dtest=AlertDispatchServiceTest,AlertReceiverServiceTest`:
26 tests, 0 failures;
- `./mvnw test -pl shenyu-admin`: BUILD SUCCESS; Tests run: 1510, Failures:
0, Errors: 0, Skipped: 1;
- `./mvnw checkstyle:check -pl shenyu-admin`: passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]