Skip to content

Commit ebbe59f

Browse files
committed
MariaRocks port: fix rocksdb.bloomfilter3 test
In MySQL 5.6, QUICK_SELECT_DESC calls handler->set_end_range() to inform the storage engine about the bounds of the range being scanned. MariaDB doesn't have that (handler::set_end_range call was back-ported but it is not called from QUICK_SELECT_DESC). Instead, it got prepare_*scan() methods from TokuDB. Implement these methods so that MyRocks has information about the range end.
1 parent 69d5ee5 commit ebbe59f

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

storage/rocksdb/ha_rocksdb.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6528,6 +6528,23 @@ int ha_rocksdb::read_range_first(const key_range* const start_key,
65286528
}
65296529

65306530

6531+
int ha_rocksdb::prepare_index_scan()
6532+
{
6533+
range_key_part= table->key_info[active_index].key_part;
6534+
set_end_range(NULL);
6535+
return 0;
6536+
}
6537+
6538+
6539+
int ha_rocksdb::prepare_range_scan(const key_range *start_key,
6540+
const key_range *end_key)
6541+
{
6542+
range_key_part= table->key_info[active_index].key_part;
6543+
set_end_range(end_key);
6544+
return 0;
6545+
}
6546+
6547+
65316548
int ha_rocksdb::index_read_map(uchar* const buf, const uchar* const key,
65326549
key_part_map keypart_map,
65336550
enum ha_rkey_function find_flag)

storage/rocksdb/ha_rocksdb.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,17 @@ class ha_rocksdb: public my_core::handler
576576
void update_stats(void);
577577

578578
public:
579+
/*
580+
The following two are currently only used for getting the range bounds
581+
from QUICK_SELECT_DESC.
582+
We don't need to implement prepare_index_key_scan[_map] because it is
583+
only used with HA_READ_KEY_EXACT and HA_READ_PREFIX_LAST where one
584+
can infer the bounds of the range being scanned, anyway.
585+
*/
586+
int prepare_index_scan() override;
587+
int prepare_range_scan(const key_range *start_key,
588+
const key_range *end_key) override;
589+
579590
/*
580591
Controls whether writes include checksums. This is updated from the session variable
581592
at the start of each query.

storage/rocksdb/mysql-test/rocksdb/r/bloomfilter3.result

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,20 @@ insert into t1 values (21,2,2,0x12FFFFFFFFFF,1);
101101
explain
102102
select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc;
103103
id select_type table type possible_keys key key_len ref rows Extra
104-
1 SIMPLE t1 index kp12 kp12 28 NULL # Using where; Using index
104+
1 SIMPLE t1 ref kp12 kp12 20 const,const,const # Using where; Using index
105105
show status like '%rocksdb_bloom_filter_prefix%';
106106
Variable_name Value
107-
rocksdb_bloom_filter_prefix_checked 0
108-
rocksdb_bloom_filter_prefix_useful 0
107+
Rocksdb_bloom_filter_prefix_checked 0
108+
Rocksdb_bloom_filter_prefix_useful 0
109109
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
110110
select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc;
111111
pk kp0 kp1 kp2 kp3
112112
11 1 1 20890720927743 1
113113
10 1 1 20890720927743 1
114114
show status like '%rocksdb_bloom_filter_prefix%';
115115
Variable_name Value
116-
rocksdb_bloom_filter_prefix_checked 0
117-
rocksdb_bloom_filter_prefix_useful 0
116+
Rocksdb_bloom_filter_prefix_checked 0
117+
Rocksdb_bloom_filter_prefix_useful 0
118118
# The following MUST show TRUE:
119119
select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
120120
case when variable_value-@c = 0 then 'true' else 'false' end

0 commit comments

Comments
 (0)