diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2017-07-24 15:41:17 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2017-07-28 13:22:28 +0000 |
commit | 488f46f3de51070fa91e5eadcc215b6a4e343f7b (patch) | |
tree | 93a04cf6f2f82701a8e62525660a1bf34e821715 | |
parent | 8c0129dc324d7ef1aa1642bd297c521f20285d25 (diff) | |
download | mariadb-git-488f46f3de51070fa91e5eadcc215b6a4e343f7b.tar.gz |
MDEV-13153: Assertion ... failed on partitioned RocksDB table
ha_partition creates temporary ha_XXX objects for its partitions when
performing DDL operations. The objects were created on a MEM_ROOT and
never deleted.
This works as long as ha_XXX objects free all data ha_XXX::close() and
don't rely on a proper destructor invocation. Unfortunately, ha_rocksdb
includes String members which need to be delete'd properly.
Fixed the bug by having ha_partition::~ha_partition delete these temporary
objects.
-rw-r--r-- | sql/ha_partition.cc | 6 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/r/rocksdb_parts.result | 11 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/t/rocksdb_parts.test | 11 |
3 files changed, 27 insertions, 1 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 2c91dfa0c65..c6ffe679c80 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -413,8 +413,12 @@ ha_partition::~ha_partition() destroy_record_priority_queue(); my_free(m_part_ids_sorted_by_num_of_records); + if (m_added_file) + { + for (handler **ph= m_added_file; *ph; ph++) + delete (*ph); + } clear_handler_file(); - free_root(&m_mem_root, MYF(0)); DBUG_VOID_RETURN; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_parts.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_parts.result index 7bebbbec205..64d917cdb6d 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_parts.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_parts.result @@ -121,3 +121,14 @@ t2 DROP TABLE t2; use test; DROP DATABASE db3; +# +# MDEV-13153 Assertion `global_status_var.global_memory_used == 0 ' +# failed upon server restart with partitioned RocksDB table +# +CREATE TABLE t1 (a INT) ENGINE=RocksDB PARTITION BY HASH(a) PARTITIONS 2; +INSERT INTO t1 (a) VALUES (1),(2); +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +SELECT 1; +1 +1 +DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_parts.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_parts.test index 59472e565ab..fd1177b839e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_parts.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_parts.test @@ -120,3 +120,14 @@ DROP TABLE t2; use test; DROP DATABASE db3; +--echo # +--echo # MDEV-13153 Assertion `global_status_var.global_memory_used == 0 ' +--echo # failed upon server restart with partitioned RocksDB table +--echo # +CREATE TABLE t1 (a INT) ENGINE=RocksDB PARTITION BY HASH(a) PARTITIONS 2; +INSERT INTO t1 (a) VALUES (1),(2); +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--source include/restart_mysqld.inc +SELECT 1; +DROP TABLE t1; + |