我需要创建一个大约 8M 行的新表,而不会对使用集群的其他服务造成太多噪音。我将数据分成 100k 行的块并使用LOAD DATA LOCAL FILE
, sleep 5s 并重复。Mysql 开始消耗所有内存,直到 OOM 杀死集群节点上的 mysqld。
我究竟做错了什么??
欢迎任何关于如何进步的帮助或想法,谢谢!
InnoDB Cluster 8.0.24,三个虚拟主机上的 Ubuntu 20.04(8.0.23 的行为相同)。6 个 CPU 内核,每个 12GB 内存。与默认配置相比,唯一的配置更改是local_infile = ON
.
@Wilson 请求的附加信息(链接到 pastebin):
我正在将数据加载到我的表中:
CREATE TABLE IF NOT EXISTS `RefdataSnapshotM_20210421140303` (
`SERVICE_INFO` VARCHAR(64) NOT NULL,
`PORTING_TIME` TIMESTAMP DEFAULT NULL,
`IDN` VARCHAR(64) NOT NULL,
`PORTING_ID` VARCHAR(64) NOT NULL,
`RECIPIENT_SP_ID` CHAR(3) NOT NULL,
`DONOR_SP_ID` CHAR(3) NOT NULL,
`RECIPIENT_ROUTING_NUMBER` CHAR(3) NOT NULL,
`DONOR_ROUTING_NUMBER` CHAR(3) NOT NULL,
`PORTING_INDICATOR` VARCHAR(64) NOT NULL,
`CREATION_DATE` TIMESTAMP DEFAULT NULL,
PRIMARY KEY (`IDN`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
我如何加载数据:
LOAD DATA
LOCAL INFILE '/tmp/datasource.dat'
INTO TABLE `RefdataSnapshotM_20210421140303`
CHARACTER SET utf8mb4
(
`SERVICE_INFO`,
@var_PORTING_TIME,
@var_IDN,
`PORTING_ID`,
`RECIPIENT_SP_ID`,
`DONOR_SP_ID`,
`RECIPIENT_ROUTING_NUMBER`,
`DONOR_ROUTING_NUMBER`,
`PORTING_INDICATOR`,
@var_CREATION_DATE
)
SET `PORTING_TIME` = STR_TO_DATE(@var_PORTING_TIME, GET_FORMAT(DATETIME, 'INTERNAL')),
`IDN` = REGEXP_REPLACE(@var_IDN, '^46', '', 1),
`CREATION_DATE` = STR_TO_DATE(@var_CREATION_DATE, '%d-%m-%Y %H:%i:%s')
一些内存相关信息:
SELECT total_allocated DIV total_allocated 1024 AS FROM sys.x$memory_global_total
+-----------------+
| total_allocated |
+-----------------+
| 11366374 kB |
+-----------------+
cat /proc/<pid_of_mysql_here>/smaps_rollup
Rss: 11784296 kB
Pss: 11783545 kB
Pss_Anon: 11767256 kB
Pss_File: 16289 kB
Pss_Shmem: 0 kB
Shared_Clean: 952 kB
Shared_Dirty: 0 kB
Private_Clean: 16196 kB
Private_Dirty: 11767148 kB
Referenced: 11123016 kB
Anonymous: 11767256 kB
LazyFree: 0 kB
AnonHugePages: 0 kB
ShmemPmdMapped: 0 kB
FilePmdMapped: 0 kB
Shared_Hugetlb: 0 kB
Private_Hugetlb: 0 kB
Swap: 371376 kB
SwapPss: 371376 kB
Locked: 0 kB
SELECT SUM(current_alloc) AS total_allocated
FROM sys.x$memory_global_by_current_bytes
UNION
SELECT total_allocated
FROM sys.x$memory_global_total;
+-----------------+
| total_allocated |
+-----------------+
| 1344314202 |
| 1344251938 |
+-----------------+