fix(zone-warm): warm 表 UNIQUE KEY + set() 改 upsert + 原子 increment(B1/B3)
- CREATE TABLE wpdo_warm 的 meta_key varchar(255)→varchar(191), KEY idx_post_meta → UNIQUE KEY ui_post_meta:沒有這個唯一鍵, ON DUPLICATE KEY UPDATE 不會觸發,會不斷 INSERT 重複列。 (既有站台的 ALTER 遷移原本就在 installer:1329,只有 CREATE 落後) - Zone_Warm::set() 由 SELECT→update/insert 改為 TMDO_DB::upsert() - 新增 Zone_Warm::increment():CAST(COALESCE(meta_value,0) AS SIGNED)+N 原子計數,取代 get()+set() 的 read-modify-write race(A v3.3.3) - ZoneWarmTest stub 與 ZoneWarmIntegrationTest 建表同步適配 unit 379 / integration 398 GREEN Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
This commit is contained in:
@@ -1327,12 +1327,12 @@ class TMDO_Installer {
|
||||
$sqls[] = "CREATE TABLE {$p}wpdo_warm (
|
||||
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
post_id bigint(20) unsigned NOT NULL DEFAULT 0,
|
||||
meta_key varchar(255) NOT NULL DEFAULT '',
|
||||
meta_key varchar(191) NOT NULL DEFAULT '',
|
||||
meta_value longtext,
|
||||
expires_at datetime NULL DEFAULT NULL,
|
||||
created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_post_meta (post_id, meta_key(191)),
|
||||
UNIQUE KEY ui_post_meta (post_id, meta_key),
|
||||
KEY idx_expires_at (expires_at)
|
||||
) {$charset};";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user