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>
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.
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.
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>
Creating a temporary table with Spider is non-sense because a Spider
table cannot hold any physical data and it requires an additional
effort to manage even if it is configured correctly.
Set HTON_TEMPORARY_NOT_SUPPORTED to spider_hton->flags.
Reviewed-by: nayuta.yanagisawa@hey.com
Co-authored-by: d8sk4ueun@gmail.com
The check on the SQL command type, in ha_spider::external_lock() is deleted
by e954d9de. This resulted in the wrong call of spider_internal_start_trx()
(and thus Ha_trx_info::register_ha()).
I reverted the check and refactored ha_spider::external_lock().
The original query "SELECT IF(COUNT(a.`id`)>=0,'Y','N') FROM t" is
transformed to "SELECT COUNT(a.`id`), IF(ref >= 0, 'Y', 'N') FROM t",
where ref is Item_ref to "COUNT(a.`id`)", by split_sum_func().
Spider walks the item list twice, invoking spider_db_print_item_type().
The first invocation is in spider_create_group_by_handler() with
str == NULL. The second one is in spider_group_by_handler::init_scan()
with str != NULL.
spider_db_print_item_type() prints nothing at the first invocation,
and it prints item at the second invocation. However, at the second
invocation, the above mentioned ref to "COUNT(a.`id`)" points to
a field in a temporary table where the result will be stored. Thus,
to look behind the item_ref, Spider need to generate the query earlier.
A possible fix would be to generate a query to send in
spider_create_group_by_handler(). However, the fix requires a
considerable amount of changes of the Spider's GROUP BY handler.
I'd like to avoid that.
So, I fix the problem by not to use the GROUP BY handler when a
query contains Item_ref whose table_name, name, and alias_name_used
are not set.
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.
Some Spider table options introduces an unnecessary complication to
Spider settings. For example, the default value of the plugin variable
spider_auto_increment_mode is -1 (use table value) and the default
table option value is 0 (normal mode). Thus, the virtual default value
of the variable is 0. This kind of indirection is confusing.
In order to delete such confusing table options in a future release,
we first change the default values of some Spider plugin variables
from -1 (use table value) to the corresponding default table values.
The default table values are defined in spider_set_connect_info_default().
At the same time, we also deprecate the option value -1 (use table value).
Deprecate the plugin variable spider_use_handler and the corresponding
table parameters "uhd" and "use_handler".
Passing a Handler statement to data nodes, without converting it to
SQL sometimes, might improve the performance, while this introduces
some complication to the implementation.
In the first place, only a few people use Handler statements and the
performance gain seems not to be very significant. Further, setting
spider_use_handler > 0 disables the GROUP BY handler. So, we decided
to deprecate the variable.
The commit e954d9de gave different lifetime to wide_share and
partition_handler_share. This introduced the possibility that
partition_handler_share could be accessed even after it was freed.
We stop sharing partitoiin_handler_share and make it belong to
a single wide_handler to fix the problem.
The Spider storage engine ignored the implicit grouping when
aggregation was converted to constant by the query optimizer.
As a result, the Spider SE returned rows more than expected.
To fix the problem, we notify the Spider SE of the existence of
the implicit grouping via Query::distinct.
The reason of the double lock was an extraneous ha_flush_logs().
Unlike the upstream it is unnecessary in Mariadb that exploits a binlog
checkpoint mechanism for not letting PURGE or RESET-MASTER to trouble
transaction recovery. That is in case should a trx
be prepared but its binlog file gone, the trx then is committed on disk too.
Those facts have been always verified by existing tests of
binlog.binlog_{checkpoint,xa_recover}.test.
A regression test for the bug is included though.
in case of a bulk insert the server sends all rows to the engine, and
then the engine replies that there was ER_DUP_ENTRY somewhere.
the exact number of the row that caused the error is unknown.
The server crashes due to passing NULL to spider_free().
In some cases, this == pt_handler_share_handlers[0] at the label
error_get_share in ha_spider::open().
In such cases, to nullify pt_handler_share_handlers[0]->wide_handler
is nothing but to nullify this->wide_handler. We should not do this
before freeing this->wide_handler.
Spider accesses a freed connection in ha_spider::end_bulk_insert()
and results in SIGSEGV.
The cause of the bug is that ha_spider::is_bulk_insert_exec_period()
wrongly returns TRUE when the bulk insertion has not yet started.
Spider decides whether it is during the bulk insertion or not by
the value of insert_pos, but the variable is not reset in a case,
and this result in the bug.
The server crashes if ALTER TABLE, which accesses physical data
placed at data nodes, is performed on a Spider table.
The cause of the bug is that spider_check_trx_and_get_conn() does
not allocate connections if sql_command == SQLCOM_ALTER_TABLE.
Some ALTER TABLE statements, like ALTER TABLE ... CHECK PARTITION,
access data nodes. So, we need to allocate a new connection before
performing ALTER TABLEs.