[MDEV-19130] Assertion `next_insert_id >= auto_inc_interval_for_cur_row.minimum()' failed in handler::update_auto_increment after error 167 Created: 2019-04-01  Updated: 2020-11-02  Resolved: 2020-10-14

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Delete, Versioned Tables
Affects Version/s: 10.4, 10.5
Fix Version/s: 10.4.16, 10.5.7

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Fixed Votes: 0
Labels: affects-tests

Issue Links:
Blocks
Relates
relates to MDEV-21986 Unexpected error 3 "No such process" ... Open
relates to MDEV-22414 UPDATE or DELETE FOR PORTION OF incre... Closed
relates to MDEV-15800 Assertion `next_insert_id >= auto_inc... Closed
relates to MDEV-17333 Assertion in update_auto_increment() ... Closed

 Description   

Note: It might be related to, or a duplicate of, MDEV-15800 or/and MDEV-17333, and might even have nothing to do with versioning, I can't tell for sure. The stack trace is different from both bugs, so I'm filing it separately.

CREATE OR REPLACE TABLE t1 (f TINYINT AUTO_INCREMENT NULL, s TIMESTAMP, e TIMESTAMP, PERIOD FOR app(s,e), KEY (f,s));
INSERT INTO t1 (s,e) VALUES
  ('2021-08-22 10:28:43','2023-09-17 00:00:00'),
  ('2019-05-09 21:45:24','2020-04-22 14:38:49');
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) VALUES ('2015-07-07 00:00:00','2020-03-11 08:48:52');
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
--error 167
INSERT INTO t1 SELECT * FROM t1;
DELETE IGNORE FROM t1 FOR PORTION OF app FROM '2015-07-07 00:00:00' TO '2020-03-11 08:48:52';
 
# Cleanup
DROP TABLE t1;

10.4 17cbae65

