Skip to content

Commit 55622f1

Browse files
spetruniajtolmer
authored andcommitted
Issue #75: Prefix bloom filter is not used for LinkBench style range scan
Summary: When doing reverse index scan, SQL layer calls h->index_read_map(), h->index_prev(). These do not provide info about the end of the range. In order to provide info about the end of the range (for the Index Condition Pushdown to work), Oracle has introduced h->set_end_range() which however is only made if ICP is used. This patch - Makes sql/opt_range.cc always call h->set_end_range(). - Makes MyRocks to get use the other range endpoint for the Bloom filter. This diff was written by Sergey. I'm submitting on behalf of him since he has some issues with Phabricator. Test Plan: mtr, bloomfilter3 Reviewers: hermanlee4, maykov, jkedgar, spetrunia Differential Revision: https://reviews.facebook.net/D48639
1 parent be4b4a0 commit 55622f1

File tree

8 files changed

+278
-19
lines changed

8 files changed

+278
-19
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
CREATE TABLE `linktable` (
2+
`id1` bigint(20) unsigned NOT NULL DEFAULT '0',
3+
`id1_type` int(10) unsigned NOT NULL DEFAULT '0',
4+
`id2` bigint(20) unsigned NOT NULL DEFAULT '0',
5+
`id2_type` int(10) unsigned NOT NULL DEFAULT '0',
6+
`link_type` bigint(20) unsigned NOT NULL DEFAULT '0',
7+
`visibility` tinyint(3) NOT NULL DEFAULT '0',
8+
`data` varchar(255) NOT NULL DEFAULT '',
9+
`time` bigint(20) unsigned NOT NULL DEFAULT '0',
10+
`version` int(11) unsigned NOT NULL DEFAULT '0',
11+
PRIMARY KEY (link_type, `id1`,`id2`) COMMENT 'cf_link_pk',
12+
KEY `id1_type` (`id1`,`link_type`,`visibility`,`time`,`version`,`data`) COMMENT 'rev:cf_link_id1_type',
13+
KEY `id1_type2` (`id1`,`link_type`,`time`,`version`,`data`,`visibility`) COMMENT 'rev:cf_link_id1_type2',
14+
KEY `id1_type3` (`id1`,`visibility`,`time`,`version`,`data`,`link_type`) COMMENT 'rev:cf_link_id1_type3'
15+
) ENGINE=RocksDB DEFAULT COLLATE=latin1_bin;
16+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
17+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc;
18+
id1 id2 link_type visibility data time version
19+
100 100 1 1 100 100 100
20+
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';
21+
case when variable_value-@c > 0 then 'true' else 'false' end
22+
true
23+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
24+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 order by time desc;
25+
id1 id2 link_type visibility data time version
26+
100 100 1 1 100 100 100
27+
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';
28+
case when variable_value-@c > 0 then 'true' else 'false' end
29+
true
30+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
31+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc;
32+
id1 id2 link_type visibility data time version
33+
100 100 1 1 100 100 100
34+
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';
35+
case when variable_value-@c = 0 then 'true' else 'false' end
36+
true
37+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
38+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 and time >= 0 order by time desc;
39+
id1 id2 link_type visibility data time version
40+
100 100 1 1 100 100 100
41+
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';
42+
case when variable_value-@c > 0 then 'true' else 'false' end
43+
true
44+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
45+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 order by time desc;
46+
id1 id2 link_type visibility data time version
47+
100 100 1 1 100 100 100
48+
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';
49+
case when variable_value-@c = 0 then 'true' else 'false' end
50+
true
51+
## HA_READ_PREFIX_LAST
52+
# BF len 20
53+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
54+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 order by time desc;
55+
id1 id2 link_type visibility data time version
56+
100 100 1 1 100 100 100
57+
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';
58+
case when variable_value-@c > 0 then 'true' else 'false' end
59+
true
60+
# BF len 19
61+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
62+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 order by time desc;
63+
id1 id2 link_type visibility data time version
64+
100 100 1 1 100 100 100
65+
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';
66+
case when variable_value-@c = 0 then 'true' else 'false' end
67+
true
68+
# BF len 12
69+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
70+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and visibility = 1 order by time desc;
71+
id1 id2 link_type visibility data time version
72+
100 100 1 1 100 100 100
73+
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';
74+
case when variable_value-@c = 0 then 'true' else 'false' end
75+
true
76+
DROP TABLE linktable;
77+
#
78+
# bloom filter prefix is 20 byte
79+
# Create a key which is longer than that, so that we see that
80+
# eq_cond_len= slice.size() - 1;
81+
# doesnt work.
82+
#
83+
# indexnr 4
84+
# kp0 + 4 = 8
85+
# kp1 + 8 = 16
86+
# kp2 + 8 = 24 24>20 byte length prefix
87+
# kp3 + 8 = 28
88+
create table t1 (
89+
pk int primary key,
90+
kp0 int not null,
91+
kp1 bigint not null,
92+
kp2 bigint not null,
93+
kp3 bigint not null,
94+
key kp12(kp0, kp1, kp2, kp3) comment 'rev:x1'
95+
) engine=rocksdb;
96+
insert into t1 values (1, 1,1, 1,1);
97+
insert into t1 values (10,1,1,0x12FFFFFFFFFF,1);
98+
insert into t1 values (11,1,1,0x12FFFFFFFFFF,1);
99+
insert into t1 values (20,2,2,0x12FFFFFFFFFF,1);
100+
insert into t1 values (21,2,2,0x12FFFFFFFFFF,1);
101+
explain
102+
select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc;
103+
id select_type table type possible_keys key key_len ref rows Extra
104+
1 SIMPLE t1 ref kp12 kp12 20 const,const,const 1 Using where; Using index
105+
show status like '%rocksdb_bloom_filter_prefix%';
106+
Variable_name Value
107+
rocksdb_bloom_filter_prefix_checked 0
108+
rocksdb_bloom_filter_prefix_useful 0
109+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
110+
select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc;
111+
pk kp0 kp1 kp2 kp3
112+
11 1 1 20890720927743 1
113+
10 1 1 20890720927743 1
114+
show status like '%rocksdb_bloom_filter_prefix%';
115+
Variable_name Value
116+
rocksdb_bloom_filter_prefix_checked 0
117+
rocksdb_bloom_filter_prefix_useful 0
118+
# The following MUST show TRUE:
119+
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';
120+
case when variable_value-@c = 0 then 'true' else 'false' end
121+
true
122+
drop table t1;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--rocksdb_default_cf_options=write_buffer_size=64k;block_based_table_factory={filter_policy=bloomfilter:10:false;whole_key_filtering=0;};prefix_extractor=capped:20
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
--source include/have_rocksdb.inc
2+
3+
--source include/restart_mysqld.inc
4+
CREATE TABLE `linktable` (
5+
`id1` bigint(20) unsigned NOT NULL DEFAULT '0',
6+
`id1_type` int(10) unsigned NOT NULL DEFAULT '0',
7+
`id2` bigint(20) unsigned NOT NULL DEFAULT '0',
8+
`id2_type` int(10) unsigned NOT NULL DEFAULT '0',
9+
`link_type` bigint(20) unsigned NOT NULL DEFAULT '0',
10+
`visibility` tinyint(3) NOT NULL DEFAULT '0',
11+
`data` varchar(255) NOT NULL DEFAULT '',
12+
`time` bigint(20) unsigned NOT NULL DEFAULT '0',
13+
`version` int(11) unsigned NOT NULL DEFAULT '0',
14+
PRIMARY KEY (link_type, `id1`,`id2`) COMMENT 'cf_link_pk',
15+
KEY `id1_type` (`id1`,`link_type`,`visibility`,`time`,`version`,`data`) COMMENT 'rev:cf_link_id1_type',
16+
KEY `id1_type2` (`id1`,`link_type`,`time`,`version`,`data`,`visibility`) COMMENT 'rev:cf_link_id1_type2',
17+
KEY `id1_type3` (`id1`,`visibility`,`time`,`version`,`data`,`link_type`) COMMENT 'rev:cf_link_id1_type3'
18+
) ENGINE=RocksDB DEFAULT COLLATE=latin1_bin;
19+
20+
--disable_query_log
21+
let $i = 1;
22+
while ($i <= 10000) {
23+
let $insert = INSERT INTO linktable VALUES($i, $i, $i, $i, 1, 1, $i, $i, $i);
24+
eval $insert;
25+
inc $i;
26+
}
27+
--enable_query_log
28+
29+
## HA_READ_PREFIX_LAST_OR_PREV
30+
# BF len 21
31+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
32+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc;
33+
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';
34+
35+
# BF len 20
36+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
37+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 order by time desc;
38+
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';
39+
40+
# BF len 13
41+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
42+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc;
43+
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';
44+
45+
## HA_READ_PREFIX_LAST_OR_PREV (no end range)
46+
# BF len 20
47+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
48+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 and time >= 0 order by time desc;
49+
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';
50+
51+
# BF len 19
52+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
53+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 order by time desc;
54+
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';
55+
56+
--echo ## HA_READ_PREFIX_LAST
57+
--echo # BF len 20
58+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
59+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 order by time desc;
60+
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';
61+
62+
--echo # BF len 19
63+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
64+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 order by time desc;
65+
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';
66+
67+
--echo # BF len 12
68+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
69+
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and visibility = 1 order by time desc;
70+
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';
71+
72+
73+
DROP TABLE linktable;
74+
--source include/restart_mysqld.inc
75+
76+
--echo #
77+
--echo # bloom filter prefix is 20 byte
78+
--echo # Create a key which is longer than that, so that we see that
79+
--echo # eq_cond_len= slice.size() - 1;
80+
--echo # doesnt work.
81+
--echo #
82+
--echo # indexnr 4
83+
--echo # kp0 + 4 = 8
84+
--echo # kp1 + 8 = 16
85+
--echo # kp2 + 8 = 24 24>20 byte length prefix
86+
--echo # kp3 + 8 = 28
87+
88+
create table t1 (
89+
pk int primary key,
90+
kp0 int not null,
91+
kp1 bigint not null,
92+
kp2 bigint not null,
93+
kp3 bigint not null,
94+
key kp12(kp0, kp1, kp2, kp3) comment 'rev:x1'
95+
) engine=rocksdb;
96+
97+
insert into t1 values (1, 1,1, 1,1);
98+
insert into t1 values (10,1,1,0x12FFFFFFFFFF,1);
99+
insert into t1 values (11,1,1,0x12FFFFFFFFFF,1);
100+
insert into t1 values (20,2,2,0x12FFFFFFFFFF,1);
101+
insert into t1 values (21,2,2,0x12FFFFFFFFFF,1);
102+
103+
--source include/restart_mysqld.inc
104+
105+
explain
106+
select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc;
107+
show status like '%rocksdb_bloom_filter_prefix%';
108+
109+
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
110+
select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc;
111+
show status like '%rocksdb_bloom_filter_prefix%';
112+
--echo # The following MUST show TRUE:
113+
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';
114+
115+
drop table t1;
116+
# Key length is 4 + 8 + 8 = 20
117+

