HY-love-sleep opened a new pull request, #7215:
URL: https://github.com/apache/shenyu/pull/7215
## What
`MockRequestRecordServiceImpl#listByPage` is the only paginated list service
in the admin server
whose `listByPage` is **not** annotated with `@Pageable`, so it never gets
paged by the database:
* `MockRequestRecordMapper.selectByQuery` is a plain `SELECT ... FROM
mock_request_record WHERE ...`
with no limit.
* its `Base_Column_List` includes the `body` TEXT column.
Every list request therefore reads the whole filtered table — every request
body included — into
memory and ships it to the client.
`@Pageable` is what arms `PageableAspect` (`PageMethod.startPage(...)` +
MyBatis-PageHelper), which
appends the dialect's `LIMIT` to the statement and fills the real total
count back into the
`CommonPager`. With the annotation in place the query pages in the database,
so a list request
transfers at most `pageSize` rows instead of the whole table — with no
change to the response shape.
## Why
Closes #6808.
## Verified
* `./mvnw -pl shenyu-admin -am test
-Dtest='MockRequestRecordServiceTest,MockRequestRecordMapperTest,MockRequestRecordControllerTest,PageableAspectTest'`
→ **Tests run: 23, Failures: 0, Errors: 0**
* `MockRequestRecordServiceTest#testListByPageIsPageable` (new) keeps the
annotation in place:
removing `@Pageable` makes it fail with
```
org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
at
...MockRequestRecordServiceTest.testListByPageIsPageable(MockRequestRecordServiceTest.java:109)
```
(the guard only locks the annotation in; it cannot exercise the
AOP/PageHelper path itself, which
is covered by `PageableAspectTest`)
* checkstyle: 0 violations
## Not in this PR
* The `api_id` index suggested in the issue requires a schema change across
all five supported
databases (#6809 family) — separate work.
* `body` is intentionally left in the list column list:
`MockRequestRecordVO` exposes it and the
dashboard lives in a separate repository, so dropping it could silently
blank a field the UI
renders. Paging already bounds the transferred payload by `pageSize`.
--
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]