fix(room): align recovered command versions

This commit is contained in:
zhx 2026-07-23 12:24:05 +08:00
parent cb0cacdcc5
commit 70d1912054
2 changed files with 10 additions and 5 deletions

View File

@ -128,6 +128,9 @@ func (s *Service) recoverRoom(ctx context.Context, roomMeta RoomMeta) (*state.Ro
// replay 失败说明命令日志无法被当前状态机解释,不能继续装载错误 Cell。
return nil, err
}
// room_version 是持久化事务提交后的权威版本。历史日志允许非回放命令占用版本SendGift 也可能
// 在同版本按自增 ID 收敛;仅依赖 replay 内部 Version++ 会在这些边界下产生空洞或超前。
recovered.Version = record.RoomVersion
}
return recovered, nil

View File

@ -92,6 +92,8 @@ func main() {
if _, err := client.AdminUpdateRoom(ctx, &roomv1.AdminUpdateRoomRequest{
Meta: &roomv1.RequestMeta{
AppCode: appcode.Normalize(app),
// 后台迁移仍须携带真实房主作为命令操作者Room Cell 依赖该字段完成审计和完整性校验。
ActorUserId: item.OwnerUserID,
RequestId: "room-visible-region-migration",
CommandId: migrationCommandID(item),
RoomId: item.RoomID,