sql/opt_range.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10911,8 +10911,15 @@ int QUICK_SELECT_DESC::get_next()
1091110911
will use ha_index_prev() to read data, we need to let the
1091210912
handler know where to end the scan in order to avoid that the
1091310913
ICP implemention continues to read past the range boundary.
10914+
10915+
An addition for MyRocks:
10916+
MyRocks needs to know both start of the range and end of the range
10917+
in order to use its bloom filters. This is useful regardless of whether
10918+
ICP is usable (e.g. it is used for index-only scans which do not use
10919+
ICP). Because of that, we remove the following:
10920+
10921+
// if (file->pushed_idx_cond)
1091410922
*/
10915-
if (file->pushed_idx_cond)
1091610923
{
1091710924
if (!eqrange_all_keyparts)
1091810925
{

storage/rocksdb/ha_rocksdb.cc

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,13 +3454,12 @@ int ha_rocksdb::read_range_first(const key_range *start_key,
34543454
result= ha_index_first(table->record[0]);
34553455
else
34563456
{
3457-
bool is_eq_cond_range_scan= end_key&&(start_key->flag!=HA_READ_KEY_EXACT);
34583457
MYSQL_TABLE_IO_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0,
34593458
{ result= index_read_map_impl(table->record[0],
34603459
start_key->key,
34613460
start_key->keypart_map,
34623461
start_key->flag,
3463-
is_eq_cond_range_scan, end_key); })
3462+
end_key); })
34643463
}
34653464
if (result)
34663465
DBUG_RETURN((result == HA_ERR_KEY_NOT_FOUND)
@@ -3487,7 +3486,7 @@ int ha_rocksdb::index_read_map(uchar *buf, const uchar *key,
34873486
key_part_map keypart_map,
34883487
enum ha_rkey_function find_flag)
34893488
{
3490-
return index_read_map_impl(buf, key, keypart_map, find_flag, false, NULL);
3489+
return index_read_map_impl(buf, key, keypart_map, find_flag, nullptr);
34913490
}
34923491

34933492
/*
@@ -3505,7 +3504,6 @@ int ha_rocksdb::index_read_map(uchar *buf, const uchar *key,
35053504
int ha_rocksdb::index_read_map_impl(uchar *buf, const uchar *key,
35063505
key_part_map keypart_map,
35073506
enum ha_rkey_function find_flag,
3508-
const bool is_eq_cond_range_scan,
35093507
const key_range *end_key)
35103508
{
35113509
int rc= 0;
@@ -3516,6 +3514,8 @@ int ha_rocksdb::index_read_map_impl(uchar *buf, const uchar *key,
35163514
bool using_full_key= (keypart_map == HA_WHOLE_KEY) ||
35173515
(keypart_map == ((key_part_map(1) << actual_key_parts)
35183516
- 1));
3517+
if (!end_key)
3518+
end_key= end_range;
35193519

35203520
/* By default, we don't need the retrieved records to match the prefix */
35213521
sec_key_match_prefix= NULL;
@@ -3541,14 +3541,6 @@ int ha_rocksdb::index_read_map_impl(uchar *buf, const uchar *key,
35413541
DBUG_RETURN(rc);
35423542
}
35433543

3544-
uint end_key_packed_size= 0;
3545-
if (is_eq_cond_range_scan && end_key)
3546-
{
3547-
end_key_packed_size= kd->pack_index_tuple(this, table, pack_buffer,
3548-
end_key_packed_tuple, end_key->key,
3549-
end_key->keypart_map);
3550-
}
3551-
35523544
/*
35533545
Unique secondary index performs lookups without the extended key fields
35543546
*/
@@ -3591,23 +3583,39 @@ int ha_rocksdb::index_read_map_impl(uchar *buf, const uchar *key,
35913583
memcpy(sec_key_match_prefix, sec_key_packed_tuple, packed_size);
35923584
}
35933585

3586+
int bytes_changed_by_succ= 0;
35943587
if (find_flag == HA_READ_PREFIX_LAST_OR_PREV ||
35953588
find_flag == HA_READ_PREFIX_LAST ||
35963589
find_flag == HA_READ_AFTER_KEY)
35973590
{
35983591
/* See below */
3599-
kd->successor(sec_key_packed_tuple, packed_size);
3592+
bytes_changed_by_succ= kd->successor(sec_key_packed_tuple, packed_size);
36003593
}
36013594

36023595
rocksdb::Slice slice((char*)sec_key_packed_tuple, packed_size);
36033596

3597+
uint end_key_packed_size= 0;
3598+
36043599
uint eq_cond_len= 0;
36053600
if (find_flag == HA_READ_KEY_EXACT)
36063601
{
36073602
eq_cond_len= slice.size();
36083603
}
3609-
else if (is_eq_cond_range_scan && end_key_packed_size > 0)
3604+
else if (find_flag == HA_READ_PREFIX_LAST)
36103605
{
3606+
/*
3607+
We have made the kd->successor(sec_key_packed_tuple) call above.
3608+
3609+
The slice is at least RDBSE_KEYDEF::INDEX_NUMBER_SIZE bytes long.
3610+
*/
3611+
eq_cond_len= slice.size() - bytes_changed_by_succ;
3612+
}
3613+
else if (end_key)
3614+
{
3615+
end_key_packed_size= kd->pack_index_tuple(this, table, pack_buffer,
3616+
end_key_packed_tuple,
3617+
end_key->key,
3618+
end_key->keypart_map);
36113619
/*
36123620
Calculating length of the equal conditions here. 4 byte index id is included.
36133621
Example1: id1 BIGINT, id2 INT, id3 BIGINT, PRIMARY KEY (id1, id2, id3)

storage/rocksdb/ha_rocksdb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ class ha_rocksdb: public handler
485485
int index_read_map_impl(uchar * buf, const uchar * key,
486486
key_part_map keypart_map,
487487
enum ha_rkey_function find_flag,
488-
const bool is_eq_cond_range_scan,
489488
const key_range *end_key);
490489

491490
int index_read_last_map(uchar * buf, const uchar * key,

storage/rocksdb/rdb_datadic.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,19 +436,24 @@ bool RDBSE_KEYDEF::unpack_info_has_checksum(const rocksdb::Slice &unpack_info)
436436
unpack_info.data()[0]== CHECKSUM_DATA_TAG);
437437
}
438438

439-
440-
void RDBSE_KEYDEF::successor(uchar *packed_tuple, uint len)
439+
/*
440+
@return Number of bytes that were changed
441+
*/
442+
int RDBSE_KEYDEF::successor(uchar *packed_tuple, uint len)
441443
{
444+
int changed= 0;
442445
uchar *p= packed_tuple + len - 1;
443446
for (; p > packed_tuple; p--)
444447
{
448+
changed++;
445449
if (*p != uchar(0xFF))
446450
{
447451
*p= *p + 1;
448452
break;
449453
}
450454
*p='\0';
451455
}
456+
return changed;
452457
}
453458

454459

0 commit comments

Comments
 (0)