Commit graph

111 commits

Author SHA1 Message Date
Marko Mäkelä
be24e75229 Merge 10.11 into 11.0 2023-10-19 08:12:16 +03:00
Marko Mäkelä
d5e15424d8 Merge 10.6 into 10.10
The MDEV-29693 conflict resolution is from Monty, as well as is
a bug fix where ANALYZE TABLE wrongly built histograms for
single-column PRIMARY KEY.
Also includes a fix for safe_malloc error reporting.

Other things:
- Copied main.log_slow from 10.4 to avoid mtr issue

Disabled test:
- spider/bugfix.mdev_27239 because we started to get
  +Error	1429 Unable to connect to foreign data source: localhost
  -Error	1158 Got an error reading communication packets
- main.delayed
  - Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
    This part is disabled for now as it fails randomly with different
    warnings/errors (no corruption).
2023-10-14 13:36:11 +03:00
Yuchen Pei
50784c8869
MDEV-32238 Adding a switch to disable the spider group by handler
The system variable spider_disable_group_by_handler, if on, will
disable the spider group by handler (gbh), and such disablement serves
as workaround to bugs caused by gbh, labelled with spider-gbh on jira,
including MDEV-26247, MDEV-28998, MDEV-29163, MDEV-30392, MDEV-31645.
Tests for these tickets are added accordingly with the workaround in
place.
2023-10-11 14:31:32 +11:00
Yuchen Pei
68a002071b
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.
2023-09-15 12:08:25 +10:00
Oleksandr Byelkin
51f9d62005 Merge branch '10.11' into 11.0 2023-08-09 07:53:48 +02:00
Oleksandr Byelkin
ced243a099 Merge branch '10.9' into 10.10 2023-08-05 20:34:09 +02:00
Oleksandr Byelkin
998edc374e Merge branch '10.6' into 10.9 2023-08-04 13:27:20 +02:00
Yuchen Pei
10eff9c809
MDEV-31524 Post-merge fixup 2023-08-04 18:38:51 +10:00
Oleksandr Byelkin
34a8e78581 Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00
Oleksandr Byelkin
7564be1352 Merge branch '10.4' into 10.5 2023-07-26 16:02:57 +02:00
Yuchen Pei
e1d31a10af
MDEV-31524 Fixing spider table param / variable overriding
The existing (incorrect) overriding mechanism is:

Non-minus-one var value overrides table param overrides default value.

Before MDEV-27169, unspecified var value is -1. So if the user sets
both the var to be a value other than -1 and the table param, the var
value will prevail, which is incorrect.

After MDEV-27169, unspecified var value is default value. So if the
user does not set the var but sets the table param, the default value
will prevail, which is even more incorrect.

This patch fixes it so that table param, if specified, always
overrides var value, and the latter if not specified or set to -1,
falls back to the default value

We achieve this by replacing all such overriding in spd_param.cc with
macros that override in the correct way, and removing all the
"overriding -1" lines involving table params in
spider_set_connect_info_default() except for those table params not
defined as sysvar/thdvar in spd_params.cc

We also introduced macros for non-overriding sysvar and thdvar, so
that the code is cleaner and less error-prone

In server versions where MDEV-27169 has not been applied, we also
backport the patch, that is, replacing -1 default values with real
default values

In server versions where MDEV-28006 has not been applied, we do the
same for udf params
2023-07-13 13:22:24 +10:00
Yuchen Pei
b5d317197c
MDEV-29676 refactored and documented spider_get_share() and friends
Extracted out common subroutines, gave more meaningful names etc,
added comments etc.

Also:
- Documented active servers load balancing reads, and other fields in
  SPIDER_SHARE etc.
- Removed commented out code
- Documented and refactored self-reference check
- Removed some unnecessary functions
- Renamed unhelpful roop_count
- Refactored spider_get_{sts,crd}, where we turn get_type into an enum
- Cleaned up spider_mbase_handler::show_table_status() and
  spider_mbase_handler::show_index()
