1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-22434 UPDATE on RocksDB table with WITHOUT OVERLAPS fails

Insert worked incorrect as well. RocksDB used table->record[0] internally to store some
intermediate results for key conversion, during index searching among other operations.
So table->record[0] is spoiled during ha_rnd_index_map in ha_check_overlaps, so in turn
the broken record data was inserted.

The fix is to store RocksDB intermediate result in its own buffer instead of table->record[0].

`rocksdb` MTR suite is is checked and runs fine.
No need for additional tests. The existing overlaps.test covers the case completely.
However, I am not going to add anything related to rocksdb to suite, to keep it away
from additional dependencies.

To run tests with RocksDB engine, one can add following to engines.combinations:
[rocksdb]
plugin-load=$HA_ROCKSDB_SO
default-storage-engine=rocksdb
rocksdb
This commit is contained in:
Nikita Malyavin
2020-06-02 16:06:41 +10:00
parent c3e09a2d3f
commit 0c595bdeaa
7 changed files with 33 additions and 12 deletions

View File

@@ -987,7 +987,7 @@ uint Rdb_key_def::get_memcmp_sk_parts(const TABLE *table,
Convert index tuple into storage (i.e. mem-comparable) format
@detail
Currently this is done by unpacking into table->record[0] and then
Currently this is done by unpacking into record_buffer and then
packing index columns into storage format.
@param pack_buffer Temporary area for packing varchar columns. Its
@@ -996,6 +996,7 @@ uint Rdb_key_def::get_memcmp_sk_parts(const TABLE *table,
uint Rdb_key_def::pack_index_tuple(TABLE *const tbl, uchar *const pack_buffer,
uchar *const packed_tuple,
uchar *const record_buffer,
const uchar *const key_tuple,
const key_part_map &keypart_map) const {
DBUG_ASSERT(tbl != nullptr);
@@ -1005,13 +1006,13 @@ uint Rdb_key_def::pack_index_tuple(TABLE *const tbl, uchar *const pack_buffer,
/* We were given a record in KeyTupleFormat. First, save it to record */
const uint key_len = calculate_key_len(tbl, m_keyno, key_tuple, keypart_map);
key_restore(tbl->record[0], key_tuple, &tbl->key_info[m_keyno], key_len);
key_restore(record_buffer, key_tuple, &tbl->key_info[m_keyno], key_len);
uint n_used_parts = my_count_bits(keypart_map);
if (keypart_map == HA_WHOLE_KEY) n_used_parts = 0; // Full key is used
/* Then, convert the record into a mem-comparable form */
return pack_record(tbl, pack_buffer, tbl->record[0], packed_tuple, nullptr,
return pack_record(tbl, pack_buffer, record_buffer, packed_tuple, nullptr,
false, 0, n_used_parts);
}