Frun1na opened a new pull request, #6087:
URL: https://github.com/apache/rocketmq-dashboard/pull/6087
### Which Issue(s) This PR Fixes
- Fixes #6084
### Brief Description
`MetadataService` bounded the text of an instance to the width of its
`rmq_instance` columns (#4713) but left the
topic and consumer-group write paths unbounded, so a topic remark, a topic
name or a group name longer than 255
characters was handed to the persistence layer and rejected there as a
`DataIntegrityViolationException` — the API
answered `500 Internal Server Error` instead of the `400` the surrounding
paths return.
`requireTopic` now bounds the topic name and remark, and `saveConsumerGroup`
bounds the group name, to the
255-code-point width of `rmq_instance_topic.name`,
`rmq_instance_topic.remark` and `rmq_instance_group.name`
(`db/schema.sql:128`, `:133`, `:149`). The value is counted in code points,
the unit MySQL counts a `varchar` in,
so a value that fits the column is not rejected for using two UTF-16 units
per character.
User-visible change: a create/update whose topic or group text exceeds 255
characters now answers
`400` with the field name and the limit instead of failing inside the
database as a `500`. A 255-character value
is still accepted, and the broker-side limits are unchanged.
### How Did You Test This Change?
```
cd server && mvn -B -ntp test -DforkCount=1
-Dsurefire.failIfNoSpecifiedTests=false -Dtest=MetadataServiceTest
[INFO] --- checkstyle:3.6.0:check (validate) @ rocketmq-studio ---
[INFO] Tests run: 62, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
```
The new tests fail without the fix, with only the product change reverted:
```
[ERROR] Tests run: 62, Failures: 2, Errors: 0, Skipped: 0
MetadataServiceTest.createTopicShouldRejectARemarkTheRegistrationColumnCannotStoreTest
-- <<< FAILURE!
java.lang.AssertionError:
Expecting code to raise a throwable.
at
...MetadataServiceTest.createTopicShouldRejectARemarkTheRegistrationColumnCannotStoreTest(MetadataServiceTest.java:593)
MetadataServiceTest.createConsumerGroupShouldRejectANameTheRegistrationColumnCannotStoreTest
-- <<< FAILURE!
java.lang.AssertionError:
Expecting code to raise a throwable.
at
...MetadataServiceTest.createConsumerGroupShouldRejectANameTheRegistrationColumnCannotStoreTest(MetadataServiceTest.java:619)
```
### 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]