diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2017-08-03 15:16:40 +0000 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2017-08-03 15:16:40 +0000 |
commit | eda033255a59ee5ea098800e38a341920b3d5769 (patch) | |
tree | 04c579c0e8b170e7ab8eb2c195b880a290195101 | |
parent | fcb8d8e598dad66c8e2ecc4a576b3b250abcd623 (diff) | |
download | mariadb-git-eda033255a59ee5ea098800e38a341920b3d5769.tar.gz |
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
-rw-r--r-- | sql/sql_parse.cc | 3 | ||||
-rw-r--r-- | storage/rocksdb/ha_rocksdb.cc | 9 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result | 12 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/t/bulk_load_errors.test | 21 |
4 files changed, 30 insertions, 15 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4f0610cffcb..22a9970a45e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4821,7 +4821,8 @@ end_with_restore_list: goto error; if (!(res= sql_set_variables(thd, lex_var_list, true))) { - my_ok(thd); + if (!thd->is_error()) + my_ok(thd); } else { diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index a0b8cca0791..113efa662b9 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -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 " "setting bulk loading variable", 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(). + */ } } diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result index 31562d1da10..eced62bd043 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result @@ -14,6 +14,16 @@ INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2); INSERT INTO t1 VALUES(20); 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; -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; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bulk_load_errors.test b/storage/rocksdb/mysql-test/rocksdb/t/bulk_load_errors.test index 284e29d1f5a..bb3d8164200 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bulk_load_errors.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bulk_load_errors.test @@ -20,20 +20,17 @@ INSERT INTO t1 VALUES(2); INSERT INTO t1 VALUES(20); INSERT INTO t1 VALUES(21); -# This last crashes the server (intentionally) because we can't return any -# error information from a SET <variable>=<value> ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---error 2013 +--echo # +--echo # In MyRocks, the following statement will intentionally crash the server. +--echo # In MariaDB, it will cause an error +--error ER_OVERLAPPING_KEYS 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 ---exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err +--echo # +--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 ---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 +call mtr.add_suppression('finalizing last SST file while setting bulk loading variable'); DROP TABLE t1; |