[MDEV-16000] Error on partitioning by virtual column Created: 2018-04-24  Updated: 2018-06-12  Resolved: 2018-06-12

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Virtual Columns
Affects Version/s: 10.1.33, 10.2.15, 10.3.7
Fix Version/s: 10.2.15, 10.3.7

Type: Bug Priority: Major
Reporter: Matthias Leich Assignee: Sergei Golubchik
Resolution: Duplicate Votes: 0
Labels: None
Environment:

IMHO not important (OpenSuSE 42.3)


Issue Links:
Duplicate
is duplicated by MDEV-15626 Assertion on update virtual column in... Closed

 Description   

10.1 commit 31a19683f5289f08439b848da23a28f49ff0accc
– 10.1.33-MariaDB-debug
10.2 commit 87af52d7dd733e71fc7a9e39b882a4fd44f41fec
– 10.2.15-MariaDB-debug
10.3 commit 8fce4065e542ad64438d45f60421241dd383815f
– 10.3.7-MariaDB-debug

CREATE TABLE test . t1 ( c1 INT, c2 INT AS (c1) VIRTUAL );
INSERT INTO test . t1 (c1) VALUES(1);
COMMIT ;
ALTER TABLE test . t1 ENGINE = InnoDB PARTITION BY KEY(c2) PARTITIONS 4 ;
SHOW CREATE TABLE t1;
Table   Create Table
t1      CREATE TABLE `t1` (
  `c1` int(11) DEFAULT NULL,
  `c2` int(11) AS (c1) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (c2)
PARTITIONS 4 */
CHECK TABLE t1 EXTENDED;

Table   Op      Msg_type        Msg_text
test.t1 check   error   Found a misplaced row
test.t1 check   error   Partition p0 returned error
test.t1 check   error   Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!

The same test works well for c2 INT AS (c1) PERSISTENT.



 Comments   
Comment by Matthias Leich [ 2018-04-24 ]

The bug was found when running an RQG test generating roughly the same DDL/DML but concurrent.
There the server asserted with
mysqld: <tree>/sql/ha_partition.cc:4489: virtual int ha_partition::delete_row(const uchar*): Assertion `part_id == m_last_part' failed.
mysys/stacktrace.c:269(my_print_stacktrace)[0x557a07418fe9]
sql/signal_handler.cc:168(handle_fatal_signal)[0x557a06c6c413]
/lib64/libpthread.so.0(+0x10c10)[0x7fc3c5a3ac10]
/lib64/libc.so.6(gsignal+0x37)[0x7fc3c385bf67]
/lib64/libc.so.6(abort+0x13a)[0x7fc3c385d33a]
/lib64/libc.so.6(+0x2dd66)[0x7fc3c3854d66]
/lib64/libc.so.6(+0x2de12)[0x7fc3c3854e12]
sql/ha_partition.cc:4491(ha_partition::delete_row(unsigned char const*))[0x557a073d3bdc]
sql/handler.cc:6285(handler::ha_delete_row(unsigned char const*))[0x557a06c7d607]
sql/sql_delete.cc:253(TABLE::delete_row())[0x557a06e117bb]
sql/sql_delete.cc:748(mysql_delete(THD*, TABLE_LIST*, Item*, SQL_I_List<st_order>, unsigned long long, unsigned long long, select_result))[0x557a06e0eb63]
sql/sql_parse.cc:4922(mysql_execute_command(THD*))[0x557a0698a14a]
sql/sql_parse.cc:8001(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x557a06993b8c]
sql/sql_parse.cc:1848(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x557a069813b0]
sql/sql_parse.cc:1391(do_command(THD*))[0x557a0697fdfc]
sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x557a06ae3635]
sql/sql_connect.cc:1309(handle_one_connection)[0x557a06ae33c2]
/lib64/libpthread.so.0(+0x8724)[0x7fc3c5a32724]
/lib64/libc.so.6(clone+0x6d)[0x7fc3c3913e8d]

Query (0x7fc328012c10): DELETE FROM test.t1 /* E_R Thread2 QNO 60 CON_ID 16 */

There is no separate bug report for that assert because I assume the base reason for the assert
is the same like for the current bug. So please show up when having a fix for the current bug
and than I will rerun my RQG test.
RQG grammar:
query:
DELETE FROM test . t1 ; INSERT INTO test . t1 (c1) VALUES(1),(2),(3),(4),(5),(6) ; COMMIT ;

thread_connect:
SET SESSION SQL_MODE = 'traditional' ; SET AUTOCOMMIT = 0 ; SET SESSION lock_wait_timeout = 100 ; SELECT SLEEP(5);

thread1:
ALTER TABLE test . t1 ENGINE = InnoDB PARTITION BY KEY(c2) PARTITIONS 4 ;

thread1_init:
SET SESSION lock_wait_timeout = 20 ; SET SESSION innodb_lock_wait_timeout = 10 ; CREATE TABLE test . t1 ( c1 INT, c2 INT AS (c1) VIRTUAL );

Comment by Thirunarayanan Balathandayuthapani [ 2018-04-24 ]

Given scenario have nothing to do with InnoDB. I am able to repeat it with myisam, aria engine.
Given alter also does copy and virtual column doesn't have any index associated with it.

Comment by Sergei Golubchik [ 2018-06-12 ]

already fixed

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