[Commits] ad88c428c50: Avoid a crash on MyRocks data inconsistency.
revision-id: ad88c428c50e86cd78da2a9ecd027add2f9d6ff9 (mariadb-10.2.40-233-gad88c428c50) parent(s): d3143ef8a8655975a00d6333823a820cb72c195d author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2022-01-20 22:32:55 +0300 message: Avoid a crash on MyRocks data inconsistency. In ha_rocksdb::open(), check if the number of indexes seen from the SQL layer matches the number of indexes in the internal MyRocks data dictionary. Produce an error if there is a mismatch. (If we don't produce this error, we are likely to crash as soon as we attempt to use an index) --- storage/rocksdb/ha_rocksdb.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 8d2080187ef..1cb1a3517c5 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -6668,6 +6668,17 @@ int ha_rocksdb::open(const char *const name, int mode, uint test_if_locked) { "dictionary"); DBUG_RETURN(HA_ERR_ROCKSDB_INVALID_TABLE); } + if (m_tbl_def->m_key_count != table->s->keys + has_hidden_pk(table)? 1:0) + { + sql_print_error("MyRocks: DDL mismatch: .frm file has %u indexes, " + "MyRocks has %u (%s hidden pk)", + table->s->keys, m_tbl_def->m_key_count, + has_hidden_pk(table)? "1" : "no"); + my_error(ER_INTERNAL_ERROR, MYF(0), + "MyRocks: DDL mismatch. Check the error log for details"); + DBUG_RETURN(HA_ERR_ROCKSDB_INVALID_TABLE); + } + m_lock_rows = RDB_LOCK_NONE; m_key_descr_arr = m_tbl_def->m_key_descr_arr;
participants (1)
-
psergey