wy471x opened a new pull request, #7544: URL: https://github.com/apache/shenyu/pull/7544
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`. ## Summary Fixes #6675. `operation_record_log` backs the admin audit-log screen, which filters by an `operation_time` range and optionally by `operator` and always sorts by `operation_time desc`. The MySQL fresh-install schema and the MySQL 2.7.1→2.7.2 upgrade script already declare the two supporting indexes, but the OpenGauss, PostgreSQL and Oracle scripts never got them, so on those engines the query falls back to a full scan plus a filesort. ### Changes: 1. `db/init/og/create-table.sql` — add `idx_operation_log_time (operation_time)` and `idx_operation_log_operator_time (operator, operation_time)` in the "Index structure for table operation_record_log" section. 2. `db/init/pg/create-table.sql` — same two indexes, matching the MySQL naming. 3. `db/init/ob/schema.sql` — same two indexes, in the MySQL-compatible `CREATE INDEX ... USING BTREE` form used by the OB script. 4. `db/init/oracle/schema.sql` — same two indexes next to the `operation_record_log_seq` sequence. 5. `db/upgrade/2.7.1-upgrade-2.7.2-{og,pg,ob,oracle}.sql` — the equivalent DDL so existing 2.7.1 deployments on those engines get the indexes too (`CREATE INDEX [IF NOT EXISTS]` for pg/og/oracle, `ALTER TABLE ... ADD INDEX` for OB). Index names and column order are kept identical to MySQL so the schema stays consistent across dialects. This change only adds secondary indexes; it does not change query semantics, add uniqueness constraints, or alter any table data. Operators upgrading an existing deployment should schedule the DDL according to their normal maintenance window, as it locks/rebuilds the index on a potentially large table. ### Test Cases: - `shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/OperationLogIndexContractTest.java` (new): parameterized script-contract test over all five dialects (`mysql`, `ob`, `pg`, `og`, `oracle`) that normalizes each init and 2.7.1→2.7.2 upgrade script and asserts both `idx_operation_log_time` and `idx_operation_log_operator_time` declarations exist with the expected column order. 10 cases, all pass. - Existing `AdminQueryIndexTest` already asserts the H2 column order for these two indexes, so the H2/MySQL side stays covered. ## Verification - `mvn -pl shenyu-admin -am test -Dtest=OperationLogIndexContractTest -DfailIfNoTests=false` — tests run: 10, failures: 0, errors: 0, skipped: 0. - `mvn -pl shenyu-admin -am validate` — Checkstyle (0 violations) and RAT passed. - JDK 21 (`/Library/Java/JavaVirtualMachines/microsoft-21.jdk`), Maven 3.6.3. -- 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]