2023-04-28 10:29:29 +10:00
Marko Mäkelä
4ce6e78059 Merge 10.9 into 10.10 2022-07-28 11:25:21 +03:00
Marko Mäkelä
f53f64b7b9 Merge 10.8 into 10.9 2022-07-28 10:47:33 +03:00
Marko Mäkelä
f79cebb4d0 Merge 10.7 into 10.8 2022-07-28 10:33:26 +03:00
Yusuke Abe
48f3cf7570
MDEV-28795 Deprecate spider_bka_table_name_type 2022-07-25 09:33:11 +09:00
Marko Mäkelä
63961a08a6 Merge 10.9 into 10.10 2022-06-28 12:33:39 +03:00
Marko Mäkelä
404d4820af Merge 10.8 into 10.9 2022-06-28 10:59:01 +03:00
Marko Mäkelä
9523986299 Merge 10.7 into 10.8 2022-06-28 10:06:00 +03:00
Nayuta Yanagisawa
925999bb97 MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
When the variable, spider_semi_table_lock, is 1, Spider sends
LOCK TABLES before each SQL execution. The feature is for
non-transactional remote tables and adds some overhead to query
executions.

We change the default value of the plugin variable to 0 and then
deprecate the variable because it is rare to use non-transactional
engines these days and the variable complicates the code.

The variable, spider_semi_table_lock_connection, should be too
deprecated because it is for tweaking the semi-table locking.
2022-06-27 11:14:10 +09:00
Marko Mäkelä
9810a4ecdf Merge 10.9 into 10.10 2022-06-21 18:27:54 +03:00
Marko Mäkelä
707f2aa214 Merge 10.8 into 10.9 2022-06-21 18:21:07 +03:00
Marko Mäkelä
54ac356dea Merge 10.7 into 10.8 2022-06-21 18:19:24 +03:00
Sergei Golubchik
2643aa43ae fix spider.variable_deprecation test 2022-06-16 22:39:35 +02:00
Marko Mäkelä
32edabd1f2 Merge 10.9 into 10.10 2022-06-09 15:26:09 +03:00
Nayuta Yanagisawa
57d233e2a6 MDEV-27256 Delete spider_use_handler and related code (2/3)
Delete the deprecated variable, spider_use_handler and related code.

Spider now does not supports accessing data nodes via handler
statements. Thus, the notion of SQL kinds are no longer useful.
We too discard it.
2022-06-09 17:26:27 +09:00
Nayuta Yanagisawa
8c4a2c8ad4 MDEV-26282 Make the version of Spider the same as the server version
Spider is now a part of the server. So, it doesn't make sense for Spider
to have its own version number apart from the server's one.
2022-06-08 14:01:48 +09:00
Marko Mäkelä
5a33a37682 Merge 10.8 into 10.9 2022-06-07 09:20:07 +03:00
Marko Mäkelä
600751e769 Merge 10.7 into 10.8 2022-06-02 08:01:17 +03:00
Hirokazu Hata
52be05be15
MDEV-27926 Deprecate spider_init_sql_alloc_size
Reviewed by: Nayuta Yanagisawa
2022-06-01 00:22:06 +09:00
Marko Mäkelä
3cc8539d84 Merge 10.9 into 10.10 2022-05-25 09:15:08 +03:00
Marko Mäkelä
1ace1075dc Merge 10.8 into 10.9 2022-05-25 08:52:21 +03:00
Marko Mäkelä
c2bae9c77f Merge 10.7 into 10.8 2022-05-25 08:38:17 +03:00
Masashi Tomooka
2577ff2667
MDEV-28560 Deprecate spider_buffer_size
The variable, spider_buffer_size, is used nowhere in the MariaDB Community Server.
2022-05-21 15:38:57 +09:00
Nayuta Yanagisawa
77a18e8217 MDEV-28006 Delete Spider plugin variables regarding UDFs and related code
Delete the plugin variables, which are deprecated by MDEV-28005,
regarding UDFs.
2022-05-18 17:05:14 +09:00
Marko Mäkelä
504a3b32f6 Merge 10.8 into 10.9 2022-04-28 15:54:03 +03:00
Marko Mäkelä
133c2129cd Merge 10.7 into 10.8 2022-04-27 10:43:00 +03:00
Norio Akagi
1866fb0537
MDEV-28297 Deprecate spider_internal_offset
Deprecate the server variable spider_internal_offset and the corresponding
table parameters "ios" and "internal_offset".

