mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Make "SET @@rocksdb_bulk_load=0" return an error instead of crashing the server
- This is more in line with MariaDB environment - And help with rocksdb.bulk_load_errors test, too
This commit is contained in:
@ -4821,7 +4821,8 @@ end_with_restore_list:
|
|||||||
goto error;
|
goto error;
|
||||||
if (!(res= sql_set_variables(thd, lex_var_list, true)))
|
if (!(res= sql_set_variables(thd, lex_var_list, true)))
|
||||||
{
|
{
|
||||||
my_ok(thd);
|
if (!thd->is_error())
|
||||||
|
my_ok(thd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -11493,7 +11493,14 @@ void rocksdb_set_bulk_load(THD *const thd, struct st_mysql_sys_var *const var
|
|||||||
sql_print_error("RocksDB: Error %d finalizing last SST file while "
|
sql_print_error("RocksDB: Error %d finalizing last SST file while "
|
||||||
"setting bulk loading variable",
|
"setting bulk loading variable",
|
||||||
rc);
|
rc);
|
||||||
abort_with_stack_traces();
|
/*
|
||||||
|
MariaDB doesn't do the following:
|
||||||
|
abort_with_stack_traces();
|
||||||
|
because it doesn't seem a good idea to crash a server when a user makes
|
||||||
|
a mistake.
|
||||||
|
Instead, we return an error to the user. The error has already been
|
||||||
|
produced inside ha_rocksdb::finalize_bulk_load().
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,16 @@ INSERT INTO t1 VALUES(1);
|
|||||||
INSERT INTO t1 VALUES(2);
|
INSERT INTO t1 VALUES(2);
|
||||||
INSERT INTO t1 VALUES(20);
|
INSERT INTO t1 VALUES(20);
|
||||||
INSERT INTO t1 VALUES(21);
|
INSERT INTO t1 VALUES(21);
|
||||||
|
#
|
||||||
|
# In MyRocks, the following statement will intentionally crash the server.
|
||||||
|
# In MariaDB, it will cause an error
|
||||||
SET rocksdb_bulk_load=0;
|
SET rocksdb_bulk_load=0;
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
ERROR HY000: Rows inserted during bulk load must not overlap existing rows
|
||||||
|
#
|
||||||
|
# Despite the error, bulk load operation is over so the variable value
|
||||||
|
# will be 0:
|
||||||
|
select @@rocksdb_bulk_load;
|
||||||
|
@@rocksdb_bulk_load
|
||||||
|
0
|
||||||
|
call mtr.add_suppression('finalizing last SST file while setting bulk loading variable');
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -20,20 +20,17 @@ INSERT INTO t1 VALUES(2);
|
|||||||
INSERT INTO t1 VALUES(20);
|
INSERT INTO t1 VALUES(20);
|
||||||
INSERT INTO t1 VALUES(21);
|
INSERT INTO t1 VALUES(21);
|
||||||
|
|
||||||
# This last crashes the server (intentionally) because we can't return any
|
--echo #
|
||||||
# error information from a SET <variable>=<value>
|
--echo # In MyRocks, the following statement will intentionally crash the server.
|
||||||
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
--echo # In MariaDB, it will cause an error
|
||||||
--error 2013
|
--error ER_OVERLAPPING_KEYS
|
||||||
SET rocksdb_bulk_load=0;
|
SET rocksdb_bulk_load=0;
|
||||||
|
|
||||||
--exec grep "RocksDB: Error 197 finalizing last SST file while setting bulk loading variable" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2
|
--echo #
|
||||||
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
|
--echo # Despite the error, bulk load operation is over so the variable value
|
||||||
|
--echo # will be 0:
|
||||||
|
select @@rocksdb_bulk_load;
|
||||||
|
|
||||||
# restart the crashed server
|
call mtr.add_suppression('finalizing last SST file while setting bulk loading variable');
|
||||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
|
|
||||||
# Make sure the error exists in the .err log and then restart the server
|
|
||||||
--enable_reconnect
|
|
||||||
--source include/wait_until_connected_again.inc
|
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
Reference in New Issue
Block a user