現在有一套主主復制的mysql數據庫,其中有個表pvlogs是member引擎的內存表,主庫(就是vip所在的那個庫)一切正常,但是從庫報錯:The table 'pvlogs' is full,經過詢問這個問題已經持續好長時間了,我們這個表是每天都要先把數據insert 進另一個表,然后truncate掉。每天都是到111848這個數量就會報錯:The table 'pvlogs' is full。 立馬想到了控制內存表大小的兩個參數: tmp_table_size = 671088640 max_heap_table_size = 671088640 在主從庫查看得知設置是一樣的,如下所示: 主庫查看: MariaDB [log]> show VARIABLES like '%max_heap_table_size%'; +---------------------+------------+ | Variable_name | Value | +---------------------+------------+ | max_heap_table_size | 2271087616 | +---------------------+------------+ 1 row in set (0.00 sec)
MariaDB [log]> show VARIABLES like '%tmp_table_size%'; +----------------+-----------+ | Variable_name | Value | +----------------+-----------+ | tmp_table_size | 527108864 | +----------------+-----------+ 1 row in set (0.00 sec)
從庫查看: MariaDB [log]> show VARIABLES like '%max_heap_table_size%'; +---------------------+------------+ | Variable_name | Value | +---------------------+------------+ | max_heap_table_size | 2271087616 | +---------------------+------------+ 1 row in set (0.00 sec)
MariaDB [log]> show VARIABLES like '%tmp_table_size%'; +----------------+-----------+ | Variable_name | Value | +----------------+-----------+ | tmp_table_size | 527108864 | +----------------+-----------+ 1 row in set (0.00 sec)
很顯然不是這兩個參數導致的,還想到了MAX_ROWS=1000000000,表的屬性,經查看兩邊還是一樣的,靠,這就蛋疼了,如下所示: 主庫: MariaDB [log]> show create table pvlogs;
| Table | Create Table | pvlogs | CREATE TABLE `pvlogs` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `member_id` int(11) DEFAULT NULL, `jsession` bigint(20) DEFAULT NULL, `ip` bigint(20) DEFAULT NULL, `search_id` bigint(20) DEFAULT NULL, `info_id` bigint(20) DEFAULT NULL, `lastmodify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `disc` int(11) NOT NULL, `status` int(11) NOT NULL DEFAULT '0' COMMENT 'When the page(html) is open ,this attribute will set 1', PRIMARY KEY (`id`), KEY `info_id` (`info_id`), KEY `member_id` (`member_id`), KEY `ip` (`ip`) ) ENGINE=MEMORY AUTO_INCREMENT=831382377522705486 DEFAULT CHARSET=utf8 MAX_ROWS=2000000000 |
1 row in set (0.00 sec)
從庫: MariaDB [log]> show create table pvlogs; | Table | Create Table | pvlogs | CREATE TABLE `pvlogs` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `member_id` int(11) DEFAULT NULL, `jsession` int(11) DEFAULT NULL, `ip` bigint(20) DEFAULT NULL, `search_id` bigint(20) DEFAULT NULL, `info_id` bigint(20) DEFAULT NULL, `lastmodify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `disc` int(11) NOT NULL, `status` int(11) NOT NULL DEFAULT '0' COMMENT 'When the page(html) is open ,this attribute will set 1', PRIMARY KEY (`id`), KEY `info_id` (`info_id`), KEY `member_id` (`member_id`), KEY `ip` (`ip`) ) ENGINE=MEMORY AUTO_INCREMENT=223696 DEFAULT CHARSET=utf8 MAX_ROWS=2000000000 | +--------+--------------------------------------------------------------------------------------