maria:bb-11.0-before-feb

Last commit made on 2023-02-03
Get this branch:
git clone -b bb-11.0-before-feb https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-11.0-before-feb
Repository:
lp:maria

Recent commits

b368a0e... by Sergey Petrunia

MDEV-30529: Assertion `rnd_records <= s->found_records' failed in best_access_path

best_access_path() has an assertion:

   DBUG_ASSERT(rnd_records <= s->found_records);

make it rounding-safe.

05b9dbd... by Sergey Petrunia

MDEV-30525: Assertion `ranges > 0' fails in IO_AND_CPU_COST handler::keyread_time

Make get_best_group_min_max() exit early if the table has
table->records()=0. Attempting to compute loose scan over 0
groups eventually causes an assert when trying to get the
cost of reading 0 ranges.

23808cd... by Sergey Petrunia

Fix compile on Windows, part 2

20b3ca9... by Sergey Petrunia

Fix compile on some linux platforms

679324d... by Sergey Petrunia

Fix compile on Windows

051b71e... by Monty <email address hidden>

Fixed bug in extended key handling when there is no primary key

Extended keys works by first checking if the engine supports extended
keys.
If yes, it extends secondary key with primary key components and mark the
secondary keys as HA_EXT_NOSAME (unique).
If we later notice that there where no primary key, the extended key
information for secondary keys in share->key_info is reset. However the
key_info->flag HA_EXT_NOSAME was not reset!

This causes some strange things to happen:
- Tables that have no primary key or secondary index that contained the
  primary key would be wrongly optimized as the secondary key could be
  thought to be unique when it was not and not unique when it was.
- The problem was not shown in EXPLAIN because of a bug in
  create_ref_for_key() that caused EQ_REF to be displayed by EXPLAIN as REF
  when extended keys where used and the secondary key contained the primary
  key.

This is fixed with:
- Removed wrong test in make_join_select() which did not detect that key
  where unique when a secondary key contains the primary.
- Moved initialization of extended keys from create_key_infos() to
  init_from_binary_frm_image() after we know if there is a usable primary
  key or not. One disadvantage with this approach is that key_info->key_parts
  may have not used slots (for keys we thought could be extended but could
  not). Fixed by adding a check for unused key_parts to
  copy_keys_from_share()

- Other things:
 - Simplified copying of first key part in create_key_infos().
 - Added a lot of code comments in code that I had to check as part of
   finding the issue.
 - Fixed some indentation.
 - Replaced a couple of looks using references to pointers in C
   context where the reference does not give any benefit.

Test case changes:
- innodb_mysql.test changed index as an index the optimizer thought
  was unique, was not. (Table had no primary key)

TODO:
- Move code that checks for partial or too long keys to the primary loop
  earlier that initally decides if we should add extended key fields.
  This is needed to ensure that HA_EXT_NOSAME is not set for partial or
  too long keys. It will also shorten the current code notable.

1ae812c... by Monty <email address hidden>

MDEV-30486 Table is not eliminated in bb-11.0

Some tables where not eliminated when they could have been.
This was caused because HA_KEYREAD_ONLY is not set anymore for InnoDB
clustered index and the elimination code was depending on
field->part_of_key_not_clustered which was not set if HA_KEYREAD_ONLY
is not present.

Fixed by moving out field->part_of_key and
field->part_of_key_not_clustered from under HA_KEYREAD_ONLY (which
they should never have been part of).

Other things:
- Fixed a bug in make_join_select() that caused range to be used when
  there where elminiated or constant tables present (Caused wrong
  change of plans in join_outer_innodb.test). This also affected
  show_explain.test and subselct_sj_mat.test where wrong 'range's where
  replaced with index scans.

Reviewer: Sergei Petrunia <email address hidden>

833c42c... by Monty <email address hidden>

Removed /2 of InnoDB ref_per_key[] estimates

The original code was there to favor index search over table scan.
This is not needed anymore as the cost calculations for table scans
and index lookups are now more exact.

f57f350... by Sergey Petrunia

Optimizer Trace: make plan_prefix not show const/eliminated tables

a2087bd... by Sergei Golubchik

remove GET_ADJUST_VALUE

avoid contaminating my_getopt with sysvar implementation details.
adjust variable values after my_getopt, like it's done for others.
this fixes --help to show correct values.