Skip to content

Commit c86032f

Browse files
authored
Convert PlayerBots tables to InnoDB (mod-playerbots#2083)
Convert PlayerBots tables to InnoDB (disable strict mode during conversion) # Pull Request ### This change converts the PlayerBots-related tables from MyISAM to InnoDB. **Why this is beneficial (even without fixing a specific bug):** - Crash safety & data integrity: InnoDB is transactional and uses redo logs; it provides automatic crash recovery, unlike MyISAM which can require manual repairs after unclean shutdowns. - Row-level locking: InnoDB reduces write contention and improves concurrency under bot-heavy workloads compared to MyISAM’s table-level locks. - Consistent reads: InnoDB supports MVCC, enabling stable reads while writes are happening—useful for mixed read/write access patterns. - Operational robustness: Better behavior under backup/restore and replication scenarios; fewer “table marked as crashed” style issues. Strict mode handling: The migration toggles innodb_strict_mode off only for the session to prevent the conversion from failing on edge-case legacy definitions, then re-enables it immediately after. --- ## How to Test the Changes - Step-by-step instructions to test the change Run the SQL script in the Playerbot database. - Any required setup (e.g. multiple players, bots, specific configuration) No - Expected behavior and how to verify it All tables should now have been converted from InnoDB to MyISAM. This script should return nothing: ``` SELECT t.TABLE_SCHEMA AS db_name, t.TABLE_NAME AS table_name, t.ENGINE AS storage_engine FROM information_schema.TABLES t WHERE t.TABLE_SCHEMA = DATABASE() -- With phpMyAdmin, use the following and insert your database name, e.g., “acore_playerbots.” -- WHERE t.TABLE_SCHEMA = 'YOUR_PLAYERBOT_DB' AND t.TABLE_TYPE = 'BASE TABLE' AND t.ENGINE = 'MyISAM' ORDER BY t.TABLE_NAME; ``` ## Complexity & Impact - Does this change add new decision branches? - [x] No - [ ] Yes (**explain below**) - Does this change increase per-bot or per-tick processing? - [x] No - [ ] Yes (**describe and justify impact**) - Could this logic scale poorly under load? - [x] No - [ ] Yes (**explain why**) --- ## Defaults & Configuration - Does this change modify default bot behavior? - [x] No - [ ] Yes (**explain why**) --- ## AI Assistance - Was AI assistance (e.g. ChatGPT or similar tools) used while working on this change? - [x] No - [ ] Yes (**explain below**) --- ## Final Checklist - [x] Stability is not compromised - [x] Performance impact is understood, tested, and acceptable - [ ] Documentation updated if needed - [x] I tested this script on a server with 2000 bots for 6 days (running 24/h) and had no issues with it. --- ## Notes for Reviewers Anything that significantly improves realism at the cost of stability or performance should be carefully discussed before merging.
1 parent ba83525 commit c86032f

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Temporarily disables innodb_strict_mode for the session to allow the script to complete even if legacy table definitions contain InnoDB-incompatible attributes
2+
SET SESSION innodb_strict_mode = 0;
3+
4+
-- Change the tables to InnoDB
5+
ALTER TABLE playerbots_guild_names ENGINE=InnoDB;
6+
ALTER TABLE playerbots_names ENGINE=InnoDB;
7+
8+
-- Re-enables innodb_strict_mode
9+
SET SESSION innodb_strict_mode = 1;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Temporarily disables innodb_strict_mode for the session to allow the script to complete even if legacy table definitions contain InnoDB-incompatible attributes
2+
SET SESSION innodb_strict_mode = 0;
3+
4+
-- Change the tables to InnoDB
5+
ALTER TABLE playerbots_dungeon_suggestion_abbrevation ENGINE=InnoDB;
6+
ALTER TABLE playerbots_dungeon_suggestion_definition ENGINE=InnoDB;
7+
ALTER TABLE playerbots_dungeon_suggestion_strategy ENGINE=InnoDB;
8+
ALTER TABLE playerbots_equip_cache ENGINE=InnoDB;
9+
ALTER TABLE playerbots_item_info_cache ENGINE=InnoDB;
10+
ALTER TABLE playerbots_rarity_cache ENGINE=InnoDB;
11+
ALTER TABLE playerbots_rnditem_cache ENGINE=InnoDB;
12+
ALTER TABLE playerbots_tele_cache ENGINE=InnoDB;
13+
ALTER TABLE playerbots_travelnode ENGINE=InnoDB;
14+
ALTER TABLE playerbots_travelnode_link ENGINE=InnoDB;
15+
ALTER TABLE playerbots_travelnode_path ENGINE=InnoDB;
16+
17+
-- Re-enables innodb_strict_mode
18+
SET SESSION innodb_strict_mode = 1;

0 commit comments

Comments
 (0)