Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: ALTER table..MODIFY, Got error from storage engine #752

Closed
2 of 3 tasks
davidshiz opened this issue Oct 19, 2022 · 5 comments
Closed
2 of 3 tasks

bug: ALTER table..MODIFY, Got error from storage engine #752

davidshiz opened this issue Oct 19, 2022 · 5 comments
Assignees
Labels
A-bug Something isn't working A-feature feature with good idea B-DDL DDL related issues

Comments

@davidshiz
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

there are 1000001 rows in the table delete_test;

mysql> desc delete_test;
+-------------+---------------+------+-----+---------+-------+
| Field       | Type          | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+-------+
| c_int       | int(11)       | YES  |     | NULL    |       |
| c_smallint  | smallint(6)   | YES  |     | NULL    |       |
| c_mediumint | mediumint(9)  | YES  |     | NULL    |       |
| c_bigint    | bigint(20)    | YES  |     | NULL    |       |
| c_float     | float         | YES  |     | NULL    |       |
| c_double    | double        | YES  |     | NULL    |       |
| c_decimal   | decimal(10,5) | YES  |     | NULL    |       |
| c_date      | date          | YES  |     | NULL    |       |
| c_datetime  | datetime      | YES  |     | NULL    |       |
| c_timestamp | timestamp     | YES  |     | NULL    |       |
| c_time      | time          | YES  |     | NULL    |       |
| c_char      | char(10)      | YES  |     | NULL    |       |
| c_varchar   | varchar(100)  | YES  |     | NULL    |       |
| c_blob      | blob          | YES  |     | NULL    |       |
| c_text      | text          | YES  |     | NULL    |       |
| c_longblob  | longblob      | YES  |     | NULL    |       |
+-------------+---------------+------+-----+---------+-------+
16 rows in set (0.00 sec)

mysql> alter table delete_test modify c_bigint int(11);
ERROR 1030 (HY000): Got error 1 from storage engine

Expected behavior

No response

How To Reproduce

CREATE TABLE `delete_test` (
  `c_int` int DEFAULT NULL,
  `c_smallint` smallint(6) DEFAULT NULL,
  `c_mediumint` mediumint(9) DEFAULT NULL,
  `c_bigint` bigint(20) DEFAULT NULL,
  `c_float` float DEFAULT NULL,
  `c_double` double DEFAULT NULL,
  `c_decimal` decimal(10,5) DEFAULT NULL,
  `c_date` date DEFAULT NULL,
  `c_datetime` datetime DEFAULT NULL,
  `c_timestamp` timestamp NULL DEFAULT NULL,
  `c_time` time DEFAULT NULL,
  `c_char` char(10) DEFAULT NULL,
  `c_varchar` varchar(100) DEFAULT NULL,
  `c_blob` blob,
  `c_text` text,
  `c_longblob` longblob
) ENGINE=TIANMU;
drop procedure doinsert;
delimiter //
create procedure doinsert()
begin
 declare i int;  
 set i = 0; 
while(i<=1000000) do
  insert into delete_test(c_int,c_smallint,c_mediumint,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text)
