Commit e537e447 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-35033 LeakSanitizer errors in my_malloc /...

MDEV-35033 LeakSanitizer errors in my_malloc / safe_mutex_lazy_init_deadlock_detection / MHNSW_Context::alloc_node and alike

ctx wasn't released on errors
parent 3b41c444
......@@ -10,3 +10,17 @@ Table Op Msg_type Msg_text
test.t analyze status Engine-independent statistics collected
test.t analyze status Table is already up to date
drop table t;
#
# MDEV-35033 LeakSanitizer errors in my_malloc / safe_mutex_lazy_init_deadlock_detection / MHNSW_Context::alloc_node and alike
#
call mtr.add_suppression('mariadbd: Can''t find record in ''t''');
create table t (a int, v blob not null, vector index (v));
insert into t values (1,vec_fromtext('[0]'));
update t set v = vec_fromtext('[0,0]');
ERROR 22007: Incorrect vector value: '...' for column `test`.`t`.`v` at row 1
update t set a = 2;
ERROR HY000: Can't find record in 't'
set global mhnsw_cache_size = 1048576;
insert into t values (2,x'00000000');
drop table t;
set global mhnsw_cache_size = default;
......@@ -12,3 +12,22 @@ create table t1(v blob not null, vector index(v)) engine=aria;
create table t (a int, v blob not null, vector index (v));
analyze table t persistent for columns() indexes (v);
drop table t;
--echo #
--echo # MDEV-35033 LeakSanitizer errors in my_malloc / safe_mutex_lazy_init_deadlock_detection / MHNSW_Context::alloc_node and alike
--echo #
call mtr.add_suppression('mariadbd: Can''t find record in ''t''');
create table t (a int, v blob not null, vector index (v));
insert into t values (1,vec_fromtext('[0]'));
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
update t set v = vec_fromtext('[0,0]');
--error ER_KEY_NOT_FOUND
update t set a = 2;
set global mhnsw_cache_size = 1048576;
insert into t values (2,x'00000000');
drop table t;
set global mhnsw_cache_size = default;
......@@ -1302,6 +1302,7 @@ int mhnsw_invalidate(TABLE *table, const uchar *rec, KEY *keyinfo)
handler *h= table->file;
MHNSW_Context *ctx;
bool use_ctx= !MHNSW_Context::acquire(&ctx, table, true);
SCOPE_EXIT([ctx, table](){ ctx->release(table); });
/* metadata are checked on open */
DBUG_ASSERT(graph);
......@@ -1332,7 +1333,6 @@ int mhnsw_invalidate(TABLE *table, const uchar *rec, KEY *keyinfo)
graph->file->position(graph->record[0]);
FVectorNode *node= ctx->get_node(graph->file->ref);
node->deleted= true;
ctx->release(table);
}
return 0;
......
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