fix: 将 im_filemsglinks.msgid 字段类型从 INT 修改为 BIGINT

该字段原类型为 INT,最大值仅为 2147483647,而消息 ID 是雪花算法生成的 int64 类型值,插入时会超出范围导致失败。失败的 Kafka 消息持久化消费者会无限重试,阻塞分区及后续消息的持久化。此修改适用于 2026-10-13 之前部署的所有环境,全局非租户分片表仅需执行一次。
This commit is contained in:
Austin
2026-10-13 15:39:49 +08:00
parent 8d6618dac1
commit a3527a6d22
@@ -0,0 +1,15 @@
-- im_filemsglinks.msgid: INT -> BIGINT
--
-- Background: message ids are snowflake int64 values (~1.58e18). The msgid
-- column was INT (max 2147483647), so every attempt to insert a message-file
-- link failed with MySQL error 1264 "Out of range value for column 'msgid'".
-- The failing Kafka message-persist consumer then retried the same message
-- forever, stalling its partition and blocking persistence for every message
-- queued behind it (p2p history stuck at old seqs while senders' seq kept
-- advancing in Redis).
--
-- Applies to: any environment provisioned before 2026-10-13. im_filemsglinks
-- is a global (non tenant-sharded) table, so a single statement per DB is
-- enough. Verified online on the test env (table is small).
ALTER TABLE im_filemsglinks MODIFY msgid BIGINT DEFAULT NULL;