Frun1na opened a new pull request, #6102:
URL: https://github.com/apache/rocketmq-dashboard/pull/6102
### Which Issue(s) This PR Fixes
- Fixes #6100
### Brief Description
`BatchDeleteInstancesDTO.ids` declared `@NotEmpty` only, and
`InstanceService.deleteInstances`
(`instance/InstanceService.java:738`) looped over the list without a cap:
each id costs one identifier lookup
and one transactional delete through `self.deleteInstance`, so an unbounded
list is a request whose processing
can outlive any request timeout — and the per-id report then never reaches
the caller. Every other batch input
in the repository is capped at 100, on the DTO and again in the service:
import topics, import consumer groups
and selected DLQ resends. This change applies the same bound, and the
console only submits the rows of one page
(at most 100), so no existing flow changes.
User-visible change: `POST /api/instances/delete-batch` with more than 100
ids answers `400` with the limit
instead of starting an unbounded batch; a batch of up to 100 ids is
unchanged.
### How Did You Test This Change?
```
cd server && mvn -B -ntp test -DforkCount=1
-Dsurefire.failIfNoSpecifiedTests=false \
-Dtest=InstanceControllerTest,InstanceServiceTest
[INFO] --- checkstyle:3.6.0:check (validate) @ rocketmq-studio ---
[INFO] Tests run: 113, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
```
Both new tests fail without the fix, with only the product files reverted:
```
InstanceControllerTest.deleteInstancesShouldRejectABatchAboveTheLimitTest --
<<< FAILURE!
java.lang.AssertionError: Status expected:<400> but was:<200>
InstanceServiceTest.deleteInstancesShouldRejectABatchAboveTheBatchLimitTest
-- <<< FAILURE!
java.lang.AssertionError:
Expecting code to raise a throwable.
```
`deleteInstancesShouldAcceptABatchAtTheBatchLimitTest` pins the boundary
(100 ids still processed), so the cap
cannot be tightened into a rejection of legitimate batches.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
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]