values(i,105,105,i,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom',CONCAT('hello',i),'bcdefghijklmn');
  set i = i+1; 
end while;  
end;//
delimiter ;
call doinsert();
alter table delete_test modify c_bigint int(11);

Environment

ubuntu@ubuntu:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"

ubuntu@ubuntu:~$ /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld Ver 5.7.36-StoneDB for Linux on x86_64 (build-)
build information as follow:
Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
Branch name: stonedb-5.7-dev
Last commit ID: 5d996f9
Last commit time: Date: Sat Oct 8 14:34:42 2022 +0800
Build time: Date: Fri 14 Oct 2022 12:28:00 PM UTC

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@davidshiz davidshiz added the A-bug Something isn't working label Oct 19, 2022
@DandreChen
Copy link
Collaborator

ACK

@DandreChen
Copy link
Collaborator

the problem same as #366

@DandreChen
Copy link
Collaborator

test case:

CREATE TABLE t_test(
id INT NOT NULL AUTO_INCREMENT,
first_name VARCHAR(10) NOT NULL,
last_name VARCHAR(10) NOT NULL,
sex VARCHAR(5) NOT NULL,
score INT NOT NULL,
copy_id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=TIANMU;

drop PROCEDURE add_user;
DELIMITER //
create PROCEDURE add_user(in num INT)
BEGIN
DECLARE rowid INT DEFAULT 0;
DECLARE firstname CHAR(1);
DECLARE name1 CHAR(1);
DECLARE name2 CHAR(1);
DECLARE lastname VARCHAR(3) DEFAULT '';
DECLARE sex CHAR(1);
DECLARE score CHAR(2);
WHILE rowid < num DO
SET rowid = rowid + 1;
insert INTO t_test (first_name,last_name,sex,score,copy_id) VALUES ("找师傅","寻师傅","1",100,rowid);
END WHILE;
END //
DELIMITER ;

call add_user(2000);

alter table t_test engine=InnoDB;

alter table t_test engine=tianmu;

@DandreChen
Copy link
Collaborator

Simplify test case :

CREATE TABLE t_test(
firstname VARCHAR(10) NOT NULL
) ENGINE=TIANMU;

drop PROCEDURE add_user;
DELIMITER //
create PROCEDURE add_user(in num INT)
BEGIN
DECLARE rowid INT DEFAULT 0;
WHILE rowid < num DO
SET rowid = rowid + 1;
insert INTO t_test (firstname) VALUES ("你好");
END WHILE;
END //
DELIMITER ;

call add_user(10);

alter table t_test engine=InnoDB;

alter table t_test engine=tianmu;

@DandreChen
Copy link
Collaborator

three records test:

driect insert result, DATA file:

0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0004000 0006 0000 0000 0000 0000 0000 0000 0000
0004010 0000 0000 0000 0000 0000 0000 0000 0000
*
0024000 bde4 e5a0 bda5 0000 0000 0000 0000 0000
0024010 0000 0000 0000 0000 0000 0000 0000 0000
*
0028000 0000 0000 0000 0006 0006 0000 0000 0000
0028010 0000 0000 0000 0000 0000 0000 0000 0000
*
0048000 0000 0000 0000 bde4 e5a0 bda5 bde4 e5a0
0048010 bda5 0000 0000 0000 0000 0000 0000 0000
0048020 0000 0000 0000 0000 0000 0000 0000 0000
*
004c010 0000 0006 0006 0006 0000 0000 0000 0000
004c020 0000 0000 0000 0000 0000 0000 0000 0000
*
006c010 0000 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
006c020 e5a0 bda5
006c024

alter table result, DATA file:

0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0004000 0006 0000 0000 0000 0000 0000 0000 0000
0004010 0000 0000 0000 0000 0000 0000 0000 0000
*
0024000 bde4 e5a0 bda5 0000 0000 0000 0000 0000
0024010 0000 0000 0000 0000 0000 0000 0000 0000
*
0028000 0000 0000 0000 0006 0006 0000 0000 0000
0028010 0000 0000 0000 0000 0000 0000 0000 0000
*
0048000 0000 0000 0000 bde4 e5a0 bda5 bde4 e5a0
0048010 bda5 0000 0000 0000 0000 0000 0000 0000
0048020 0000 0000 0000 0000 0000 0000 0000 0000
*
004c010 0000 0006 0006 0006 0000 0000 0000 0000
004c020 0000 0000 0000 0000 0000 0000 0000 0000
*
006c010 0000 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
006c020 e5a0 bda5
006c024

ten records test:

driect insert result, DATA file:

0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0004000 0006 0000 0000 0000 0000 0000 0000 0000
0004010 0000 0000 0000 0000 0000 0000 0000 0000
*
0024000 bde4 e5a0 bda5 0000 0000 0000 0000 0000
0024010 0000 0000 0000 0000 0000 0000 0000 0000
*
0028000 0000 0000 0000 0006 0006 0006 0006 0006
0028010 0006 0006 0006 0000 0000 0000 0000 0000
0028020 0000 0000 0000 0000 0000 0000 0000 0000
*
0048000 0000 0000 0000 bde4 e5a0 bda5 bde4 e5a0
0048010 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
0048020 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5
0048030 bde4 e5a0 bda5 0000 0000 0000 0000 0000
0048040 0000 0000 0000 0000 0000 0000 0000 0000
*
004c030 0000 0000 0000 0006 0006 0006 0006 0006
004c040 0006 0006 0006 0006 0000 0000 0000 0000
004c050 0000 0000 0000 0000 0000 0000 0000 0000
*
006c030 0000 0000 0000 bde4 e5a0 bda5 bde4 e5a0
006c040 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
006c050 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5
006c060 bde4 e5a0 bda5 bde4 e5a0 bda5 0000 0000
006c070 0000 0000 0000 0000 0000 0000 0000 0000
*
0070060 0000 0000 0000 0000 0000 0000 0006 0006
0070070 0006 0006 0006 0006 0006 0006 0006 0006
0070080 0000 0000 0000 0000 0000 0000 0000 0000
*
0090060 0000 0000 0000 0000 0000 0000 bde4 e5a0
0090070 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
0090080 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5
0090090 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0
00900a0 bda5 bde4 e5a0 bda5
00900a8

alter table result, DATA file:

0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0004000 0006 0000 0000 0000 0000 0000 0000 0000
0004010 0000 0000 0000 0000 0000 0000 0000 0000
*
0024000 bde4 e5a0 bda5 0000 0000 0000 0000 0000
0024010 0000 0000 0000 0000 0000 0000 0000 0000
*
0028000 0000 0000 0000 0006 0006 0000 0000 0000
0028010 0000 0000 0000 0000 0000 0000 0000 0000
*
0048000 0000 0000 0000 bde4 e5a0 bda5 bde4 e5a0
0048010 bda5 0000 0000 0000 0000 0000 0000 0000
0048020 0000 0000 0000 0000 0000 0000 0000 0000
*
004c010 0000 0006 0006 0006 0000 0000 0000 0000
004c020 0000 0000 0000 0000 0000 0000 0000 0000
*
006c010 0000 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
006c020 e5a0 bda5 0000 0000 0000 0000 0000 0000
006c030 0000 0000 0000 0000 0000 0000 0000 0000
*
0070020 0000 0000 0006 0006 0006 0006 0000 0000
0070030 0000 0000 0000 0000 0000 0000 0000 0000
*
0090020 0000 0000 bde4 e5a0 bda5 bde4 e5a0 bda5
0090030 bde4 e5a0 bda5 bde4 e5a0 bda5 0000 0000
0090040 0000 0000 0000 0000 0000 0000 0000 0000
*
0094030 0000 0000 0000 0000 0000 0000 0006 0006
0094040 0006 0006 0006 0000 0000 0000 0000 0000
0094050 0000 0000 0000 0000 0000 0000 0000 0000
*
00b4030 0000 0000 0000 0000 0000 0000 bde4 e5a0
00b4040 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
00b4050 e5a0 bda5 bde4 e5a0 bda5 0000 0000 0000
00b4060 0000 0000 0000 0000 0000 0000 0000 0000
*
00b8050 0000 0000 0000 0000 0000 0006 0006 0006
00b8060 0006 0006 0006 0000 0000 0000 0000 0000
00b8070 0000 0000 0000 0000 0000 0000 0000 0000
*
00d8050 0000 0000 0000 0000 0000 bde4 e5a0 bda5
00d8060 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0
00d8070 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5 0000
00d8080 0000 0000 0000 0000 0000 0000 0000 0000
*
00dc070 0000 0000 0000 0000 0000 0000 0000 0006
00dc080 0006 0006 0006 0006 0006 0006 0000 0000
00dc090 0000 0000 0000 0000 0000 0000 0000 0000
*
00fc070 0000 0000 0000 0000 0000 0000 0000 bde4
00fc080 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5
00fc090 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0
00fc0a0 bda5 bde4 e5a0 bda5 0000 0000 0000 0000
00fc0b0 0000 0000 0000 0000 0000 0000 0000 0000
*
01000a0 0000 0000 0000 0000 0006 0006 0006 0006
01000b0 0006 0006 0006 0006 0000 0000 0000 0000
01000c0 0000 0000 0000 0000 0000 0000 0000 0000
*
01200a0 0000 0000 0000 0000 bde4 e5a0 bda5 bde4
01200b0 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5
01200c0 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0
01200d0 bda5 bde4 e5a0 bda5 0000 0000 0000 0000
01200e0 0000 0000 0000 0000 0000 0000 0000 0000
*
01240d0 0000 0000 0000 0000 0006 0006 0006 0006
01240e0 0006 0006 0006 0006 0006 0000 0000 0000
01240f0 0000 0000 0000 0000 0000 0000 0000 0000
*
01440d0 0000 0000 0000 0000 bde4 e5a0 bda5 bde4
01440e0 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5
01440f0 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0
0144100 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5 0000
0144110 0000 0000 0000 0000 0000 0000 0000 0000
*
0148100 0000 0000 0000 0000 0000 0000 0000 0006
0148110 0006 0006 0006 0006 0006 0006 0006 0006
0148120 0006 0000 0000 0000 0000 0000 0000 0000
0148130 0000 0000 0000 0000 0000 0000 0000 0000
*
0168100 0000 0000 0000 0000 0000 0000 0000 bde4
0168110 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5
0168120 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4 e5a0
0168130 bda5 bde4 e5a0 bda5 bde4 e5a0 bda5 bde4
0168140 e5a0 bda5 bde4 e5a0 bda5
016814a

@wisehead wisehead added prio: low Low priority A-feature feature with good idea and removed prio: low Low priority labels Dec 14, 2022
@wisehead wisehead added the B-DDL DDL related issues label Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working A-feature feature with good idea B-DDL DDL related issues
Projects
None yet
Development

No branches or pull requests

4 participants