forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(load): fix mysqld crash when columns contains double enclosed cha…
…r. (stoneatom#1263) [summary] 1. crash reason is the loader column number each time is not 65535 but report 65535; occurs when using limit clause or duplicate key; 2. support double enclosed char, ref:https://dev.mysql.com/doc/refman/5.7/en/load-data.html
- Loading branch information
lujiashun
committed
Feb 3, 2023
1 parent
4b2f0f7
commit 87af55d
Showing
6 changed files
with
65,755 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
DROP DATABASE IF EXISTS issue1263_test; | ||
CREATE DATABASE issue1263_test; | ||
USE issue1263_test; | ||
# | ||
# load data exceeding 65553 rows with duplicate key | ||
# | ||
CREATE TABLE AD_PINSTANCE_LOG_P(ID bigint, PRIMARY KEY (ID)) ENGINE=tianmu; | ||
load data infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1263-1.txt' into table AD_PINSTANCE_LOG_P | ||
FIELDS TERMINATED BY ',' | ||
ENCLOSED BY '"' | ||
LINES TERMINATED BY '\n' | ||
(@ID) | ||
set | ||
ID=NULLif(@ID,'') | ||
; | ||
select count(*) from AD_PINSTANCE_LOG_P; | ||
count(*) | ||
65542 | ||
# | ||
# load data exceeding 65553 rows with limit lines clause | ||
# | ||
CREATE TABLE AD_PINSTANCE_LOG(ID bigint) ENGINE=tianmu; | ||
load data infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1263-1.txt' into table AD_PINSTANCE_LOG | ||
FIELDS TERMINATED BY ',' | ||
ENCLOSED BY '"' | ||
LINES TERMINATED BY '\n' | ||
IGNORE 30 LINES | ||
(@ID) | ||
set | ||
ID=NULLif(@ID,'') | ||
; | ||
select count(*) from AD_PINSTANCE_LOG; | ||
count(*) | ||
65513 | ||
# | ||
# load data whose columns contains double enclosed char | ||
# | ||
CREATE TABLE AD_PINSTANCE_LOG_DOUBLE_ENCLOSED(ID bigint , | ||
AD_CLIENT_ID bigint, | ||
AD_ORG_ID bigint, | ||
AD_PINSTANCE_ID bigint, | ||
P_DATE DATETIME DEFAULT null, | ||
P_MSG VARCHAR(255), | ||
OWNERID bigint, | ||
MODIFIERID bigint, | ||
CREATIONDATE DATETIME, | ||
MODIFIEDDATE DATETIME, | ||
ISACTIVE CHAR(1) DEFAULT 'Y' NOT NULL, | ||
PRIMARY KEY (ID)) engine=tianmu; | ||
load data infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1263-2.txt' into table AD_PINSTANCE_LOG_DOUBLE_ENCLOSED | ||
FIELDS TERMINATED BY ',' | ||
ENCLOSED BY '"' | ||
LINES TERMINATED BY '\n' | ||
( | ||
@ID, | ||
@AD_CLIENT_ID, | ||
@AD_ORG_ID, | ||
@AD_PINSTANCE_ID, | ||
@P_DATE, | ||
@P_MSG, | ||
@OWNERID, | ||
@MODIFIERID, | ||
@CREATIONDATE, | ||
@MODIFIEDDATE, | ||
@ISACTIVE | ||
) | ||
set | ||
ID=NULLif(@ID,''), | ||
AD_CLIENT_ID=NULLif(@AD_CLIENT_ID,''), | ||
AD_ORG_ID=NULLif(@AD_ORG_ID,''), | ||
AD_PINSTANCE_ID=NULLif(@AD_PINSTANCE_ID,''), | ||
P_DATE=NULLif(@P_DATE,''), | ||
P_MSG=NULLif(@P_MSG,''), | ||
OWNERID=NULLif(@OWNERID,''), | ||
MODIFIERID=NULLif(@MODIFIERID,''), | ||
CREATIONDATE=NULLif(@CREATIONDATE,''), | ||
MODIFIEDDATE=NULLif(@MODIFIEDDATE,''), | ||
ISACTIVE=NULLif(@ISACTIVE,'') | ||
; | ||
select * from AD_PINSTANCE_LOG_DOUBLE_ENCLOSED; | ||
ID AD_CLIENT_ID AD_ORG_ID AD_PINSTANCE_ID P_DATE P_MSG OWNERID MODIFIERID CREATIONDATE MODIFIEDDATE ISACTIVE | ||
765893 37 27 44221 2021-06-28 02:01:16 计算售罄率出错:ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMITORA-06512: at "BOSNDS3.O2O_STORESALERATE_SET", line 49 | ||
893 893 2021-06-28 02:01:10 2021-06-28 02:01:10 Y | ||
DROP DATABASE issue1263_test; |
Oops, something went wrong.