summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-09-16 19:10:34 +0300
committerMonty <monty@mariadb.org>2022-07-07 18:09:21 +0300
commit8e3af1812329eea232a65a0e27798ef746eec267 (patch)
treeb2d0018fe8cb0692ff284cebd79e6a289927b7b2 /storage
parenta5f78505d798ff973daed8cfec1e8486c89a23ed (diff)
downloadmariadb-git-8e3af1812329eea232a65a0e27798ef746eec267.tar.gz
Make Rocksdb error message independent from engine messages in my_base.h
- Rocksdb unique error messages move to a range starting at 300 - Use same error code for Rocksdb error messages that exists in my_base.h
Diffstat (limited to 'storage')
-rw-r--r--storage/rocksdb/ha_rocksdb.cc19
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result10
-rw-r--r--storage/rocksdb/rdb_global.h48
3 files changed, 33 insertions, 44 deletions
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 82a85a0be7d..72f88172a2a 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -6908,19 +6908,13 @@ static const char *rdb_error_messages[] = {
"Invalid table.",
"Could not access RocksDB properties.",
"File I/O error during merge/sort operation.",
- "RocksDB status: not found.",
- "RocksDB status: corruption.",
"RocksDB status: invalid argument.",
"RocksDB status: io error.",
- "RocksDB status: no space.",
"RocksDB status: merge in progress.",
"RocksDB status: incomplete.",
"RocksDB status: shutdown in progress.",
- "RocksDB status: timed out.",
"RocksDB status: aborted.",
- "RocksDB status: lock limit reached.",
"RocksDB status: busy.",
- "RocksDB status: deadlock.",
"RocksDB status: expired.",
"RocksDB status: try again.",
};
@@ -6929,24 +6923,11 @@ static_assert((sizeof(rdb_error_messages) / sizeof(rdb_error_messages[0])) ==
((HA_ERR_ROCKSDB_LAST - HA_ERR_ROCKSDB_FIRST) + 1),
"Number of error messages doesn't match number of error codes");
-//psergey-merge: do we need this in MariaDB: we have get_error_messages
-//below...
-#if 0
-static const char *rdb_get_error_message(int nr) {
- return rdb_error_messages[nr - HA_ERR_ROCKSDB_FIRST];
-}
-#endif
-
static const char **rdb_get_error_messages(int nr) { return rdb_error_messages; }
bool ha_rocksdb::get_error_message(const int error, String *const buf) {
DBUG_ENTER_FUNC();
- static_assert(HA_ERR_ROCKSDB_LAST > HA_ERR_FIRST,
- "HA_ERR_ROCKSDB_LAST > HA_ERR_FIRST");
- static_assert(HA_ERR_ROCKSDB_LAST > HA_ERR_LAST,
- "HA_ERR_ROCKSDB_LAST > HA_ERR_LAST");
-
if (error == HA_ERR_LOCK_WAIT_TIMEOUT || error == HA_ERR_LOCK_DEADLOCK ||
error == HA_ERR_ROCKSDB_STATUS_BUSY) {
Rdb_transaction *const tx = get_tx_from_thd(ha_thd());
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result b/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result
index 88a62028be9..42025ec0fca 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result
@@ -20,7 +20,7 @@ set @tmp1=@@rocksdb_verify_row_debug_checksums;
set rocksdb_verify_row_debug_checksums=1;
set session debug_dbug= "+d,myrocks_simulate_bad_row_read1";
select * from t1 where pk=1;
-ERROR HY000: Got error 204 'Found data corruption.' from ROCKSDB
+ERROR HY000: Got error 305 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read1";
set rocksdb_verify_row_debug_checksums=@tmp1;
select * from t1 where pk=1;
@@ -28,11 +28,11 @@ pk col1
1 1
set session debug_dbug= "+d,myrocks_simulate_bad_row_read2";
select * from t1 where pk=1;
-ERROR HY000: Got error 204 'Found data corruption.' from ROCKSDB
+ERROR HY000: Got error 305 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read2";
set session debug_dbug= "+d,myrocks_simulate_bad_row_read3";
select * from t1 where pk=1;
-ERROR HY000: Got error 204 'Found data corruption.' from ROCKSDB
+ERROR HY000: Got error 305 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_row_read3";
insert into t1 values(4,'0123456789');
select * from t1;
@@ -56,7 +56,7 @@ pk col1
ABCD 1
set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1";
select * from t2;
-ERROR HY000: Got error 204 'Found data corruption.' from ROCKSDB
+ERROR HY000: Got error 305 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1";
drop table t2;
create table t2 (
@@ -69,6 +69,6 @@ pk col1
ABCD 1
set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1";
select * from t2;
-ERROR HY000: Got error 204 'Found data corruption.' from ROCKSDB
+ERROR HY000: Got error 305 'Found data corruption.' from ROCKSDB
set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1";
drop table t2;
diff --git a/storage/rocksdb/rdb_global.h b/storage/rocksdb/rdb_global.h
index 7213571bf61..7c9168ee352 100644
--- a/storage/rocksdb/rdb_global.h
+++ b/storage/rocksdb/rdb_global.h
@@ -235,11 +235,25 @@ const char *const RDB_TTL_COL_QUALIFIER = "ttl_col";
#define MAX_INDEX_COL_LEN_SMALL 767
/*
- MyRocks specific error codes. NB! Please make sure that you will update
- HA_ERR_ROCKSDB_LAST when adding new ones. Also update the strings in
- rdb_error_messages to include any new error messages.
+ MyRocks specific error codes are in a range of 300-400 to not
+ clash with other errors. (Default errors are from 120 and up)
*/
-#define HA_ERR_ROCKSDB_FIRST (HA_ERR_LAST + 1)
+#define HA_ERR_ROCKSDB_FIRST (300)
+#if HA_ERR_LAST >= HA_ERR_ROCKSDB_FIRST
+#error "Rocksdb error code overlapps default engine codes from my_base.h"
+#endif
+
+/* Rocksdb errors mapped to MariaDB errors */
+#define HA_ERR_ROCKSDB_STATUS_NOT_FOUND HA_ERR_KEY_NOT_FOUND
+#define HA_ERR_ROCKSDB_STATUS_CORRUPTION HA_ERR_WRONG_IN_RECORD
+#define HA_ERR_ROCKSDB_STATUS_NOT_SUPPORTED HA_ERR_UNSUPPORTED
+#define HA_ERR_ROCKSDB_STATUS_NO_SPACE HA_ERR_RECORD_FILE_FULL
+#define HA_ERR_ROCKSDB_STATUS_TIMED_OUT HA_ERR_LOCK_WAIT_TIMEOUT
+#define HA_ERR_ROCKSDB_STATUS_LOCK_LIMIT HA_ERR_LOCK_TABLE_FULL
+#define HA_ERR_ROCKSDB_STATUS_DEADLOCK HA_ERR_LOCK_DEADLOCK
+
+/* Unique Rocksb errors */
+
#define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_ROCKSDB_FIRST + 0)
#define HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED \
(HA_ERR_ROCKSDB_FIRST + 1)
@@ -256,22 +270,16 @@ const char *const RDB_TTL_COL_QUALIFIER = "ttl_col";
Each error code below maps to a RocksDB status code found in:
rocksdb/include/rocksdb/status.h
*/
-#define HA_ERR_ROCKSDB_STATUS_NOT_FOUND (HA_ERR_LAST + 10)
-#define HA_ERR_ROCKSDB_STATUS_CORRUPTION (HA_ERR_LAST + 11)
-#define HA_ERR_ROCKSDB_STATUS_NOT_SUPPORTED (HA_ERR_LAST + 12)
-#define HA_ERR_ROCKSDB_STATUS_INVALID_ARGUMENT (HA_ERR_LAST + 13)
-#define HA_ERR_ROCKSDB_STATUS_IO_ERROR (HA_ERR_LAST + 14)
-#define HA_ERR_ROCKSDB_STATUS_NO_SPACE (HA_ERR_LAST + 15)
-#define HA_ERR_ROCKSDB_STATUS_MERGE_IN_PROGRESS (HA_ERR_LAST + 16)
-#define HA_ERR_ROCKSDB_STATUS_INCOMPLETE (HA_ERR_LAST + 17)
-#define HA_ERR_ROCKSDB_STATUS_SHUTDOWN_IN_PROGRESS (HA_ERR_LAST + 18)
-#define HA_ERR_ROCKSDB_STATUS_TIMED_OUT (HA_ERR_LAST + 19)
-#define HA_ERR_ROCKSDB_STATUS_ABORTED (HA_ERR_LAST + 20)
-#define HA_ERR_ROCKSDB_STATUS_LOCK_LIMIT (HA_ERR_LAST + 21)
-#define HA_ERR_ROCKSDB_STATUS_BUSY (HA_ERR_LAST + 22)
-#define HA_ERR_ROCKSDB_STATUS_DEADLOCK (HA_ERR_LAST + 23)
-#define HA_ERR_ROCKSDB_STATUS_EXPIRED (HA_ERR_LAST + 24)
-#define HA_ERR_ROCKSDB_STATUS_TRY_AGAIN (HA_ERR_LAST + 25)
+
+#define HA_ERR_ROCKSDB_STATUS_INVALID_ARGUMENT (HA_ERR_ROCKSDB_FIRST + 10)
+#define HA_ERR_ROCKSDB_STATUS_IO_ERROR (HA_ERR_ROCKSDB_FIRST + 11)
+#define HA_ERR_ROCKSDB_STATUS_MERGE_IN_PROGRESS (HA_ERR_ROCKSDB_FIRST + 12)
+#define HA_ERR_ROCKSDB_STATUS_INCOMPLETE (HA_ERR_ROCKSDB_FIRST + 13)
+#define HA_ERR_ROCKSDB_STATUS_SHUTDOWN_IN_PROGRESS (HA_ERR_ROCKSDB_FIRST + 14)
+#define HA_ERR_ROCKSDB_STATUS_ABORTED (HA_ERR_ROCKSDB_FIRST + 15)
+#define HA_ERR_ROCKSDB_STATUS_BUSY (HA_ERR_ROCKSDB_FIRST + 16)
+#define HA_ERR_ROCKSDB_STATUS_EXPIRED (HA_ERR_ROCKSDB_FIRST + 17)
+#define HA_ERR_ROCKSDB_STATUS_TRY_AGAIN (HA_ERR_ROCKSDB_FIRST + 18)
#define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_STATUS_TRY_AGAIN
const char *const rocksdb_hton_name = "ROCKSDB";