Skip to content

Commit 36b6127

Browse files
laurynas-biveinisinikep
authored andcommitted
Index read fixes (percona#1292)
Upstream commit ID: facebook/mysql-5.6@4c5fa16 PS-8951: Merge percona-202305 (https://jira.percona.com/browse/PS-8951) Summary: Minor index access cleanups for MyRocks: - `ha_rocksdb::index_init`: remove duplicate `active_index` assignment. Move `m_need_build_decoder` assignment past the error exit so that taking it does not result in any state changes. - `ha_rocksdb::index_next_same`: add an assert for `active_index` value to prevent out-of-bound accesses in the next line. Pull Request resolved: facebook/mysql-5.6#1292 Reviewed By: sunshine-Chun Differential Revision: D45277614 Pulled By: hermanlee fbshipit-source-id: 8624b6e99a85065f6fda2da126c7935294baebee
1 parent 3056cfa commit 36b6127

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

storage/rocksdb/ha_rocksdb.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9928,6 +9928,7 @@ int ha_rocksdb::index_next_same(uchar *const buf,
99289928

99299929
if (m_full_key_lookup) {
99309930
#ifndef NDEBUG
9931+
assert(active_index != MAX_KEY);
99319932
uint len = calculate_key_len(table, active_index, HA_WHOLE_KEY);
99329933
assert(len == keylen);
99339934
#endif
@@ -11472,9 +11473,6 @@ void ha_rocksdb::check_build_decoder() {
1147211473
int ha_rocksdb::index_init(uint idx, bool sorted) {
1147311474
DBUG_ENTER_FUNC();
1147411475

11475-
m_need_build_decoder = true;
11476-
active_index = idx;
11477-
1147811476
THD *thd = ha_thd();
1147911477
if (thd && thd->killed) {
1148011478
DBUG_RETURN(HA_ERR_QUERY_INTERRUPTED);
@@ -11483,6 +11481,8 @@ int ha_rocksdb::index_init(uint idx, bool sorted) {
1148311481
Rdb_transaction *const tx = get_or_create_tx(thd);
1148411482
assert(tx != nullptr);
1148511483

11484+
m_need_build_decoder = true;
11485+
1148611486
active_index = idx;
1148711487
if (idx != table->s->primary_key &&
1148811488
m_key_descr_arr[idx]->is_partial_index()) {

0 commit comments

Comments
 (0)