Commit 25264f1c authored by Nikita Malyavin's avatar Nikita Malyavin

Provide a safe range for RocksDB errors

Last time, commit b9f57931 (MDEV-9101) has updated HA_ERR_LAST, breaking the
rocksdb error codes. According to the commit history, this happens each time a
new HA error is added.

This patch fixes the range to start from '500', hopefully resolving the problem
for the close future.

In addition, fix incorrect error codes enumeration.
parent 7ff9e457
...@@ -6923,6 +6923,7 @@ static const char *rdb_error_messages[] = { ...@@ -6923,6 +6923,7 @@ static const char *rdb_error_messages[] = {
"File I/O error during merge/sort operation.", "File I/O error during merge/sort operation.",
"RocksDB status: not found.", "RocksDB status: not found.",
"RocksDB status: corruption.", "RocksDB status: corruption.",
"RocksDB status: not supported.",
"RocksDB status: invalid argument.", "RocksDB status: invalid argument.",
"RocksDB status: io error.", "RocksDB status: io error.",
"RocksDB status: no space.", "RocksDB status: no space.",
......
...@@ -20,7 +20,7 @@ set @tmp1=@@rocksdb_verify_row_debug_checksums; ...@@ -20,7 +20,7 @@ set @tmp1=@@rocksdb_verify_row_debug_checksums;
set rocksdb_verify_row_debug_checksums=1; set rocksdb_verify_row_debug_checksums=1;
set session debug_dbug= "+d,myrocks_simulate_bad_row_read1"; set session debug_dbug= "+d,myrocks_simulate_bad_row_read1";
select * from t1 where pk=1; select * from t1 where pk=1;
ERROR HY000: Got error 205 'Found data corruption.' from ROCKSDB ERROR HY000: Got error 505 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read1"; set session debug_dbug= "-d,myrocks_simulate_bad_row_read1";
set rocksdb_verify_row_debug_checksums=@tmp1; set rocksdb_verify_row_debug_checksums=@tmp1;
select * from t1 where pk=1; select * from t1 where pk=1;
...@@ -28,11 +28,11 @@ pk col1 ...@@ -28,11 +28,11 @@ pk col1
1 1 1 1
set session debug_dbug= "+d,myrocks_simulate_bad_row_read2"; set session debug_dbug= "+d,myrocks_simulate_bad_row_read2";
select * from t1 where pk=1; select * from t1 where pk=1;
ERROR HY000: Got error 205 'Found data corruption.' from ROCKSDB ERROR HY000: Got error 505 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read2"; set session debug_dbug= "-d,myrocks_simulate_bad_row_read2";
set session debug_dbug= "+d,myrocks_simulate_bad_row_read3"; set session debug_dbug= "+d,myrocks_simulate_bad_row_read3";
select * from t1 where pk=1; select * from t1 where pk=1;
ERROR HY000: Got error 205 'Found data corruption.' from ROCKSDB ERROR HY000: Got error 505 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read3"; set session debug_dbug= "-d,myrocks_simulate_bad_row_read3";
insert into t1 values(4,'0123456789'); insert into t1 values(4,'0123456789');
select * from t1; select * from t1;
...@@ -56,7 +56,7 @@ pk col1 ...@@ -56,7 +56,7 @@ pk col1
ABCD 1 ABCD 1
set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1"; set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1";
select * from t2; select * from t2;
ERROR HY000: Got error 205 'Found data corruption.' from ROCKSDB ERROR HY000: Got error 505 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1"; set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1";
drop table t2; drop table t2;
create table t2 ( create table t2 (
...@@ -69,6 +69,6 @@ pk col1 ...@@ -69,6 +69,6 @@ pk col1
ABCD 1 ABCD 1
set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1"; set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1";
select * from t2; select * from t2;
ERROR HY000: Got error 205 'Found data corruption.' from ROCKSDB ERROR HY000: Got error 505 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1"; set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1";
drop table t2; drop table t2;
...@@ -239,7 +239,11 @@ const char *const RDB_TTL_COL_QUALIFIER = "ttl_col"; ...@@ -239,7 +239,11 @@ const char *const RDB_TTL_COL_QUALIFIER = "ttl_col";
HA_ERR_ROCKSDB_LAST when adding new ones. Also update the strings in HA_ERR_ROCKSDB_LAST when adding new ones. Also update the strings in
rdb_error_messages to include any new error messages. rdb_error_messages to include any new error messages.
*/ */
#define HA_ERR_ROCKSDB_FIRST (HA_ERR_LAST + 1) #define HA_ERR_ROCKSDB_FIRST 500
static_assert(HA_ERR_ROCKSDB_FIRST > HA_ERR_LAST,
"RocksDB errors overlap generic HA errors!");
#define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_ROCKSDB_FIRST + 0) #define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_ROCKSDB_FIRST + 0)
#define HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED \ #define HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED \
(HA_ERR_ROCKSDB_FIRST + 1) (HA_ERR_ROCKSDB_FIRST + 1)
...@@ -256,22 +260,22 @@ const char *const RDB_TTL_COL_QUALIFIER = "ttl_col"; ...@@ -256,22 +260,22 @@ const char *const RDB_TTL_COL_QUALIFIER = "ttl_col";
Each error code below maps to a RocksDB status code found in: Each error code below maps to a RocksDB status code found in:
rocksdb/include/rocksdb/status.h rocksdb/include/rocksdb/status.h
*/ */
#define HA_ERR_ROCKSDB_STATUS_NOT_FOUND (HA_ERR_LAST + 10) #define HA_ERR_ROCKSDB_STATUS_NOT_FOUND (HA_ERR_ROCKSDB_FIRST + 10)
#define HA_ERR_ROCKSDB_STATUS_CORRUPTION (HA_ERR_LAST + 11) #define HA_ERR_ROCKSDB_STATUS_CORRUPTION (HA_ERR_ROCKSDB_FIRST + 11)
#define HA_ERR_ROCKSDB_STATUS_NOT_SUPPORTED (HA_ERR_LAST + 12) #define HA_ERR_ROCKSDB_STATUS_NOT_SUPPORTED (HA_ERR_ROCKSDB_FIRST + 12)
#define HA_ERR_ROCKSDB_STATUS_INVALID_ARGUMENT (HA_ERR_LAST + 13) #define HA_ERR_ROCKSDB_STATUS_INVALID_ARGUMENT (HA_ERR_ROCKSDB_FIRST + 13)
#define HA_ERR_ROCKSDB_STATUS_IO_ERROR (HA_ERR_LAST + 14) #define HA_ERR_ROCKSDB_STATUS_IO_ERROR (HA_ERR_ROCKSDB_FIRST + 14)
#define HA_ERR_ROCKSDB_STATUS_NO_SPACE (HA_ERR_LAST + 15) #define HA_ERR_ROCKSDB_STATUS_NO_SPACE (HA_ERR_ROCKSDB_FIRST + 15)
#define HA_ERR_ROCKSDB_STATUS_MERGE_IN_PROGRESS (HA_ERR_LAST + 16) #define HA_ERR_ROCKSDB_STATUS_MERGE_IN_PROGRESS (HA_ERR_ROCKSDB_FIRST + 16)
#define HA_ERR_ROCKSDB_STATUS_INCOMPLETE (HA_ERR_LAST + 17) #define HA_ERR_ROCKSDB_STATUS_INCOMPLETE (HA_ERR_ROCKSDB_FIRST + 17)
#define HA_ERR_ROCKSDB_STATUS_SHUTDOWN_IN_PROGRESS (HA_ERR_LAST + 18) #define HA_ERR_ROCKSDB_STATUS_SHUTDOWN_IN_PROGRESS (HA_ERR_ROCKSDB_FIRST + 18)
#define HA_ERR_ROCKSDB_STATUS_TIMED_OUT (HA_ERR_LAST + 19) #define HA_ERR_ROCKSDB_STATUS_TIMED_OUT (HA_ERR_ROCKSDB_FIRST + 19)
#define HA_ERR_ROCKSDB_STATUS_ABORTED (HA_ERR_LAST + 20) #define HA_ERR_ROCKSDB_STATUS_ABORTED (HA_ERR_ROCKSDB_FIRST + 20)
#define HA_ERR_ROCKSDB_STATUS_LOCK_LIMIT (HA_ERR_LAST + 21) #define HA_ERR_ROCKSDB_STATUS_LOCK_LIMIT (HA_ERR_ROCKSDB_FIRST + 21)
#define HA_ERR_ROCKSDB_STATUS_BUSY (HA_ERR_LAST + 22) #define HA_ERR_ROCKSDB_STATUS_BUSY (HA_ERR_ROCKSDB_FIRST + 22)
#define HA_ERR_ROCKSDB_STATUS_DEADLOCK (HA_ERR_LAST + 23) #define HA_ERR_ROCKSDB_STATUS_DEADLOCK (HA_ERR_ROCKSDB_FIRST + 23)
#define HA_ERR_ROCKSDB_STATUS_EXPIRED (HA_ERR_LAST + 24) #define HA_ERR_ROCKSDB_STATUS_EXPIRED (HA_ERR_ROCKSDB_FIRST + 24)
#define HA_ERR_ROCKSDB_STATUS_TRY_AGAIN (HA_ERR_LAST + 25) #define HA_ERR_ROCKSDB_STATUS_TRY_AGAIN (HA_ERR_ROCKSDB_FIRST + 25)
#define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_STATUS_TRY_AGAIN #define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_STATUS_TRY_AGAIN
const char *const rocksdb_hton_name = "ROCKSDB"; const char *const rocksdb_hton_name = "ROCKSDB";
......
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