mysqld: /data/src/10.4/sql/handler.cc:3438: int handler::update_auto_increment(): Assertion `next_insert_id >= auto_inc_interval_for_cur_row.minimum()' failed.
190402  0:32:05 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f1a8fa08ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055bf78eecfa0 in handler::update_auto_increment (this=0x7f1a78129508) at /data/src/10.4/sql/handler.cc:3438
#9  0x000055bf78cce058 in TABLE::update_generated_fields (this=0x7f1a781286a0) at /data/src/10.4/sql/table.cc:8307
#10 0x000055bf78cce1ad in TABLE::period_make_insert (this=0x7f1a781286a0, src=0x7f1a78015ef0, dst=0x7f1a78126950) at /data/src/10.4/sql/table.cc:8327
#11 0x000055bf78cce463 in TABLE::insert_portion_of_time (this=0x7f1a781286a0, thd=0x7f1a78000b00, period_conds=..., rows_inserted=0x7f1a89b80d90) at /data/src/10.4/sql/table.cc:8364
#12 0x000055bf7909dbed in mysql_delete (thd=0x7f1a78000b00, table_list=0x7f1a78015740, conds=0x7f1a78016b98, order_list=0x7f1a78005490, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:849
#13 0x000055bf78ba36f4 in mysql_execute_command (thd=0x7f1a78000b00) at /data/src/10.4/sql/sql_parse.cc:4985
#14 0x000055bf78bae642 in mysql_parse (thd=0x7f1a78000b00, rawbuf=0x7f1a780155d8 "DELETE IGNORE FROM t1 FOR PORTION OF app FROM '2015-07-07 00:00:00' TO '2020-03-11 08:48:52'", length=92, parser_state=0x7f1a89b82180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
#15 0x000055bf78b99dd2 in dispatch_command (command=COM_QUERY, thd=0x7f1a78000b00, packet=0x7f1a78139251 "DELETE IGNORE FROM t1 FOR PORTION OF app FROM '2015-07-07 00:00:00' TO '2020-03-11 08:48:52'", packet_length=92, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
#16 0x000055bf78b985b8 in do_command (thd=0x7f1a78000b00) at /data/src/10.4/sql/sql_parse.cc:1365
#17 0x000055bf78d123d5 in do_handle_one_connection (connect=0x55bf7c4294e0) at /data/src/10.4/sql/sql_connect.cc:1398
#18 0x000055bf78d12146 in handle_one_connection (arg=0x55bf7c4294e0) at /data/src/10.4/sql/sql_connect.cc:1301
#19 0x000055bf79207e6f in pfs_spawn_thread (arg=0x55bf7c51b8b0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#20 0x00007f1a918f7494 in start_thread (arg=0x7f1a89b83700) at pthread_create.c:333
#21 0x00007f1a8fac593f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible with at least MyISAM and InnoDB.
No obvious problem on a non-debug build.
The test case is not applicable to previous versions.



 Comments   
Comment by Elena Stepanova [ 2019-04-01 ]

A curious variation of the failure, I don't know if it deserves a separate item. The exact same test case, but with DATE instead of TIMESTAMP for period columns:

CREATE OR REPLACE TABLE t1 (f TINYINT AUTO_INCREMENT NULL, s DATE, e DATE, PERIOD FOR app(s,e), KEY (f,s));
INSERT INTO t1 (s,e) VALUES
  ('2021-08-22 10:28:43','2023-09-17 00:00:00'),
  ('2019-05-09 21:45:24','2020-04-22 14:38:49');
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) VALUES ('2015-07-07 00:00:00','2020-03-11 08:48:52');
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
INSERT INTO t1 (s,e) SELECT s,e FROM t1;
--error 167
INSERT INTO t1 SELECT * FROM t1;
DELETE IGNORE FROM t1 FOR PORTION OF app FROM '2015-07-07 00:00:00' TO '2020-03-11 08:48:52';
 
# Cleanup
DROP TABLE t1;

Instead of assertion failure, it produces this:

DELETE IGNORE FROM t1 FOR PORTION OF app FROM '2015-07-07 00:00:00' TO '2020-03-11 08:48:52';
Warnings:
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM
Warning	1030	Got error 3 "No such process" from storage engine MyISAM

or, with InnoDB accordingly

DELETE IGNORE FROM t1 FOR PORTION OF app FROM '2015-07-07 00:00:00' TO '2020-03-11 08:48:52';
Warnings:
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB
Warning	1030	Got error 3 "No such process" from storage engine InnoDB

Comment by Elena Stepanova [ 2020-05-11 ]

It may be related to MDEV-22414.

Here is a shorter test case:

CREATE TABLE t1 (id INT AUTO_INCREMENT, f INT, s DATETIME, e DATETIME, PERIOD FOR p(s,e), PRIMARY KEY(id));
INSERT INTO t1 (s,e) VALUES ('1994-01-06','2004-11-30'),('1994-06-21','1997-06-20');
UPDATE IGNORE t1 SET id = 2429681664;
UPDATE IGNORE t1 FOR PORTION OF p FROM '1995-07-06' TO '2009-01-12' SET f = 1;
 
# Cleanup
DROP TABLE t1;

10.5 cfe5ee90

mariadbd: /data/src/10.5/sql/handler.cc:3446: int handler::update_auto_increment(): Assertion `next_insert_id >= auto_inc_interval_for_cur_row.minimum()' failed.
200511 21:35:16 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f2878d01f12 in __GI___assert_fail (assertion=0x55bb7b2f2208 "next_insert_id >= auto_inc_interval_for_cur_row.minimum()", file=0x55bb7b2f0bde "/data/src/10.5/sql/handler.cc", line=3446, function=0x55bb7b2f44c0 <handler::update_auto_increment()::__PRETTY_FUNCTION__> "int handler::update_auto_increment()") at assert.c:101
#8  0x000055bb7a6caf7b in handler::update_auto_increment (this=0x7f2858211770) at /data/src/10.5/sql/handler.cc:3446
#9  0x000055bb7a4ba666 in TABLE::update_generated_fields (this=0x7f28582108f8) at /data/src/10.5/sql/table.cc:8597
#10 0x000055bb7a4ba7bb in TABLE::period_make_insert (this=0x7f28582108f8, src=0x7f2858013aa8, dst=0x7f28580fbca0) at /data/src/10.5/sql/table.cc:8617
#11 0x000055bb7a4ba9eb in TABLE::insert_portion_of_time (this=0x7f28582108f8, thd=0x7f2858000b18, period_conds=..., rows_inserted=0x7f287409f8e0) at /data/src/10.5/sql/table.cc:8647
#12 0x000055bb7a490803 in mysql_update (thd=0x7f2858000b18, table_list=0x7f2858013c20, fields=..., values=..., conds=0x7f2858015150, order_num=0, order=0x0, limit=18446744073709551614, ignore=true, found_return=0x7f287409ff80, updated_return=0x7f28740a0050) at /data/src/10.5/sql/sql_update.cc:1090
#13 0x000055bb7a36f5c8 in mysql_execute_command (thd=0x7f2858000b18) at /data/src/10.5/sql/sql_parse.cc:4370
#14 0x000055bb7a37b860 in mysql_parse (thd=0x7f2858000b18, rawbuf=0x7f2858013950 "UPDATE IGNORE t1 FOR PORTION OF p FROM '1995-07-06' TO '2009-01-12' SET f = 1", length=77, parser_state=0x7f28740a0520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7957
#15 0x000055bb7a367b68 in dispatch_command (command=COM_QUERY, thd=0x7f2858000b18, packet=0x7f28581b0409 "UPDATE IGNORE t1 FOR PORTION OF p FROM '1995-07-06' TO '2009-01-12' SET f = 1", packet_length=77, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1840
#16 0x000055bb7a3662fa in do_command (thd=0x7f2858000b18) at /data/src/10.5/sql/sql_parse.cc:1359
#17 0x000055bb7a509883 in do_handle_one_connection (connect=0x55bb7dc779f8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411
#18 0x000055bb7a5095eb in handle_one_connection (arg=0x55bb7dc779f8) at /data/src/10.5/sql/sql_connect.cc:1313
#19 0x000055bb7aa3eea0 in pfs_spawn_thread (arg=0x55bb7dc03408) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#20 0x00007f287ac8a4a4 in start_thread (arg=0x7f28740a1700) at pthread_create.c:456
#21 0x00007f2878dbed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

The problem affects testing for WITHOUT OVERLAPS. Out of range errors do happen, they are hard to prevent in random/concurrent tests. Otherwise, there is nothing special in the test case.

Generated at Thu Feb 08 08:49:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.