mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-11321: MariaRocks: type_binary_indexes, type_blob_indexes fail
... due to different index statistics Make statistics calculations in MariaRocks produce the same values that MyRocks produces. Added a comment in rdb_datadic.cc
This commit is contained in:
@@ -8464,11 +8464,25 @@ int ha_rocksdb::info(uint flag)
|
||||
if ((x == 0 && rocksdb_debug_optimizer_no_zero_cardinality) ||
|
||||
rocksdb_debug_optimizer_n_rows > 0)
|
||||
{
|
||||
/*
|
||||
Make MariaRocks behave the same way as MyRocks does:
|
||||
1. SQL layer thinks that unique secondary indexes are not extended
|
||||
with PK columns (both in MySQL and MariaDB)
|
||||
2. MariaDB also thinks that indexes with partially-covered columns
|
||||
are not extended with PK columns. Use the same number of
|
||||
keyparts that MyRocks would use.
|
||||
*/
|
||||
uint ext_key_parts2;
|
||||
if (k->flags & HA_NOSAME)
|
||||
ext_key_parts2= k->ext_key_parts; // This is #1
|
||||
else
|
||||
ext_key_parts2= m_key_descr_arr[i]->get_key_parts(); // This is #2.
|
||||
|
||||
// Fake cardinality implementation. For example, (idx1, idx2, idx3) index
|
||||
// will have rec_per_key for (idx1)=4, (idx1,2)=2, and (idx1,2,3)=1.
|
||||
// rec_per_key for the whole index is 1, and multiplied by 2^n if
|
||||
// n suffix columns of the index are not used.
|
||||
x = 1 << (k->ext_key_parts-j-1);
|
||||
x = 1 << (ext_key_parts2-j-1);
|
||||
}
|
||||
k->rec_per_key[j]= x;
|
||||
}
|
||||
|
@@ -283,7 +283,12 @@ void Rdb_key_def::setup(const TABLE *tbl, const Rdb_tbl_def *tbl_def)
|
||||
key_part++;
|
||||
/*
|
||||
For "unique" secondary indexes, pretend they have
|
||||
"index extensions"
|
||||
"index extensions".
|
||||
|
||||
MariaDB also has this property: if an index has a partially-covered
|
||||
column like KEY(varchar_col(N)), then the SQL layer will think it is
|
||||
not "extended" with PK columns. The code below handles this case,
|
||||
also.
|
||||
*/
|
||||
if (secondary_key && src_i+1 == key_info->ext_key_parts)
|
||||
{
|
||||
|
Reference in New Issue
Block a user