1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-18 21:44:20 +03:00

Merge branch '10.4' into 10.5

This commit is contained in:
Yuchen Pei 2024-01-10 18:01:46 +11:00
commit c9902a20b3
No known key found for this signature in database
GPG Key ID: 3DD1B35105743563
64 changed files with 520 additions and 144 deletions

View File

@ -892,6 +892,12 @@ sub collect_one_test_case {
}
my @no_combs = grep { $test_combs{$_} == 1 } keys %test_combs;
if (@no_combs) {
if ($::opt_skip_not_found) {
push @{$tinfo->{combinations}}, @no_combs;
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "combination not found";
return $tinfo;
}
mtr_error("Could not run $name with '".(
join(',', sort @no_combs))."' combination(s)");
}

View File

@ -768,14 +768,11 @@ INSERT INTO t1 VALUES (-1.0);
SELECT * FROM t1;
DROP TABLE t1;
#enable after MDEV-32645 is fixed
--disable_view_protocol
SELECT CAST(-1e0 AS UNSIGNED);
CREATE TABLE t1 (a BIGINT UNSIGNED);
INSERT INTO t1 VALUES (-1e0);
SELECT * FROM t1;
DROP TABLE t1;
--enable_view_protocol
SELECT CAST(-1e308 AS UNSIGNED);
CREATE TABLE t1 (a BIGINT UNSIGNED);

View File

@ -2624,4 +2624,49 @@ a
1
1
DROP TABLE t1;
#
# MDEV-31657: CTE with the same name as base table used twice
# in another CTE
#
create table t (a int);
insert into t values (3), (7), (1);
with
t as (select * from t),
cte as (select t1.a as t1a, t2.a as t2a from t as t1, t as t2 where t1.a=t2.a)
select * from cte;
t1a t2a
3 3
7 7
1 1
create table s (a int);
insert into s values (1), (4), (7);
with
t as (select * from t),
s as (select a-1 as a from s),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a+1)
select * from cte;
ta sa
3 3
2 1
8 7
with
t as (select * from t),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a),
s as (select a+10 as a from s)
select * from cte;
ta sa
1 1
7 7
2 2
8 8
drop table t,s;
with
t as (select * from t),
cte as (select t1.a as t1a, t2.a as t2a from t as t1, t as t2 where t1.a=t2.a)
select * from cte;
ERROR 42S02: Table 'test.t' doesn't exist
# End of 10.4 tests

View File

@ -1979,4 +1979,50 @@ SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-31657: CTE with the same name as base table used twice
--echo # in another CTE
--echo #
create table t (a int);
insert into t values (3), (7), (1);
let $q1=
with
t as (select * from t),
cte as (select t1.a as t1a, t2.a as t2a from t as t1, t as t2 where t1.a=t2.a)
select * from cte;
eval $q1;
create table s (a int);
insert into s values (1), (4), (7);
let $q2=
with
t as (select * from t),
s as (select a-1 as a from s),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a+1)
select * from cte;
eval $q2;
let $q3=
with
t as (select * from t),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a),
s as (select a+10 as a from s)
select * from cte;
eval $q3;
drop table t,s;
--ERROR ER_NO_SUCH_TABLE
eval $q1;
--echo # End of 10.4 tests

View File

@ -1167,5 +1167,42 @@ d 50
fdbl 123.456.789,12345678000000000000000000000000000000
fdec 123.456.789,12345678900000000000000000000000000000
#
# MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol
#
SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
CAST(-1e0 AS UNSIGNED) CAST(--2e0 AS UNSIGNED) CAST(---3e0 AS UNSIGNED) CAST(----4e0 AS UNSIGNED)
0 2 0 4
Warnings:
Note 1916 Got overflow when converting '-1' to UNSIGNED BIGINT. Value truncated
Note 1916 Got overflow when converting '-3' to UNSIGNED BIGINT. Value truncated
EXPLAIN EXTENDED SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(-1e0 as unsigned) AS `CAST(-1e0 AS UNSIGNED)`,cast(2e0 as unsigned) AS `CAST(--2e0 AS UNSIGNED)`,cast(-3e0 as unsigned) AS `CAST(---3e0 AS UNSIGNED)`,cast(4e0 as unsigned) AS `CAST(----4e0 AS UNSIGNED)`
CREATE VIEW v1 AS SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(-1e0 as unsigned) AS `CAST(-1e0 AS UNSIGNED)`,cast(2e0 as unsigned) AS `CAST(--2e0 AS UNSIGNED)`,cast(-3e0 as unsigned) AS `CAST(---3e0 AS UNSIGNED)`,cast(4e0 as unsigned) AS `CAST(----4e0 AS UNSIGNED)` latin1 latin1_swedish_ci
SELECT * FROM v1;
CAST(-1e0 AS UNSIGNED) CAST(--2e0 AS UNSIGNED) CAST(---3e0 AS UNSIGNED) CAST(----4e0 AS UNSIGNED)
0 2 0 4
Warnings:
Note 1916 Got overflow when converting '-1' to UNSIGNED BIGINT. Value truncated
Note 1916 Got overflow when converting '-3' to UNSIGNED BIGINT. Value truncated
DROP VIEW v1;
#
# End of 10.4 tests
#

