feat: recover poll activations within original round budgets

This commit is contained in:
2026-09-18 05:40:08 +08:00
parent 1d1a441167
commit 56b9a2ccfe
32 changed files with 1051 additions and 65 deletions

View File

@@ -0,0 +1,8 @@
-- 查询恢复保留业务轮次编号及同轮历史尝试,不引入外键或重新计算截止。
ALTER TABLE weave_poll_states
ADD COLUMN first_round INT UNSIGNED NOT NULL DEFAULT 1 COMMENT '本激活保存的首个业务查询轮次;人工恢复沿用原轮次,不从1重新计数',
ADD COLUMN first_round_attempts_used INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '首个业务轮次在旧激活中已消耗的执行尝试数;新任务只获得原单轮预算的剩余部分',
ADD CONSTRAINT ck_poll_recovery_budget CHECK (first_round BETWEEN 1 AND max_rounds AND first_round_attempts_used < max_attempts_per_round AND ((used_rounds=0 AND first_round=1 AND first_round_attempts_used=0) OR first_round<=used_rounds));
ALTER TABLE weave_poll_rounds
MODIFY COLUMN `round` INT UNSIGNED NOT NULL COMMENT '业务查询轮次编号,从首次激活起连续计数;人工恢复同一轮时保留编号,由激活身份区分对应任务';