maria:bb-11.2-mdev-28856-static-fallback

Last commit made on 2023-08-30
Get this branch:
git clone -b bb-11.2-mdev-28856-static-fallback https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-11.2-mdev-28856-static-fallback
Repository:
lp:maria

Recent commits

1bbab11... by Yuchen Pei <email address hidden>

MDEV-28856 [demo] static table options vs dynamic spider attributes

fbb05e4... by Yuchen Pei <email address hidden>

MDEV-28856 [wip] Add a new session sysvar spider_options_or_comments

8126b04... by Yuchen Pei <email address hidden>

MDEV-28856 [wip] Adding read_only spider engine option

It is added as an HA_TOPTION_SYSVAR, to the corresponding
read_only_mode thdvar. Because table options cannot be sigend, we
change the type of the thdvar from INT to BOOL. (TODO: consider
updating the spider_share field type accordingly) Also because a
sysvar table option automatically take (at least the default) value
from the sysvar, we can get rid of all the -1's and overriding
mechanism.

It is not working yet with some parsing error - the parser is not
recognising the new option for some reason.

Because we need table comment to override table options, and more
specific levels to override less specific ones, we have to free and
create strings, unfortunately.

Note that the existing implementation is buggy in overriding mechanism
between levels too: if a scalar table param (say read_only_mode) is
specified both in partition and table comments, the table comment
would take precendence, which is wrong. We fix this also (TODO: add a
testcase).

64c65fd... by Yuchen Pei <email address hidden>

MDEV-28856 Spider: Tests, documentation and some small fixes

Adding tests covering monitoring_kind=2. What it does is that it reads
from mysql.spider_link_mon_servers with matching db_name, table_name,
link_id, and does not do anything about that...

How monitoring_* can be useful: in the deprecated spider high
availability feature, when one remote fails, spider will try another
remote, which apparently makes use of these table parameters.

A test covering the query_cache_sync table param. Some further tests
on some spider table params.

Wrapper should be case insensitive.

Code documentation on spider priority binary tree.

Add an assertion that static_key_cardinality is always -1. All tests
pass still

56d8819... by Yuchen Pei <email address hidden>

MDEV-28856 Spider: drop server in tests

This helps eliminate "server exists" failures

4f39ae7... by Yuchen Pei <email address hidden>

MDEV-31586 Make the MDEV-31463 test more fitting and stable

The original test in the report of MDEV-31463 is contrived and
nondeterministic, causing MDEV-31586. We update the test to make it
more directly addresses the underlying cause of MDEV-31463, namely
errors from queries sent to the data node not consumed when trying to
set lock wait timeout. This is achieved through the debug sync
facility.

d7c012f... by Yuchen Pei <email address hidden>

MDEV-31787 MDEV-26151 Add a test exercising non-0 spider_casual_read

Also:
- clean up spider_check_and_get_casual_read_conn() and
  spider_check_and_set_autocommit()
- remove a couple of commented out code blocks

0a2161d... by Yuchen Pei <email address hidden>

MDEV-29502 Fix some issues with spider direct aggregate

The direct aggregate mechanism sems to be only intended to work when
otherwise a full table scan query will be executed from the spider
node and the aggregation done at the spider node too. Typically this
happens in sub_select(). In the test spider.direct_aggregate_part
direct aggregate allows to send COUNT statements directly to the data
nodes and adds up the results at the spider node, instead of iterating
over the rows one by one at the spider node.

By contrast, the group by handler (GBH) typically sends aggregated
queries directly to data nodes, in which case DA does not improve the
situation here.

That is why we should fix it by disabling DA when GBH is used.

There are other reasons supporting this change. First, the creation of
GBH results in a call to change_to_use_tmp_fields() (as opposed to
setup_copy_fields()) which causes the spider DA function
spider_db_fetch_for_item_sum_funcs() to work on wrong items. Second,
the spider DA function only calls direct_add() on the items, and the
follow-up add() needs to be called by the sql layer code. In
do_select(), after executing the query with the GBH, it seems that the
required add() would not necessarily be called.

Disabling DA when GBH is used does fix the bug. There are a few
other things included in this commit to improve the situation with
spider DA:

1. Add a session variable that allows user to disable DA completely,
this will help as a temporary measure if/when further bugs with DA
emerge.

2. Move the increment of direct_aggregate_count to the spider DA
function. Currently this is done in rather bizarre and random
locations.

3. Fix the spider_db_mbase_row creation so that the last of its row
field (sentinel) is NULL. The code is already doing a null check, but
somehow the sentinel field is on an invalid address, causing the
segfaults. With a correct implementation of the row creation, we can
avoid such segfaults.

2001521... by Yuchen Pei <email address hidden>

MDEV-31117 clean up spider connection info parsing

Spider connection string is a comma-separated parameter definitions,
where each definition is of the form "<param_title> <param_value>",
where <param_value> is quote delimited on both ends, with backslashes
acting as an escaping prefix.

The code however treated param title the same way as param value when
assigning, and have nonsensical fields like delim_title_len and
delim_title. We remove these.

We also clean up the spider comment connection string parsing,
including:

- Factoring out some code from the parsing function
- Rewriting the struct `st_spider_param_string_parse`, including
  replacing its messy methods with cleaner ones
- And any necessary changes caused by the above changes

0824bf5... by Yuchen Pei

MDEV-22979 MDEV-27233 MDEV-28218 Fixing spider init bugs

Fix spider init bugs (MDEV-22979, MDEV-27233, MDEV-28218) while
preventing regression on old ones (MDEV-30370, MDEV-29904)

Two things are changed:

First, Spider initialisation is made fully synchronous, i.e. it no
longer happens in a background thread. Adapted from the original fix
by nayuta for MDEV-27233. This change itself would cause failure when
spider is initialised early, by plugin-load-add, due to dependency on
Aria and udf function creation, which are fixed in the second and
third parts below. Requires SQL Service, thus porting earlier versions
requires MDEV-27595

Second, if spider is initialised before udf_init(), create udf by
inserting into `mysql.func`, otherwise do it by `CREATE FUNCTION` as
usual. This change may be generalised in MDEV-31401.

Also factor out some clean-up queries from deinit_spider.inc for use
of spider init tests.

A minor caveat is that early spider initialisation will fail if the
server is bootstrapped for the first time, due to missing `mysql`
database which needs to be created by the bootstrap script.