zjncs opened a new pull request, #7296: URL: https://github.com/apache/rocketmq-dashboard/pull/7296
## Problem `QueryHistorySchemaMigration` rethrows when an `ALTER TABLE`/`CREATE INDEX` is refused and the re-check confirms the artifact is still missing (`ensureColumn`/`ensureIndex`). Both are `@Component ApplicationRunner`s, so the exception fails `SpringApplication.callRunners` and **terminates the entire dashboard boot**. A deployment upgrading from a pre-`trace_topic`/pre-index schema whose DB account has DML-only privileges (the steady-state need — `schema.sql` states the app never does DDL) gets the DDL rejected and the dashboard cannot start — over a *performance index*. Query-history recording is already fail-soft at the call site (`MessageService.recordMessageQuery` logs and continues on insert failure), so the artifact is not boot-critical. The sibling migration `UsernameColumnWideningSchemaMigration` handles the identical failure mode by design (its own comment: *"A server that refuses the widening must not stop the application from booting"*) with a warn log. ## Fix Mirror the sibling's fail-open policy: a refused DDL degrades to `log.warn` and the loop continues; the idempotency re-check is kept (an artifact that exists despite the error — e.g. created concurrently — still counts as success, no warning). ## Verification (JDK 21, `mvn -Dtest=QueryHistorySchemaMigrationTest -Dspring.profiles.active=dev test`) - New test `refusedDdlDegradesWithWarningInsteadOfFailingBoot`: H2 with both tables present but **missing the columns the indexes reference** — the ALTERs succeed, the CREATE INDEXes are refused. RED before: the refusal propagated out of `run()` (`JdbcSQLSyntaxError: Column "queried_by" not found`); GREEN after: `run()` completes, `result_snapshot` is added, `Tests run: 3, Failures: 0, Errors: 0`. - The two existing tests (idempotent add; missing-table skip) still pass unchanged. ## Risk / conflict disclosure Deliberate behavior change: a refused DDL now boots with a warning instead of crashing — matching the established sibling policy. No open PR touches this file (verified across all open 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]
