Commit 8705d00a authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-5748 Assertion `status_var.memory_used == 0' fails on disconnect after...

MDEV-5748 Assertion `status_var.memory_used == 0' fails on disconnect after opening an OQGRAPH table

make sure MY_THREAD_SPECIFIC is not set for memroot that can be
transferred between threads
parent 66883ee0
......@@ -538,7 +538,11 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
origid= destid= weight= 0;
// Here we're abusing init_tmp_table_share() which is normally only works for thread-local shares.
init_tmp_table_share( thd, share, table->s->db.str, table->s->db.length, options->table_name, "");
// because of that, we need to reinitialize the memroot (to reset MY_THREAD_SPECIFIC flag)
DBUG_ASSERT(share->mem_root.used == NULL); // it's still empty
init_sql_alloc(&share->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
// What I think this code is doing:
// * Our OQGRAPH table is `database_blah/name`
......
CREATE TABLE oq_backing (
origid INT UNSIGNED NOT NULL,
destid INT UNSIGNED NOT NULL,
weight DOUBLE NOT NULL,
PRIMARY KEY (origid, destid),
KEY (destid)
);
CREATE TABLE oq_table (
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
seq BIGINT UNSIGNED NULL,
linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH
data_table='oq_backing' origid='origid' destid='destid' weight='weight';
flush tables;
show fields in oq_table;
Field Type Null Key Default Extra
latch varchar(32) YES MUL NULL
origid bigint(20) unsigned YES NULL
destid bigint(20) unsigned YES NULL
weight double YES NULL
seq bigint(20) unsigned YES NULL
linkid bigint(20) unsigned YES NULL
show tables;
Tables_in_test
oq_backing
oq_table
drop table oq_table, oq_backing;
#
# MDEV-5748 Assertion `status_var.memory_used == 0' fails on disconnect after opening an OQGRAPH table
#
# try to open oqgraph table in one connection and use in another:
--connect (con1,localhost,root,,)
CREATE TABLE oq_backing (
origid INT UNSIGNED NOT NULL,
destid INT UNSIGNED NOT NULL,
weight DOUBLE NOT NULL,
PRIMARY KEY (origid, destid),
KEY (destid)
);
CREATE TABLE oq_table (
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
seq BIGINT UNSIGNED NULL,
linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH
data_table='oq_backing' origid='origid' destid='destid' weight='weight';
flush tables;
show fields in oq_table;
--disconnect con1
--connection default
show tables;
drop table oq_table, oq_backing;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment