Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
Description
The parameter innodb_prefix_index_cluster_optimization enables an optimization that was added in MDEV-6929. Should the optimization turn out to be incorrect and broken beyond repair in our stress testing, it will have to be reverted. If it is correct, there should be no point to disable it by default.
Related to this, the counters Innodb_secondary_index_triggered_cluster_reads and Innodb_secondary_index_triggered_cluster_reads_avoided are determining the usefulness of this optimization. If we hard-wire the optimization to enabled or disabled, these counters should not serve any useful purpose. As noted in MDEV-21212, frequently updating global counters is not for free.
Attachments
Issue Links
- relates to
-
MDEV-6929 Port Facebook Prefix Index Queries Optimization
-
- Closed
-
-
MDEV-21212 buf_page_get_gen -> buf_pool->stat.n_page_gets++ is a cpu waste (0.5-1%)
-
- Closed
-
A section of the test innodb.monitor revealed that this feature is actually buggy:
This would incorrectly return the prefix '1' of the string '13'. The fix is simple:
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 01cf3b107a8..8afabf6220c 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -4202,7 +4202,9 @@ bool row_search_with_covering_prefix(
const dict_index_t* index = prebuilt->index;
ut_ad(!dict_index_is_clust(index));
- if (dict_index_is_spatial(index)) {
+ /* In ha_innobase::build_template() we choose to access the
+ whole row when using exclusive row locks. */
+ if (prebuilt->select_lock_type == LOCK_X || !index->is_btree()) {
return false;
}