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

Cherry-picked from MyRocks upstream: Issue #809: Wrong query result with bloom filters

In reverse-ordered column families, if one wants to start reading at the
  logical end of the index, they should Seek() to a key value that is not
  covered by the index. This may (and typically does) prevent use of a bloom
  filter.
  The calls to setup_scan_iterator() that are made for index and table scan
  didn't take this into account and passed eq_cond_len=INDEX_NUMBER_SIZE.
  Fixed them to compute and pass correct eq_cond_len.

  Also, removed an incorrect assert in ha_rocksdb::setup_iterator_bounds.
This commit is contained in:
Sergei Petrunia
2018-05-07 20:21:35 +03:00
parent 39fbafbcc2
commit e3661b9f7c
5 changed files with 149 additions and 10 deletions

View File

@@ -238,12 +238,28 @@ public:
*size = INDEX_NUMBER_SIZE;
}
/* Get the first key that you need to position at to start iterating.
Returns a "supremum" or "infimum" for this index based on collation order
/*
Get the first key that you need to position at to start iterating.
Stores into *key a "supremum" or "infimum" key value for the index.
@return Number of bytes in the key that are usable for bloom filter use.
*/
inline void get_first_key(uchar *const key, uint *const size) const {
return m_is_reverse_cf ? get_supremum_key(key, size)
: get_infimum_key(key, size);
inline int get_first_key(uchar *const key, uint *const size) const {
if (m_is_reverse_cf)
get_supremum_key(key, size);
else
get_infimum_key(key, size);
/* Find out how many bytes of infimum are the same as m_index_number */
uchar unmodified_key[INDEX_NUMBER_SIZE];
rdb_netbuf_store_index(unmodified_key, m_index_number);
int i;
for (i = 0; i < INDEX_NUMBER_SIZE; i++) {
if (key[i] != unmodified_key[i])
break;
}
return i;
}
/* Make a key that is right after the given key. */