Sean-Walker0 opened a new pull request, #7819:
URL: https://github.com/apache/shenyu/pull/7819

   Fixes #7815
   
   ## Modifications
   
   `DELETE /discovery-upstream/batch` removed the database rows and returned 
success **without publishing the remaining upstream snapshot**, so connected 
gateways kept the deleted URL as a routing candidate until some other change 
triggered a refresh. The sibling `create`/`update` paths in the same service 
already publish through `fetchAll` — only `delete` was silent.
   
   The owning discovery handlers are resolved before the rows disappear, then 
the remaining upstream list is published for each affected handler — including 
an empty list when the last upstream was deleted:
   
   ```java
   final List<DiscoveryUpstreamDO> deleted = 
discoveryUpstreamMapper.selectByIds(ids);
   discoveryUpstreamMapper.deleteByIds(ids);
   
deleted.stream().map(DiscoveryUpstreamDO::getDiscoveryHandlerId).distinct().forEach(this::fetchAll);
   ```
   
   ## Verifying this change
   
   - [x] New 
`DiscoveryUpstreamServiceTest#testDeleteNotifiesAffectedHandlersWithRemainingUpstreams`
 — deletes the last upstream of a handler (full mock chain for the 
selector/plugin/discovery resolution) and asserts `changeUpstream` is invoked 
with the empty remaining snapshot. Red on the pre-fix code 
(`WantedButNotInvoked` — the processor was never notified), green after.
   - [x] `./mvnw -pl shenyu-admin -am test -B 
-Dtest=DiscoveryUpstreamServiceTest` — 19/19 green (18 pre-existing cases 
unchanged), module checkstyle clean.
   
   ## Notes
   
   - Behavior change: upstream deletions now propagate to gateways immediately 
(including empty-snapshot when the last upstream goes away) instead of waiting 
for an unrelated refresh — the same contract `create`/`update` already honor.
   - Distinguished from #6479 (subscriber-side DELETE handling, already fixed) 
and #7791 (downstream stale-target reconciliation of full replacements) — this 
fixes the missing publication at the source.
   - Orthogonality: no open PR modifies `DiscoveryUpstreamServiceImpl` 
(verified against the file lists of all 120 open PRs).
   
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true` (module-scoped: `shenyu-admin` targeted test class + 
checkstyle green; full-module suite left to CI as with the other admin PRs).


-- 
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]

Reply via email to