Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mysql-test/suite/atomic/vector_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -1816,3 +1816,14 @@ count(*)
2
master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
#
# MDEV-38832 Assertion `!commit_lsn' failed in void trx_t::free()
#
CREATE DATABASE test_1;
SET STATEMENT max_session_mem_used=8192 FOR
CREATE TABLE test_1.t (a INT,b VECTOR (5) NOT NULL,
VECTOR INDEX (b)) ENGINE=INNODB;
ERROR HY000: Engine InnoDB failed to discover table `test_1`.`t` with 'CREATE TABLE i ( layer tinyint not null, tref varbinary(6), vec blob not null, neighbors blob not null, unique (tref), key (layer)) '
SET GLOBAL innodb_flush_log_at_trx_commit=0;
DROP DATABASE test_1;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
13 changes: 13 additions & 0 deletions mysql-test/suite/atomic/vector_innodb.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
let $skip_vector=1;
let $extra_fields=, v vector(5) not null default x'e360d63ebe554f3fcdbc523f4522193f5236083d', vector index(v);
--source alter_table_innodb.test

--echo #
--echo # MDEV-38832 Assertion `!commit_lsn' failed in void trx_t::free()
--echo #
CREATE DATABASE test_1;
--error ER_SQL_DISCOVER_ERROR
SET STATEMENT max_session_mem_used=8192 FOR
CREATE TABLE test_1.t (a INT,b VECTOR (5) NOT NULL,
VECTOR INDEX (b)) ENGINE=INNODB;
let $flush_log_at_commit=`select @@global.innodb_flush_log_at_trx_commit`;
SET GLOBAL innodb_flush_log_at_trx_commit=0;
DROP DATABASE test_1;
eval SET GLOBAL innodb_flush_log_at_trx_commit=$flush_log_at_commit;
10 changes: 9 additions & 1 deletion sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6484,6 +6484,7 @@ static int ha_create_table_from_share(THD *thd, TABLE_SHARE *share,
0 ok
@retval
1 error
2 error while creating high level index failure
*/
int ha_create_table(THD *thd, const char *path, const char *db,
const char *table_name, HA_CREATE_INFO *create_info,
Expand Down Expand Up @@ -6552,7 +6553,10 @@ int ha_create_table(THD *thd, const char *path, const char *db,
}

if ((error= share.path.length > sizeof(file_name) - HLINDEX_BUF_LEN))
{
error= 2;
goto err;
}

enum_sql_command old_sql_command= thd->lex->sql_command;
for (uint i= share.keys; i < share.total_keys; i++)
Expand All @@ -6569,21 +6573,25 @@ int ha_create_table(THD *thd, const char *path, const char *db,
if (error)
{
index_share.db_plugin= NULL;
error= 2;
break;
}

uint unused;
if ((error= ha_create_table_from_share(thd, &index_share, &index_cinfo,
&unused)))
{
error= 2;
break;
}
}
thd->lex->sql_command= old_sql_command;
free_table_share(&index_share);
}

err:
free_table_share(&share);
DBUG_RETURN(error != 0);
DBUG_RETURN(error);
}

void st_ha_check_opt::init()
Expand Down
16 changes: 12 additions & 4 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4932,8 +4932,8 @@ int create_table_impl(THD *thd,
if (!frm_only)
{
debug_crash_here("ddl_log_create_before_create_table");
if (ha_create_table(thd, path.str, db.str, table_name.str, create_info,
frm, 0))
if ((error= ha_create_table(thd, path.str, db.str, table_name.str, create_info,
frm, 0)))
{
file->ha_create_partitioning_metadata(path.str, NULL, CHF_DELETE_FLAG);
deletefrm(path.str);
Expand Down Expand Up @@ -4969,8 +4969,16 @@ int create_table_impl(THD *thd,
err:
if (unlikely(error) && ddl_log_state_create)
{
/* Table was never created, so we can ignore the ddl log entry */
ddl_log_complete(ddl_log_state_create);
if (error == 2)
{
/* hlindex creation failed, need to revert to clean up main table */
ddl_log_revert(thd, ddl_log_state_create);
}
else
{
/* Table was never created, so we can ignore the ddl log entry */
ddl_log_complete(ddl_log_state_create);
}
}

THD_STAGE_INFO(thd, stage_after_create);
Expand Down
2 changes: 2 additions & 0 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,8 @@ static void innodb_drop_database(handlerton*, char *path)
log_write_up_to(mtr.commit_lsn(), true);
}

/* Reset the commit_lsn when innodb_flush_log_at_trx_commit = 0 */
ut_d(trx->commit_lsn= 0);
trx->free();
my_free(namebuf);
}
Expand Down