You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Frun1na (via GitHub)" <gi...@apache.org> on 2026/09/21 08:29:07 UTC

[PR] fix(deploy): use gmt_create in the nameserver unique-key migration [rocketmq-dashboard]

Frun1na opened a new pull request, #4721:
URL: https://github.com/apache/rocketmq-dashboard/pull/4721

   ### Which Issue(s) This PR Fixes
   
   ### Brief Description
   
   `deploy/mysql/upgrade-nameserver-name-uk.sql` sorts the duplicate nameserver rows by
   `created_at`, a column `rmq_nameserver` does not have. #2317 standardised every table on a
   numeric `id` plus `gmt_create` / `gmt_modified`, and the schema comment it added spells it out:
   `禁止 created_at/updated_at,禁止 VARCHAR UUID 主键。` This script arrived eight days after that
   change (#2510, 2026-08-25), so it has been failing since the day it was added:
   
   ```
   $ docker exec -i rocketmq-studio-mysql mysql -uroot -pstudio123 mig_probe < upgrade-nameserver-name-uk.sql
   ERROR 1054 (42S22) at line 17: Unknown column 'k.created_at' in 'on clause'
   ```
   
   The script aborts before reaching `ALTER TABLE ... ADD UNIQUE KEY`, so the `uk_nameserver_name`
   it exists to create is never applied. The fix sorts on `gmt_create` — the creation timestamp the
   table actually defines.
   
   The other `deploy/mysql/upgrade-*.sql` scripts were also checked against the same schema change;
   they reference the pre-#2317 table and column names too, but each of them was added *before*
   #2317 (2026-08-06 … 2026-08-13), when those names were still correct, so they are left untouched.
   
   ### How Did You Test This Change?
   
   Against the project's MySQL 8 container (`deploy/docker-compose.yml`), on a scratch database
   holding only `rmq_nameserver` exactly as `server/src/main/resources/db/schema.sql` defines it.
   
   Before, running the script from the base branch:
   
   ```
   $ docker exec -i rocketmq-studio-mysql mysql -uroot -pstudio123 mig_probe < /tmp/orig.sql
   ERROR 1054 (42S22) at line 17: Unknown column 'k.created_at' in 'on clause'
   ```
   
   After, starting from four duplicate rows that differ only by timestamp and id:
   
   ```
   id  gmt_create           namesrv_addr      <- before
   1   2026-08-01 10:00:00  a:9876
   2   2026-08-02 10:00:00  b:9876
   3   2026-08-03 10:00:00  c:9876
   4   2026-08-01 10:00:00  d:9876
   
   $ docker exec -i rocketmq-studio-mysql mysql -uroot -pstudio123 mig_probe < deploy/mysql/upgrade-nameserver-name-uk.sql
   (no output, exit 0)
   
   id  gmt_create           namesrv_addr      <- after
   1   2026-08-01 10:00:00  a:9876
   ```
   
   The row with the earliest `gmt_create` survives; id 4 shares that timestamp and loses on the `id`
   tie-break, which is what the header comment promises.
   
   Idempotency still holds — a second run reports the key already exists:
   
   ```
   $ docker exec -i rocketmq-studio-mysql mysql -uroot -pstudio123 mig_probe < deploy/mysql/upgrade-nameserver-name-uk.sql
   msg
   uk_nameserver_name already exists
   
   $ docker exec rocketmq-studio-mysql sh -c 'mysql -uroot -pstudio123 -N -e "SELECT index_name FROM information_schema.statistics WHERE table_schema=\"mig_probe\" AND table_name=\"rmq_nameserver\";"'
   PRIMARY
   uk_nameserver_name
   ```
   
   The scratch database was dropped afterwards. No server or web code changed, so the Maven and
   Vitest suites were not re-run.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [ ] 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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(deploy): use gmt_create in the nameserver unique-key migration [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #4721:
URL: https://github.com/apache/rocketmq-dashboard/pull/4721


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org