View File

@ -716,6 +716,32 @@ $$
DELIMITER ;$$
--horizontal_results
--echo #
--echo # MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol
--echo #
SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
EXPLAIN EXTENDED SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
CREATE VIEW v1 AS SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
SHOW CREATE VIEW v1;
SELECT * FROM v1;
DROP VIEW v1;
--echo #
--echo # End of 10.4 tests
--echo #

View File

@ -252,3 +252,52 @@ SELECT NEXTVAL(s);
NEXTVAL(s)
1
DROP SEQUENCE s;
#
# MDEV-33169 Alter sequence 2nd ps fails while alter sequence 2nd time (no ps) succeeds
#
create sequence s;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
alter sequence s maxvalue 123;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
alter sequence s maxvalue 123;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
drop sequence s;
create sequence s;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
prepare stmt from 'alter sequence s maxvalue 123';
execute stmt;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
execute stmt;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
deallocate prepare stmt;
drop sequence s;
create sequence s;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create procedure p() alter sequence s maxvalue 123;
call p;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
call p;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
drop procedure p;
drop sequence s;
#
# End of 10.4 tests
#

View File

@ -167,3 +167,38 @@ ALTER TABLE s ORDER BY cache_size;
SELECT NEXTVAL(s);
DROP SEQUENCE s;
--enable_ps2_protocol
--echo #
--echo # MDEV-33169 Alter sequence 2nd ps fails while alter sequence 2nd time (no ps) succeeds
--echo #
create sequence s;
show create sequence s;
alter sequence s maxvalue 123;
show create sequence s;
alter sequence s maxvalue 123;
show create sequence s;
drop sequence s;
create sequence s;
show create sequence s;
prepare stmt from 'alter sequence s maxvalue 123';
execute stmt;
show create sequence s;
execute stmt;
show create sequence s;
deallocate prepare stmt;
drop sequence s;
create sequence s;
show create sequence s;
create procedure p() alter sequence s maxvalue 123;
call p;
show create sequence s;
call p;
show create sequence s;
drop procedure p;
drop sequence s;
--echo #
--echo # End of 10.4 tests
--echo #

View File

@ -10,8 +10,8 @@
#include <stdlib.h>
#include <string.h>
#include <security/pam_modules.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
#define N 3

View File

@ -19,10 +19,14 @@
#include <sys/types.h>
#if defined(HAVE_GETMNTENT)
#include <mntent.h>
#elif defined(HAVE_SYS_MNTENT)
#include <sys/mntent.h>
#elif !defined(HAVE_GETMNTINFO_TAKES_statvfs)
/* getmntinfo (the not NetBSD variants) */
#include <sys/param.h>
#if defined(HAVE_SYS_UCRED)
#include <sys/ucred.h>
#endif
#include <sys/mount.h>
#endif
#if defined(HAVE_GETMNTENT_IN_SYS_MNTAB)

View File

@ -6969,7 +6969,25 @@ Item *Item_float::neg(THD *thd)
else if (value < 0 && max_length)
max_length--;
value= -value;
presentation= 0;
if (presentation)
{
if (*presentation == '-')
{
// Strip double minus: -(-1) -> '1' instead of '--1'
presentation++;
}
else
{
size_t presentation_length= strlen(presentation);
if (char *tmp= (char*) thd->alloc(presentation_length + 2))
{
tmp[0]= '-';
// Copy with the trailing '\0'
memcpy(tmp + 1, presentation, presentation_length + 1);
presentation= tmp;
}
}
}
name= null_clex_str;
return this;
}

View File

