现在有一套主主复制的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 | +--------+--------------------------------------------------------------------------------------