LevelDB Storage Engine MS2 (MDEV-4201)

[MDEV-4313] LevelDB: Server crashes in LDBSE_KEYDEF::setup on dropping the primary key column Created: 2013-03-22  Updated: 2013-03-24  Resolved: 2013-03-24

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Technical task Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: leveldb

Issue Links:
Relates

 Description   

CREATE TABLE t1 (pk INT PRIMARY KEY, i INT NOT NULL, KEY(i)) ENGINE=LevelDB;
ALTER TABLE t1 DROP COLUMN `pk`;

#3  <signal handler called>
#4  0x0000000000b09cff in LDBSE_KEYDEF::setup (this=0x110079656b5f3866, tbl=0x7f472c015ae0) at mysql-5.6-leveldb/storage/leveldb/ldb_datadic.cc:61
#5  0x0000000000b04298 in ha_leveldb::open (this=0x7f472c012970, name=0x7f472c0166c0 "./test/#sql-e71_2", mode=2, test_if_locked=2) at mysql-5.6-leveldb/storage/leveldb/ha_leveldb.cc:800
#6  0x000000000061971b in handler::ha_open (this=0x7f472c012970, table_arg=0x7f472c015ae0, name=0x7f472c0166c0 "./test/#sql-e71_2", mode=2, test_if_locked=2) at mysql-5.6-leveldb/sql/handler.cc:2421
#7  0x000000000085826c in open_table_from_share (thd=0x2b3cd20, share=0x7f472c0163a8, alias=0x7f476808eba0 "#sql-e71_2", db_stat=7, prgflag=44, ha_open_flags=0, outparam=0x7f472c015ae0, is_create_table=false) at mysql-5.6-leveldb/sql/table.cc:2267
#8  0x000000000073fb20 in open_table_uncached (thd=0x2b3cd20, path=0x7f476808f40c "./test/#sql-e71_2", db=0x7f472c0055f8 "test", table_name=0x7f476808eba0 "#sql-e71_2", add_to_temporary_tables_list=true, open_in_engine=true) at mysql-5.6-leveldb/sql/sql_base.cc:6080
#9  0x000000000080f1c0 in mysql_alter_table (thd=0x2b3cd20, new_db=0x7f472c0055f8 "test", new_name=0x0, create_info=0x7f47680903c0, table_list=0x7f472c0050a0, alter_info=0x7f47680904a0, order_num=0, order=0x0, ignore=false) at mysql-5.6-leveldb/sql/sql_table.cc:8092
#10 0x00000000009455cc in Sql_cmd_alter_table::execute (this=0x7f472c005628, thd=0x2b3cd20) at mysql-5.6-leveldb/sql/sql_alter.cc:313
#11 0x00000000007a5d31 in mysql_execute_command (thd=0x2b3cd20) at mysql-5.6-leveldb/sql/sql_parse.cc:4839
#12 0x00000000007a8be7 in mysql_parse (thd=0x2b3cd20, rawbuf=0x7f472c004fb0 "ALTER TABLE C DROP COLUMN `pk2`", length=31, parser_state=0x7f4768092110) at mysql-5.6-leveldb/sql/sql_parse.cc:6117
#13 0x000000000079c9a3 in dispatch_command (command=COM_QUERY, thd=0x2b3cd20, packet=0x2c46a61 "ALTER TABLE C DROP COLUMN `pk2`", packet_length=31) at mysql-5.6-leveldb/sql/sql_parse.cc:1312
#14 0x000000000079bb66 in do_command (thd=0x2b3cd20) at mysql-5.6-leveldb/sql/sql_parse.cc:1036
#15 0x0000000000766e09 in do_handle_one_connection (thd_arg=0x2b3cd20) at mysql-5.6-leveldb/sql/sql_connect.cc:969
#16 0x000000000076682e in handle_one_connection (arg=0x2b3cd20) at mysql-5.6-leveldb/sql/sql_connect.cc:885
#17 0x0000000000af6924 in pfs_spawn_thread (arg=0x2aee070) at mysql-5.6-leveldb/storage/perfschema/pfs.cc:1853
#18 0x00007f4769588e9a in start_thread (arg=0x7f4768093700) at pthread_create.c:308
#19 0x00007f4768aa3cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

revision-id: psergey@askmonty.org-20130321202952-we4dnb3u2snr1vxz
revno: 4612
branch-nick: mysql-5.6-leveldb



 Comments   
Comment by Elena Stepanova [ 2013-03-22 ]

Setting to minor for now because it's not a normal operation.

Comment by Sergei Petrunia [ 2013-03-24 ]

Breakpoint 15, ha_leveldb::open (this=0x7fffbc011d60, name=0x7fffbc013160 "./j93/#sql-5af2_1", mode=2, test_if_locked=2) at /home/psergey/dev2/mysql-5.6-leveldb/storage/leveldb/ha_leveldb.cc:779
(gdb) p table
$123 = (TABLE *) 0x7fffbc012540
(gdb) p table->s->primary_key
$124 = 64
(gdb) p table->alias
$125 = 0x7fffbc00f0a0 "#sql-5af2_1"
(gdb) p table->key_info[0]
$126 = {key_length = 4, flags = 0, actual_flags = 0, user_defined_key_parts = 1, actual_key_parts = 1, unused_key_parts = 0, usable_key_parts = 1, block_size = 0, algorithm = HA_KEY_ALG_UNDEF,

{parser = 0x0, parser_name = 0x0}

, key_part = 0x7fffbc013220, name = 0x7fffbc0115d1 "i", rec_per_key = 0x7fffbc0115d8, handler =

{bdb_return_if_eq = 0}

, table = 0x7fffbc012540, comment = {str = 0x0, length = 0}}
(gdb) p table->s->keys
$127 = 1

It seems, dropping a primary key is a way to get around the requirement imposed by the HA_REQUIRE_PRIMARY_KEY flag. ha_leveldb::table_flags() always returns HA_REQUIRE_PRIMARY_KEY flag, however, the ALTER TABLE statement in this bug report will attempt to create a table without a primary key.

Generated at Thu Feb 08 06:55:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.