LevelDB storage engine (MDEV-3841)

[MDEV-3958] Assertion `kdef' fails in Primary_key_comparator::Compare on inserting data into a table previously altered and converted into LevelDB Created: 2012-12-21  Updated: 2012-12-22  Resolved: 2012-12-22

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

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

Issue Links:
Relates

 Description   

CREATE TABLE t1 (a INT(11), b CHAR(8)) ENGINE=MyISAM;
ALTER TABLE t1 ADD PRIMARY KEY (a);
ALTER TABLE t1 ENGINE=LevelDB;
INSERT INTO t1 VALUES (1,'a'),(2,'b');

#9  0xb738f167 in __assert_fail () from /lib/libc.so.6
#10 0x0891d799 in Primary_key_comparator::Compare (this=0x90951b0 <primary_key_comparator>, a=..., b=...) at mysql-5.6-leveldb/storage/leveldb/ha_leveldb.cc:148
#11 0xb769cd88 in leveldb::InternalKeyComparator::Compare(leveldb::Slice const&, leveldb::Slice const&) const () from leveldb-1.7.0/libleveldb.so.1
#12 0xb76ab7fc in leveldb::MemTable::KeyComparator::operator()(char const*, char const*) const () from leveldb-1.7.0/libleveldb.so.1
#13 0xb76abf55 in leveldb::SkipList<char const*, leveldb::MemTable::KeyComparator>::FindGreaterOrEqual(char const* const&, leveldb::SkipList<char const*, leveldb::MemTable::KeyComparator>::Node**) const () from leveldb-1.7.0/libleveldb.so.1
#14 0xb76ac083 in leveldb::SkipList<char const*, leveldb::MemTable::KeyComparator>::Insert(char const* const&) () from leveldb-1.7.0/libleveldb.so.1
#15 0xb76ab9d9 in leveldb::MemTable::Add(unsigned long long, leveldb::ValueType, leveldb::Slice const&, leveldb::Slice const&) () from leveldb-1.7.0/libleveldb.so.1
#16 0xb76bb8cb in leveldb::(anonymous namespace)::MemTableInserter::Put(leveldb::Slice const&, leveldb::Slice const&) () from leveldb-1.7.0/libleveldb.so.1
#17 0xb76bbca8 in leveldb::WriteBatch::Iterate(leveldb::WriteBatch::Handler*) const () from leveldb-1.7.0/libleveldb.so.1
#18 0xb76bbf84 in leveldb::WriteBatchInternal::InsertInto(leveldb::WriteBatch const*, leveldb::MemTable*) () from leveldb-1.7.0/libleveldb.so.1

revision-id: psergey@askmonty.org-20121221152341-9stvnkuiinslrt9h
date: 2012-12-21 19:23:41 +0400
build-date: 2012-12-22 02:09:59 +0400
revno: 4471
branch: mysql-5.6-leveldb

LevelDB version 1.7.0.



 Comments   
Comment by Elena Stepanova [ 2012-12-21 ]

This looks fixed in revno 4471.

Comment by Sergei Petrunia [ 2012-12-21 ]

The crash no longer happens, but the data is not there after ALTER TABLE:

MySQL [ldb5]> create table t3 (i int primary key) engine = myisam;
Query OK, 0 rows affected (0.05 sec)

MySQL [ldb5]> insert into t3 values (1);
Query OK, 1 row affected (0.00 sec)

MySQL [ldb5]> insert into t3 values (2);
Query OK, 1 row affected (0.00 sec)

MySQL [ldb5]> alter table t3 engine=leveldb;
Query OK, 2 rows affected (0.05 sec)
Records: 2 Duplicates: 0 Warnings: 0

MySQL [ldb5]> select * from t3;
Empty set (0.00 sec)

Comment by Elena Stepanova [ 2012-12-22 ]

The initial test case was just altering the engine, it failed on revno 4467, but passed on 4471.
I changed the test case to one which fails on 4471 too.

Comment by Sergei Petrunia [ 2012-12-22 ]

Ok, ALTER TABLE relied on the engine supporting table renames, which we dont' support yet (see today's email). This can cause the table to look at the data from the other table, which results in assert (when seeing other table data), or in empty tables (when not seeing one's own data). Disabled all ALTER TABLE commands for now.

Comment by Sergei Petrunia [ 2012-12-22 ]

Fixed by fix for MDEV-3959.

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