We believe this variable is not much use to users, therefore decided to
deprecate it.

Reviewed-by: Nayuta Yanagisawa <nayuta.yanagisawa@hey.com>
2022-04-15 19:06:35 +09:00
Nayuta Yanagisawa
cc13ab0ffc MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
Deprecate the variables spider_crd_type and spider_crd_weight.
The value should be defined by the engine developers.
2022-04-14 23:41:16 +09:00
Nayuta Yanagisawa
075c94fe2b MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
The variables, spider_crd_mode and spider_sts_mode, specify the
ways to fetch statistics from data nodes.

Using the SHOW command seems to work for any cases. Thus, we deprecate
the variables.
2022-04-14 23:39:42 +09:00
Nayuta Yanagisawa
7310e93ef6 MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
Deprecate the following variables:

* spider_store_last_crd
* spider_store_last_sts
* spider_load_crd_at_startup
* spider_load_sts_at_startup
2022-04-14 23:33:24 +09:00
Nayuta Yanagisawa
3be8f66185 MDEV-28244 Deprecate spider_xa_register_mode
We deprecate the variable spider_xa_register_mode because there is
no need to perform a two phase commit for a read-only transaction.

Note that the variable only affects Spider's internal XA transactions.
2022-04-14 23:31:15 +09:00
Marko Mäkelä
e98013cb5c Merge 10.8 into 10.9 2022-04-13 13:39:00 +03:00
Nayuta Yanagisawa
cbf9d8a8d5 Merge 10.7 into 10.8 2022-04-13 17:52:27 +09:00
KiyoshiTakeda
e87c710dfc
MDEV-27981 Deprecate spider_internal_limit
The variable spider_internal_limit is for specifying the number of
records acquired by Spider from each remote server. 

There seems not to be much use of the variable. Thus, we deprecate it
and the corresponding table options. 

Reviewed-by: Nayuta Yanagisawa <nayuta.yanagisawa@hey.com>
2022-04-13 15:21:15 +09:00
Daniel Black
7ae46ced37 Merge branch 10.8 into 10.9
Closes #2084
2022-04-06 14:33:27 +10:00
Daniel Black
7b06bc9a94 Merge branch 10.7 into 10.8
Closes #2083
2022-04-06 14:23:20 +10:00
Nayuta Yanagisawa
f78fdf087f MDEV-28005 Deprecate Spider plugin variables regarding UDFs
Configuring UDFs via plugin variables looks not a good idea.
The more variables Spider has, the more complex it becomes.
Further, I expect that only a few users use Spider UDFs.

Deprecate the following plugin variables regarding Spider UDFs:

* spider_udf_ds_bulk_insert_rows
* spider_udf_ds_table_loop_mode
* spider_udf_ds_use_real_table
* spider_udf_ct_bulk_insert_interval
* spider_udf_ct_bulk_insert_rows

spider_udf_table_lock_mutex_count and spider_udf_table_mon_mutex_count
are also for tweaking UDFs but they are already read-only. So,
there is no need to deprecate them.
2022-03-31 23:55:38 +09:00
Nayuta Yanagisawa
f76da7f662 MDEV-27474 Spider: remove #WITH_PARTITION_STORAGE_ENGINE
"#ifdef WITH_PARTITION_STORAGE_ENGINE ... #endif" appears frequently
in the Spider code base. However, there is no need to maintain such
ifdefs because Spider is disabled if the partitioning engine is disabled.
2022-03-31 21:43:59 +09:00
Marko Mäkelä
1ecf173741 Merge 10.8 into 10.9 2022-03-15 18:26:29 +02:00