Description:
At the end of the file sql/range_optimizer/path_helpers.h, the dbug_dump() function has a couple of typos that look like copy-paste errors:
case AccessPath::INDEX_MERGE: {
dbug_dump_index_merge(indent, verbose, *path->index_merge().children);
break;
}
case AccessPath::ROWID_INTERSECTION:
dbug_dump_rowid_intersection(indent, verbose,
*path->index_merge().children);
break;
case AccessPath::ROWID_UNION:
dbug_dump_rowid_union(indent, verbose, *path->index_merge().children);
break;
If the DBUG tracing is enabled, then this can cause an assert in the AccessPath::index_merge() function as the following assert will fail:
assert(type == INDEX_MERGE);
How to repeat:
1. Enable DBUG tracing.
2. Run an MTR test that exercises this code path. For example, "index_merge_rocksdb.test":
https://github.com/facebook/mysql-5.6/blob/b4981a19b460837c8d191a9c7a6c8d692afdecbb/mysql-...
Suggested fix:
The fix is to fix the typos to point to the right helper functions:
diff --git a/sql/range_optimizer/path_helpers.h b/sql/range_optimizer/path_helpers.h
index 391aafdad2b..da0faa27679 100644
--- a/sql/range_optimizer/path_helpers.h
+++ b/sql/range_optimizer/path_helpers.h
@@ -499,10 +499,10 @@ inline void dbug_dump(const AccessPath *path, int indent, bool verbose) {
}
case AccessPath::ROWID_INTERSECTION:
dbug_dump_rowid_intersection(indent, verbose,
- *path->index_merge().children);
+ *path->rowid_intersection().children);
break;
case AccessPath::ROWID_UNION:
- dbug_dump_rowid_union(indent, verbose, *path->index_merge().children);
+ dbug_dump_rowid_union(indent, verbose, *path->rowid_union().children);
break;
case AccessPath::INDEX_SKIP_SCAN:
dbug_dump_index_skip_scan(indent, verbose, path);