@ -6841,8 +6841,8 @@ struct my_option my_long_options[]=
#endif
};
static int show_queries(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_queries(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONGLONG;
var->value= &thd->query_id;
@ -6850,16 +6850,16 @@ static int show_queries(THD *thd, SHOW_VAR *var, char *buff,
}
static int show_net_compression(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_net_compression(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
var->type= SHOW_MY_BOOL;
var->value= &thd->net.compress;
return 0;
}
static int show_starttime(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_starttime(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -6868,8 +6868,8 @@ static int show_starttime(THD *thd, SHOW_VAR *var, char *buff,
}
#ifdef ENABLED_PROFILING
static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_flushstatustime(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -6879,32 +6879,28 @@ static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff,
#endif
#ifdef HAVE_REPLICATION
static int show_rpl_status(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_rpl_status(THD *, SHOW_VAR *var, void *, system_status_var *,
enum_var_type)
{
var->type= SHOW_CHAR;
var->value= const_cast<char*>(rpl_status_type[(int)rpl_status]);
return 0;
}
static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_slave_running(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
Master_info *mi= NULL;
bool UNINIT_VAR(tmp);
var->type= SHOW_MY_BOOL;
var->value= buff;
if ((mi= get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_NOTE)))
if (Master_info *mi=
get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_NOTE))
{
tmp= (my_bool) (mi->slave_running == MYSQL_SLAVE_RUN_READING &&
mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN);
*((my_bool*) buff)=
(mi->slave_running == MYSQL_SLAVE_RUN_READING &&
mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN);
mi->release();
var->type= SHOW_MY_BOOL;
var->value= buff;
}
if (mi)
*((my_bool *)buff)= tmp;
else
var->type= SHOW_UNDEF;
return 0;
@ -6914,7 +6910,8 @@ static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff,
/* How many masters this slave is connected to */
static int show_slaves_running(THD *thd, SHOW_VAR *var, char *buff)
static int show_slaves_running(THD *, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONGLONG;
var->value= buff;
@ -6925,19 +6922,17 @@ static int show_slaves_running(THD *thd, SHOW_VAR *var, char *buff)
}
static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
Master_info *mi;
var->type= SHOW_LONGLONG;
var->value= buff;
if ((mi= get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_NOTE)))
if (Master_info *mi=
get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_NOTE))
{
*((longlong *)buff)= mi->received_heartbeats;
mi->release();
var->type= SHOW_LONGLONG;
var->value= buff;
}
else
var->type= SHOW_UNDEF;
@ -6945,19 +6940,17 @@ static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff,
}
static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_heartbeat_period(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
Master_info *mi;
var->type= SHOW_CHAR;
var->value= buff;
if ((mi= get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_NOTE)))
if (Master_info *mi=
get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_NOTE))
{
sprintf(buff, "%.3f", mi->heartbeat_period);
sprintf(static_cast<char*>(buff), "%.3f", mi->heartbeat_period);
mi->release();
var->type= SHOW_CHAR;
var->value= buff;
}
else
var->type= SHOW_UNDEF;
@ -6967,8 +6960,8 @@ static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff,
#endif /* HAVE_REPLICATION */
static int show_open_tables(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_open_tables(THD *, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -6976,8 +6969,8 @@ static int show_open_tables(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_prepared_stmt_count(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_prepared_stmt_count(THD *, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -6987,8 +6980,8 @@ static int show_prepared_stmt_count(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_table_definitions(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_table_definitions(THD *, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -7007,8 +7000,8 @@ static int show_table_definitions(THD *thd, SHOW_VAR *var, char *buff,
inside an Event.
*/
static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_ssl_get_version(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
var->type= SHOW_CHAR;
if( thd->vio_ok() && thd->net.vio->ssl_arg )
@ -7018,8 +7011,8 @@ static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -7030,8 +7023,8 @@ static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -7046,8 +7039,8 @@ static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_LONG;
var->value= buff;
@ -7059,8 +7052,8 @@ static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_CHAR;
if( thd->vio_ok() && thd->net.vio->ssl_arg )
@ -7070,9 +7063,10 @@ static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, void *buf,
system_status_var *, enum_var_type)
{
char *buff= static_cast<char*>(buf);
var->type= SHOW_CHAR;
var->value= buff;
if (thd->vio_ok() && thd->net.vio->ssl_arg)
@ -7157,8 +7151,8 @@ end:
*/
static int
show_ssl_get_server_not_before(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
show_ssl_get_server_not_before(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_CHAR;
if(thd->vio_ok() && thd->net.vio->ssl_arg)
@ -7167,7 +7161,7 @@ show_ssl_get_server_not_before(THD *thd, SHOW_VAR *var, char *buff,
X509 *cert= SSL_get_certificate(ssl);
const ASN1_TIME *not_before= X509_get0_notBefore(cert);
var->value= my_asn1_time_to_string(not_before, buff,
var->value= my_asn1_time_to_string(not_before, static_cast<char*>(buff),
SHOW_VAR_FUNC_BUFF_SIZE);
if (!var->value)
return 1;
@ -7191,8 +7185,8 @@ show_ssl_get_server_not_before(THD *thd, SHOW_VAR *var, char *buff,
*/
static int
show_ssl_get_server_not_after(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
show_ssl_get_server_not_after(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_CHAR;
if(thd->vio_ok() && thd->net.vio->ssl_arg)
@ -7201,7 +7195,7 @@ show_ssl_get_server_not_after(THD *thd, SHOW_VAR *var, char *buff,
X509 *cert= SSL_get_certificate(ssl);
const ASN1_TIME *not_after= X509_get0_notAfter(cert);
var->value= my_asn1_time_to_string(not_after, buff,
var->value= my_asn1_time_to_string(not_after, static_cast<char*>(buff),
SHOW_VAR_FUNC_BUFF_SIZE);
if (!var->value)
return 1;
@ -7255,7 +7249,7 @@ static int show_default_keycache(THD *thd, SHOW_VAR *var, void *buff,
}
static int show_memory_used(THD *thd, SHOW_VAR *var, char *buff,
static int show_memory_used(THD *thd, SHOW_VAR *var, void *buff,
struct system_status_var *status_var,
enum enum_var_type scope)
{
@ -7311,8 +7305,8 @@ static int debug_status_func(THD *thd, SHOW_VAR *var, void *buff,
#endif
#ifdef HAVE_POOL_OF_THREADS
static int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_threadpool_idle_threads(THD *, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_INT;
var->value= buff;
@ -7321,8 +7315,8 @@ static int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
}
static int show_threadpool_threads(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_threadpool_threads(THD *, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_INT;
var->value= buff;

View File

@ -8291,11 +8291,6 @@ bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables,
INSERT_ACL : SELECT_ACL);
}
if (tl->with || !tl->db.str ||
(tl->select_lex &&
(tl->with= tl->select_lex->find_table_def_in_with_clauses(tl))))
continue;
const ACL_internal_table_access *access=
get_cached_table_access(&t_ref->grant.m_internal,
t_ref->get_db_name(),
@ -12038,8 +12033,8 @@ static my_bool count_column_grants(void *grant_table,
This must be performed under the mutex in order to make sure the
iteration does not fail.
*/
static int show_column_grants(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_column_grants(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum enum_var_type scope)
{
var->type= SHOW_ULONG;
var->value= buff;
@ -12055,8 +12050,8 @@ static int show_column_grants(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
static int show_database_grants(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
static int show_database_grants(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum enum_var_type scope)
{
var->type= SHOW_UINT;
var->value= buff;

View File

@ -724,7 +724,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
wsrep_wfc()
#endif /*WITH_WSREP */
{
ulong tmp;
bzero(&variables, sizeof(variables));
/*
@ -877,14 +876,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
tablespace_op=FALSE;
/*
Initialize the random generator. We call my_rnd() without a lock as
it's not really critical if two threads modifies the structure at the
same time. We ensure that we have an unique number foreach thread
by adding the address of the stack.
*/
tmp= (ulong) (my_rnd(&sql_rand) * 0xffffffff);
my_rnd_init(&rand, tmp + (ulong)((size_t) &rand), tmp + (ulong) ::global_query_id);
substitute_null_with_insert_id = FALSE;
lock_info.mysql_thd= (void *)this;
@ -1323,6 +1314,17 @@ void THD::init()
/* Set to handle counting of aborted connections */
userstat_running= opt_userstat_running;
last_global_update_time= current_connect_time= time(NULL);
/*
Initialize the random generator. We call my_rnd() without a lock as
it's not really critical if two threads modify the structure at the
same time. We ensure that we have a unique number for each thread
by adding the address of this THD.
*/
ulong tmp= (ulong) (my_rnd(&sql_rand) * 0xffffffff);
my_rnd_init(&rand, tmp + (ulong)(intptr) this,
(ulong)(my_timer_cycles() + global_query_id));
#ifndef EMBEDDED_LIBRARY
session_tracker.enable(this);
#endif //EMBEDDED_LIBRARY

View File

@ -106,6 +106,7 @@ bool LEX::check_dependencies_in_with_clauses()
@param tables Points to the beginning of the sub-chain
@param tables_last Points to the address with the sub-chain barrier
@param excl_spec Ignore the definition with this spec
@details
The method resolves tables references to CTE from the chain of
@ -147,7 +148,8 @@ bool LEX::check_dependencies_in_with_clauses()
*/
bool LEX::resolve_references_to_cte(TABLE_LIST *tables,
TABLE_LIST **tables_last)
TABLE_LIST **tables_last,
st_select_lex_unit *excl_spec)
{
With_element *with_elem= 0;
@ -156,7 +158,8 @@ bool LEX::resolve_references_to_cte(TABLE_LIST *tables,
if (tbl->derived)
continue;
if (!tbl->db.str && !tbl->with)
tbl->with= tbl->select_lex->find_table_def_in_with_clauses(tbl);
tbl->with= tbl->select_lex->find_table_def_in_with_clauses(tbl,
excl_spec);
if (!tbl->with) // no CTE matches table reference tbl
{
if (only_cte_resolution)
@ -244,7 +247,7 @@ LEX::check_cte_dependencies_and_resolve_references()
return true;
if (!with_cte_resolution)
return false;
if (resolve_references_to_cte(query_tables, query_tables_last))
if (resolve_references_to_cte(query_tables, query_tables_last, NULL))
return true;
return false;
}
@ -388,6 +391,7 @@ bool With_element::check_dependencies_in_spec()
@param table The reference to the table that is looked for
@param barrier The barrier with element for the search
@param excl_spec Ignore the definition with this spec
@details
The function looks through the elements of this with clause trying to find
@ -401,12 +405,15 @@ bool With_element::check_dependencies_in_spec()
*/
With_element *With_clause::find_table_def(TABLE_LIST *table,
With_element *barrier)
With_element *barrier,
st_select_lex_unit *excl_spec)
{
for (With_element *with_elem= with_list.first;
with_elem != barrier;
with_elem= with_elem->next)
{
if (excl_spec && with_elem->spec == excl_spec)
continue;
if (my_strcasecmp(system_charset_info, with_elem->get_name_str(),
table->table_name.str) == 0 &&
!table->is_fqtn)
@ -466,7 +473,7 @@ With_element *find_table_def_in_with_clauses(TABLE_LIST *tbl,
top_unit->with_element &&
top_unit->with_element->get_owner() == with_clause)
barrier= top_unit->with_element;
found= with_clause->find_table_def(tbl, barrier);
found= with_clause->find_table_def(tbl, barrier, NULL);
if (found)
break;
}
@ -521,10 +528,11 @@ void With_element::check_dependencies_in_select(st_select_lex *sl,
{
With_clause *with_clause= sl->master_unit()->with_clause;
if (with_clause)
tbl->with= with_clause->find_table_def(tbl, NULL);
tbl->with= with_clause->find_table_def(tbl, NULL, NULL);
if (!tbl->with)
tbl->with= owner->find_table_def(tbl,
owner->with_recursive ? NULL : this);
owner->with_recursive ? NULL : this,
NULL);
}
if (!tbl->with)
tbl->with= find_table_def_in_with_clauses(tbl, ctxt);
@ -1101,7 +1109,8 @@ st_select_lex_unit *With_element::clone_parsed_spec(LEX *old_lex,
*/
lex->only_cte_resolution= old_lex->only_cte_resolution;
if (lex->resolve_references_to_cte(lex->query_tables,
lex->query_tables_last))
lex->query_tables_last,
spec))
{
res= NULL;
goto err;
@ -1304,6 +1313,7 @@ bool With_element::is_anchor(st_select_lex *sel)
Search for the definition of the given table referred in this select node
@param table reference to the table whose definition is searched for
@param excl_spec ignore the definition with this spec
@details
The method looks for the definition of the table whose reference is occurred
@ -1316,7 +1326,8 @@ bool With_element::is_anchor(st_select_lex *sel)
NULL - otherwise
*/
With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table,
st_select_lex_unit *excl_spec)
{
With_element *found= NULL;
With_clause *containing_with_clause= NULL;
@ -1333,7 +1344,7 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
With_clause *attached_with_clause= sl->get_with_clause();
if (attached_with_clause &&
attached_with_clause != containing_with_clause &&
(found= attached_with_clause->find_table_def(table, NULL)))
(found= attached_with_clause->find_table_def(table, NULL, excl_spec)))
break;
master_unit= sl->master_unit();
outer_sl= master_unit->outer_select();
@ -1343,7 +1354,8 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
containing_with_clause= with_elem->get_owner();
With_element *barrier= containing_with_clause->with_recursive ?
NULL : with_elem;
if ((found= containing_with_clause->find_table_def(table, barrier)))
if ((found= containing_with_clause->find_table_def(table, barrier,
excl_spec)))
break;
if (outer_sl && !outer_sl->get_with_element())
break;

View File

@ -325,7 +325,8 @@ public:
friend
bool LEX::resolve_references_to_cte(TABLE_LIST *tables,
TABLE_LIST **tables_last);
TABLE_LIST **tables_last,
st_select_lex_unit *excl_spec);
};
const uint max_number_of_elements_in_with_clause= sizeof(table_map)*8;
@ -425,7 +426,8 @@ public:
void move_anchors_ahead();
With_element *find_table_def(TABLE_LIST *table, With_element *barrier);
With_element *find_table_def(TABLE_LIST *table, With_element *barrier,
st_select_lex_unit *excl_spec);
With_element *find_table_def_in_with_clauses(TABLE_LIST *table);

View File

@ -1560,7 +1560,8 @@ public:
master_unit()->cloned_from->with_element :
master_unit()->with_element;
}
With_element *find_table_def_in_with_clauses(TABLE_LIST *table);
With_element *find_table_def_in_with_clauses(TABLE_LIST *table,
st_select_lex_unit * excl_spec);
bool check_unrestricted_recursive(bool only_standard_compliant);
bool check_subqueries_with_recursive_references();
void collect_grouping_fields_for_derived(THD *thd, ORDER *grouping_list);
@ -4843,7 +4844,8 @@ public:
bool check_dependencies_in_with_clauses();
bool check_cte_dependencies_and_resolve_references();
bool resolve_references_to_cte(TABLE_LIST *tables,
TABLE_LIST **tables_last);
TABLE_LIST **tables_last,
st_select_lex_unit *excl_spec);
};

View File

@ -921,6 +921,7 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
TABLE_LIST *first_table= lex->query_tables;
TABLE *table;
sequence_definition *new_seq= lex->create_info.seq_create_info;
uint saved_used_fields= new_seq->used_fields;
SEQUENCE *seq;
No_such_table_error_handler no_such_table_handler;
DBUG_ENTER("Sql_cmd_alter_sequence::execute");
@ -1042,5 +1043,6 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
my_ok(thd);
end:
new_seq->used_fields= saved_used_fields;
DBUG_RETURN(error);
}

View File

@ -293,7 +293,8 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
for (tbl= sl->get_table_list(); tbl; tbl= tbl->next_local)
{
if (!tbl->with && tbl->select_lex)
tbl->with= tbl->select_lex->find_table_def_in_with_clauses(tbl);
tbl->with= tbl->select_lex->find_table_def_in_with_clauses(tbl,
NULL);
/*
Ensure that we have some privileges on this table, more strict check
will be done on column level after preparation,

View File

@ -1195,8 +1195,8 @@ int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument,
}
int show_tc_active_instances(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
int show_tc_active_instances(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum enum_var_type scope)
{
var->type= SHOW_UINT;
var->value= buff;

View File

@ -87,8 +87,8 @@ extern int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument,
bool no_dups= false);
extern uint tc_records(void);
int show_tc_active_instances(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope);
int show_tc_active_instances(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum enum_var_type scope);
extern void tc_purge();
extern void tc_add_table(THD *thd, TABLE *table);
extern void tc_release_table(TABLE *table);

View File

@ -71,11 +71,6 @@
#include "tabvct.h"
#include "valblk.h"
#if defined(UNIX)
//add dummy strerror (NGC)
char *strerror(int num);
#endif // UNIX
/***********************************************************************/
/* External function. */
/***********************************************************************/

View File

@ -3538,7 +3538,8 @@ CSphSEStats * sphinx_get_stats ( THD * thd, SHOW_VAR * out )
return 0;
}
int sphinx_showfunc_total ( THD * thd, SHOW_VAR * out, char * )
static int sphinx_showfunc_total ( THD * thd, SHOW_VAR * out, void *,
system_status_var *, enum_var_type )
{
CSphSEStats * pStats = sphinx_get_stats ( thd, out );
if ( pStats )
@ -3549,7 +3550,8 @@ int sphinx_showfunc_total ( THD * thd, SHOW_VAR * out, char * )
return 0;
}
int sphinx_showfunc_total_found ( THD * thd, SHOW_VAR * out, char * )
static int sphinx_showfunc_total_found ( THD * thd, SHOW_VAR * out, void *,
system_status_var *, enum_var_type )
{
CSphSEStats * pStats = sphinx_get_stats ( thd, out );
if ( pStats )
@ -3560,7 +3562,8 @@ int sphinx_showfunc_total_found ( THD * thd, SHOW_VAR * out, char * )
return 0;
}
int sphinx_showfunc_time ( THD * thd, SHOW_VAR * out, char * )
static int sphinx_showfunc_time ( THD * thd, SHOW_VAR * out, void *,
system_status_var *, enum_var_type )
{
CSphSEStats * pStats = sphinx_get_stats ( thd, out );
if ( pStats )
@ -3571,7 +3574,8 @@ int sphinx_showfunc_time ( THD * thd, SHOW_VAR * out, char * )
return 0;
}
int sphinx_showfunc_word_count ( THD * thd, SHOW_VAR * out, char * )
static int sphinx_showfunc_word_count ( THD * thd, SHOW_VAR * out, void *,
system_status_var *, enum_var_type )
{
CSphSEStats * pStats = sphinx_get_stats ( thd, out );
if ( pStats )
@ -3582,9 +3586,11 @@ int sphinx_showfunc_word_count ( THD * thd, SHOW_VAR * out, char * )
return 0;
}
int sphinx_showfunc_words ( THD * thd, SHOW_VAR * out, char * sBuffer )
static int sphinx_showfunc_words ( THD * thd, SHOW_VAR * out, void * buf,
system_status_var *, enum_var_type )
{
#if MYSQL_VERSION_ID>50100
char *sBuffer = static_cast<char*>(buf);
if ( sphinx_hton_ptr )
{
CSphTLS * pTls = (CSphTLS *) thd_get_ha_data ( thd, sphinx_hton_ptr );
@ -3639,7 +3645,8 @@ int sphinx_showfunc_words ( THD * thd, SHOW_VAR * out, char * sBuffer )
return 0;
}
int sphinx_showfunc_error ( THD * thd, SHOW_VAR * out, char * )
static int sphinx_showfunc_error ( THD * thd, SHOW_VAR * out, void *,
system_status_var *, enum_var_type )
{
CSphSEStats * pStats = sphinx_get_stats ( thd, out );
out->type = SHOW_CHAR;

View File

@ -164,12 +164,6 @@ private:
bool sphinx_show_status ( THD * thd );
#endif
int sphinx_showfunc_total_found ( THD *, SHOW_VAR *, char * );
int sphinx_showfunc_total ( THD *, SHOW_VAR *, char * );
int sphinx_showfunc_time ( THD *, SHOW_VAR *, char * );
int sphinx_showfunc_word_count ( THD *, SHOW_VAR *, char * );
int sphinx_showfunc_words ( THD *, SHOW_VAR *, char * );
//
// $Id: ha_sphinx.h 4818 2014-09-24 08:53:38Z tomat $
//

View File

@ -6,6 +6,9 @@ for child2
for child3
set @old_spider_bgs_mode= @@spider_bgs_mode;
set session spider_bgs_mode=1;
set spider_same_server_link=1;
set @old_spider_same_server_link=@@global.spider_same_server_link;
set global spider_same_server_link=1;
CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table td (a int, PRIMARY KEY (a));
create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_26151",TABLE "td", casual_read "3"';
@ -26,6 +29,7 @@ min(a)
drop table td, ts;
drop server srv_mdev_26151;
set session spider_bgs_mode=@old_spider_bgs_mode;
set global spider_same_server_link=@old_spider_same_server_link;
for master_1
for child2
for child3

View File

@ -5,6 +5,7 @@ for master_1
for child2
for child3
set global query_cache_type= on;
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (c int);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
# testing monitoring_*

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t1 (c int);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (a INT);
INSERT INTO t VALUES (23),(48);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (a INT) ENGINE=Spider;

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t1 (c int);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (c BLOB) ENGINE=InnoDB;
CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';

View File

@ -5,6 +5,7 @@ for master_1
for child2
for child3
SET @old_spider_read_only_mode = @@session.spider_read_only_mode;
set spider_same_server_link=1;
CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
set session spider_read_only_mode = default;
create table t2 (c int);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a));
CREATE TABLE t2 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)) ENGINE=SPIDER COMMENT='srv "srv", WRAPPER "mysql", TABLE "t1"';

View File

@ -1,6 +1,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
set session spider_delete_all_rows_type=0;

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (c varchar(16));

View File

@ -0,0 +1,25 @@
for master_1
for child2
for child3
set spider_same_server_link=on;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
);
create table t1 ENGINE=Spider
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'
drop table t1, t2;
drop server srv;
for master_1
for child2
for child3

View File

@ -4,6 +4,9 @@ for child3
MDEV-6268 SPIDER table with no COMMENT clause causes queries to wait forever
set spider_same_server_link=1;
set @old_spider_same_server_link=@@global.spider_same_server_link;
set global spider_same_server_link=1;
CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (c int);
create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_self_reference_multi",TABLE "t2"';
@ -17,6 +20,7 @@ select * from t2;
ERROR HY000: An infinite loop is detected when opening table test.t0
drop table t0, t1, t2;
drop server srv_self_reference_multi;
set global spider_same_server_link=@old_spider_same_server_link;
for master_1
for child2
for child3

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t1 (c int);
create table t2 (d int);

View File

@ -4,6 +4,7 @@
for master_1
for child2
for child3
set spider_same_server_link=1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t1 (c1 int);
create table t2 (c2 int);

View File

@ -14,6 +14,10 @@
--let $srv=srv_mdev_26151
set @old_spider_bgs_mode= @@spider_bgs_mode;
set session spider_bgs_mode=1;
set spider_same_server_link=1;
set @old_spider_same_server_link=@@global.spider_same_server_link;
set global spider_same_server_link=1;
evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
# casual_read != 0 && casual_read != 1
@ -42,6 +46,7 @@ drop table td, ts;
eval drop server $srv;
set session spider_bgs_mode=@old_spider_bgs_mode;
set global spider_same_server_link=@old_spider_same_server_link;
--disable_query_log
--disable_result_log

View File

@ -12,6 +12,7 @@
#set @@global.debug_dbug="d:t:i:o,mysqld.trace";
set global query_cache_type= on;
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (c int);

View File

@ -9,6 +9,7 @@
# This test covers some table params under consideration for inclusion
# in the engine-defined options to be implemented in MDEV-28856.
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');

View File

@ -12,6 +12,7 @@ if (`select not(count(*)) from information_schema.system_variables where variabl
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);

View File

@ -6,6 +6,7 @@
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);

View File

@ -8,6 +8,7 @@
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');

View File

@ -8,6 +8,7 @@
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
--let $srv=srv_mdev_29502
evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');

View File

@ -7,6 +7,7 @@
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');

View File

@ -7,6 +7,7 @@
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');

View File

@ -6,6 +6,7 @@
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);

View File

@ -9,6 +9,7 @@
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (c BLOB) ENGINE=InnoDB;
CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';

View File

@ -10,6 +10,7 @@
--let $srv=srv_mdev_31524
SET @old_spider_read_only_mode = @@session.spider_read_only_mode;
set spider_same_server_link=1;
evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
# when the user does not set var nor the table option, the default

View File

@ -6,6 +6,7 @@
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a));

View File

@ -4,6 +4,7 @@
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');

View File

@ -6,6 +6,7 @@
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');

View File

@ -0,0 +1,24 @@
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link=on;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
);
create table t1 ENGINE=Spider
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
show create table t1;
drop table t1, t2;
drop server srv;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log

View File

@ -8,6 +8,9 @@
--echo MDEV-6268 SPIDER table with no COMMENT clause causes queries to wait forever
--echo
set spider_same_server_link=1;
set @old_spider_same_server_link=@@global.spider_same_server_link;
set global spider_same_server_link=1;
--let $srv=srv_self_reference_multi
evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (c int);
@ -22,6 +25,7 @@ select * from t1;
select * from t2;
drop table t0, t1, t2;
eval drop server $srv;
set global spider_same_server_link=@old_spider_same_server_link;
--disable_query_log
--disable_result_log

View File

@ -8,6 +8,7 @@
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t1 (c int);
create table t2 (d int);

View File

@ -6,6 +6,7 @@
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t1 (c1 int);
create table t2 (c2 int);

View File

@ -1579,10 +1579,13 @@ int spider_db_mbase_result::fetch_index_for_discover_table_structure(
}
DBUG_RETURN(0);
}
if (num_fields() != 13)
if (num_fields() < 13)
{
DBUG_PRINT("info",("spider num_fields != 13"));
my_printf_error(ER_SPIDER_UNKNOWN_NUM, ER_SPIDER_UNKNOWN_STR, MYF(0));
DBUG_PRINT("info",("spider num_fields < 13"));
my_printf_error(ER_SPIDER_CANT_NUM, ER_SPIDER_CANT_STR1, MYF(0),
"fetch index for table structure discovery because of "
"wrong number of columns in SHOW INDEX FROM output: ",
num_fields());
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
}
bool first = TRUE;
@ -1995,7 +1998,7 @@ int spider_db_mbase::connect(
if (!spider_param_same_server_link(thd))
{
if (!strcmp(tgt_host, my_localhost))
if (!strcmp(tgt_host, my_localhost) || !tgt_host || !tgt_host[0])
{
if (!strcmp(tgt_socket, *spd_mysqld_unix_port))
{
@ -2005,7 +2008,7 @@ int spider_db_mbase::connect(
DBUG_RETURN(ER_SPIDER_SAME_SERVER_LINK_NUM);
}
} else if (!strcmp(tgt_host, "127.0.0.1") ||
!strcmp(tgt_host, glob_hostname))
!strcmp(tgt_host, glob_hostname) || !tgt_host || !tgt_host[0])
{
if (tgt_port == (long) *spd_mysqld_port)
{

View File

@ -117,7 +117,8 @@ extern volatile ulonglong spider_mon_table_cache_version_req;
}
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
static int spider_direct_update(THD *thd, SHOW_VAR *var, char *buff)
static int spider_direct_update(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
int error_num = 0;
SPIDER_TRX *trx;
@ -128,7 +129,8 @@ static int spider_direct_update(THD *thd, SHOW_VAR *var, char *buff)
DBUG_RETURN(error_num);
}
static int spider_direct_delete(THD *thd, SHOW_VAR *var, char *buff)
static int spider_direct_delete(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
int error_num = 0;
SPIDER_TRX *trx;
@ -140,7 +142,8 @@ static int spider_direct_delete(THD *thd, SHOW_VAR *var, char *buff)
}
#endif
static int spider_direct_order_limit(THD *thd, SHOW_VAR *var, char *buff)
static int spider_direct_order_limit(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
int error_num = 0;
SPIDER_TRX *trx;
@ -151,7 +154,8 @@ static int spider_direct_order_limit(THD *thd, SHOW_VAR *var, char *buff)
DBUG_RETURN(error_num);
}
static int spider_direct_aggregate(THD *thd, SHOW_VAR *var, char *buff)
static int spider_direct_aggregate(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
int error_num = 0;
SPIDER_TRX *trx;
@ -162,7 +166,8 @@ static int spider_direct_aggregate(THD *thd, SHOW_VAR *var, char *buff)
DBUG_RETURN(error_num);
}
static int spider_parallel_search(THD *thd, SHOW_VAR *var, char *buff)
static int spider_parallel_search(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
int error_num = 0;
SPIDER_TRX *trx;
@ -174,7 +179,8 @@ static int spider_parallel_search(THD *thd, SHOW_VAR *var, char *buff)
}
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
static int spider_hs_result_free(THD *thd, SHOW_VAR *var, char *buff)
static int spider_hs_result_free(THD *thd, SHOW_VAR *var, void *,
system_status_var *, enum_var_type)
{
int error_num = 0;
SPIDER_TRX *trx;