Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2743a510
Commit
2743a510
authored
Feb 06, 2023
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.3' into bb-10.3-release
parents
c73985f2
9b32e4b1
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
313 additions
and
122 deletions
+313
-122
debian/control
debian/control
+1
-0
mysql-test/lib/My/CoreDump.pm
mysql-test/lib/My/CoreDump.pm
+3
-30
mysql-test/main/derived.result
mysql-test/main/derived.result
+23
-0
mysql-test/main/derived.test
mysql-test/main/derived.test
+30
-0
mysql-test/main/parser.result
mysql-test/main/parser.result
+24
-4
mysql-test/main/parser.test
mysql-test/main/parser.test
+15
-2
sql/sql_derived.cc
sql/sql_derived.cc
+3
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+39
-15
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+39
-15
storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result
storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result
+41
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf
storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf
+3
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test
storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test
+56
-0
storage/spider/spd_db_mysql.cc
storage/spider/spd_db_mysql.cc
+35
-53
storage/spider/spd_db_mysql.h
storage/spider/spd_db_mysql.h
+1
-3
No files found.
debian/control
View file @
2743a510
...
...
@@ -525,6 +525,7 @@ Depends: libxml2,
unixodbc
,
${
misc
:
Depends
},
${
shlibs
:
Depends
}
Recommends
:
curl
Breaks
:
mariadb
-
connect
-
engine
-
10.1
,
mariadb
-
connect
-
engine
-
10.2
,
mariadb
-
connect
-
engine
-
10.3
...
...
mysql-test/lib/My/CoreDump.pm
View file @
2743a510
...
...
@@ -310,16 +310,8 @@ sub cdb_check {
`
cdb -? 2>&1
`;
if
(
$?
>>
8
)
{
print
"
Cannot find cdb. Please Install Debugging tools for Windows
\n
";
print
"
from http://www.microsoft.com/whdc/devtools/debugging/
";
if
(
$ENV
{'
ProgramW6432
'})
{
print
"
install64bit.mspx (native x64 version)
\n
";
}
else
{
print
"
installx86.mspx
\n
";
}
print
"
Cannot find the cdb debugger. Please install Debugging tools for Windows
\n
";
print
"
and set PATH environment variable to include location of cdb.exe
";
}
}
...
...
@@ -328,25 +320,6 @@ sub _cdb {
my
(
$core_name
,
$format
)
=
@_
;
print
"
\n
Trying 'cdb' to get a backtrace
\n
";
return
unless
-
f
$core_name
;
# Try to set environment for debugging tools for Windows
if
(
$ENV
{'
PATH
'}
!~
/Debugging Tools/
)
{
if
(
$ENV
{'
ProgramW6432
'})
{
# On x64 computer
$ENV
{'
PATH
'}
.=
"
;
"
.
$ENV
{'
ProgramW6432
'}
.
"
\\
Debugging Tools For Windows (x64)
";
}
else
{
# On x86 computer. Newest versions of Debugging tools are installed in the
# directory with (x86) suffix, older versions did not have this suffix.
$ENV
{'
PATH
'}
.=
"
;
"
.
$ENV
{'
ProgramFiles
'}
.
"
\\
Debugging Tools For Windows (x86)
";
$ENV
{'
PATH
'}
.=
"
;
"
.
$ENV
{'
ProgramFiles
'}
.
"
\\
Debugging Tools For Windows
";
}
}
# Read module list, find out the name of executable and
# build symbol path (required by cdb if executable was built on
# different machine)
...
...
@@ -384,7 +357,7 @@ sub _cdb {
if (!$ENV{
'
_NT_SYMBOL_PATH
'
})
{
my $windir= $ENV{
'
windir
'
};
my $symbol_cache= substr($windir ,0, index($windir,
'
\\
'
))."
\\
cdb_
symbols";
my $symbol_cache= substr($windir ,0, index($windir,
'
\\
'
))."
\\
symbols";
print "OS debug symbols will be downloaded and stored in $symbol_cache.
\
n";
print "You can control the location of symbol cache with _NT_SYMBOL_PATH
\
n";
...
...
mysql-test/main/derived.result
View file @
2743a510
...
...
@@ -1327,5 +1327,28 @@ a b
DROP VIEW v1;
DROP TABLE t1;
#
# MDEV-28616: derived table over union with order by clause that
# contains subquery with unresolvable column reference
#
SELECT 1 FROM (
SELECT 1 UNION SELECT 2 ORDER BY (SELECT 1 FROM DUAL WHERE xxx = 0)
) dt;
ERROR 42S22: Unknown column 'xxx' in 'where clause'
create table t1 (a int, b int);
insert into t1 values (3,8), (7,2), (1,4), (5,9);
create table t2 (a int, b int);
insert into t2 values (9,1), (7,3), (2,6);
create table t3 (c int, d int);
insert into t3 values (7,8), (1,2), (3,8);
select * from
(
select a,b from t1 where t1.a > 3
union
select a,b from t2 where t2.b < 6
order by (a - b / (select a + max(c) from t3 where d = x))
) dt;
ERROR 42S22: Unknown column 'x' in 'where clause'
drop table t1,t2,t3;
#
# End of 10.3 tests
#
mysql-test/main/derived.test
View file @
2743a510
...
...
@@ -1137,6 +1137,36 @@ SELECT * FROM v1 WHERE b > 0;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-28616: derived table over union with order by clause that
--
echo
# contains subquery with unresolvable column reference
--
echo
#
--
error
ER_BAD_FIELD_ERROR
SELECT
1
FROM
(
SELECT
1
UNION
SELECT
2
ORDER
BY
(
SELECT
1
FROM
DUAL
WHERE
xxx
=
0
)
)
dt
;
create
table
t1
(
a
int
,
b
int
);
insert
into
t1
values
(
3
,
8
),
(
7
,
2
),
(
1
,
4
),
(
5
,
9
);
create
table
t2
(
a
int
,
b
int
);
insert
into
t2
values
(
9
,
1
),
(
7
,
3
),
(
2
,
6
);
create
table
t3
(
c
int
,
d
int
);
insert
into
t3
values
(
7
,
8
),
(
1
,
2
),
(
3
,
8
);
--
error
ER_BAD_FIELD_ERROR
select
*
from
(
select
a
,
b
from
t1
where
t1
.
a
>
3
union
select
a
,
b
from
t2
where
t2
.
b
<
6
order
by
(
a
-
b
/
(
select
a
+
max
(
c
)
from
t3
where
d
=
x
))
)
dt
;
drop
table
t1
,
t2
,
t3
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
mysql-test/main/parser.result
View file @
2743a510
...
...
@@ -1869,12 +1869,32 @@ SET @@sql_mode=@save_sql_mode;
#
# MDEV-30151 parse error 1=2 not between/in
#
select 1=2 not in
(3,4);
1=2
not in
(3,4)
SELECT 1=2 NOT IN
(3,4);
1=2
NOT IN
(3,4)
1
select 1=2 not between 3 and
4;
1=2
not between 3 and
4
SELECT 1=2 NOT BETWEEN 3 AND
4;
1=2
NOT BETWEEN 3 AND
4
1
CREATE TABLE t1 ( f INT AS ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) );
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f` int(11) GENERATED ALWAYS AS (1 = 2 not between 3 and 4) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1 ( f INT, CHECK ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) );
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (1 = 2 not between 3 and 4)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE VIEW v1 AS SELECT 1 IN ( 2 NOT BETWEEN 3 AND 4 );
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 1 = 2 not between 3 and 4 AS `1 IN ( 2 NOT BETWEEN 3 AND 4 )` latin1 latin1_swedish_ci
DROP VIEW v1;
#
# End of 10.3 tests
#
mysql-test/main/parser.test
View file @
2743a510
...
...
@@ -1676,8 +1676,21 @@ SET @@sql_mode=@save_sql_mode;
--
echo
#
--
echo
# MDEV-30151 parse error 1=2 not between/in
--
echo
#
select
1
=
2
not
in
(
3
,
4
);
select
1
=
2
not
between
3
and
4
;
SELECT
1
=
2
NOT
IN
(
3
,
4
);
SELECT
1
=
2
NOT
BETWEEN
3
AND
4
;
CREATE
TABLE
t1
(
f
INT
AS
(
1
IN
(
2
NOT
BETWEEN
3
AND
4
)
)
);
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
f
INT
,
CHECK
(
1
IN
(
2
NOT
BETWEEN
3
AND
4
)
)
);
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
VIEW
v1
AS
SELECT
1
IN
(
2
NOT
BETWEEN
3
AND
4
);
SHOW
CREATE
VIEW
v1
;
DROP
VIEW
v1
;
--
echo
#
--
echo
# End of 10.3 tests
...
...
sql/sql_derived.cc
View file @
2743a510
...
...
@@ -771,6 +771,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
cursor
->
outer_join
|=
JOIN_TYPE_OUTER
;
}
}
// Prevent it for possible ORDER BY clause
if
(
unit
->
fake_select_lex
)
unit
->
fake_select_lex
->
context
.
outer_context
=
0
;
/*
Above cascade call of prepare is important for PS protocol, but after it
...
...
sql/sql_yacc.yy
View file @
2743a510
...
...
@@ -899,7 +899,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
/*
We should not introduce any further shift/reduce conflicts.
*/
%expect
96
%expect
78
/*
Comments for TOKENS.
...
...
@@ -1687,7 +1687,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left PREC_BELOW_NOT
%nonassoc LOW_PRIORITY_NOT
/* The precendence of boolean NOT is in fact here. See the comment below. */
%left '=' EQUAL_SYM GE '>' LE '<' NE
%nonassoc IS
%right BETWEEN_SYM
...
...
@@ -1699,6 +1700,24 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left '*' '/' '%' DIV_SYM MOD_SYM
%left '^'
%left MYSQL_CONCAT_SYM
/*
Boolean negation has a special branch in "expr" starting with NOT_SYM.
The precedence of logical negation is determined by the grammar itself
(without using Bison terminal symbol precedence) in this order
- Boolean factor (i.e. logical AND)
- Boolean NOT
- Boolean test (such as '=', IS NULL, IS TRUE)
But we also need a precedence for NOT_SYM in other contexts,
to shift (without reduce) in these cases:
predicate <here> NOT IN ...
predicate <here> NOT BETWEEN ...
predicate <here> NOT LIKE ...
predicate <here> NOT REGEXP ...
If the precedence of NOT_SYM was low, it would reduce immediately
after scanning "predicate" and then produce a syntax error on "NOT".
*/
%nonassoc NOT_SYM
%nonassoc NEG '~' NOT2_SYM BINARY
%nonassoc COLLATE_SYM
...
...
@@ -1938,6 +1957,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
literal insert_ident order_ident temporal_literal
simple_ident expr sum_expr in_sum_expr
variable variable_aux
boolean_test
predicate bit_expr parenthesized_expr
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
primary_expr string_factor_expr mysql_concatenation_expr
...
...
@@ -9840,79 +9860,83 @@ expr:
MYSQL_YYABORT;
}
}
| NOT_SYM expr
%prec LOW_PRIORITY_NOT
| NOT_SYM expr
{
$$= negate_expression(thd, $2);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| expr IS TRUE_SYM %prec IS
| boolean_test %prec PREC_BELOW_NOT
;
boolean_test:
boolean_test IS TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_istrue(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not TRUE_SYM %prec IS
|
boolean_test
IS not TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnottrue(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS FALSE_SYM %prec IS
|
boolean_test
IS FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isfalse(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not FALSE_SYM %prec IS
|
boolean_test
IS not FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotfalse(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS UNKNOWN_SYM %prec IS
|
boolean_test
IS UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not UNKNOWN_SYM %prec IS
|
boolean_test
IS not UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr IS NULL_SYM %prec PREC_BELOW_NOT
|
boolean_test IS NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not NULL_SYM %prec IS
|
boolean_test
IS not NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
EQUAL_SYM predicate %prec EQUAL_SYM
|
boolean_test
EQUAL_SYM predicate %prec EQUAL_SYM
{
$$= new (thd->mem_root) Item_func_equal(thd, $1, $3);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
comp_op predicate %prec '='
|
boolean_test
comp_op predicate %prec '='
{
$$= (*$2)(0)->create(thd, $1, $3);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
comp_op all_or_any '(' subselect ')' %prec '='
|
boolean_test
comp_op all_or_any '(' subselect ')' %prec '='
{
$$= all_any_subquery_creator(thd, $1, $2, $3, $5);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| predicate
| predicate
%prec BETWEEN_SYM
;
predicate:
...
...
sql/sql_yacc_ora.yy
View file @
2743a510
...
...
@@ -293,7 +293,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
/*
We should not introduce any further shift/reduce conflicts.
*/
%expect
98
%expect
80
/*
Comments for TOKENS.
...
...
@@ -1081,7 +1081,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left PREC_BELOW_NOT
%nonassoc LOW_PRIORITY_NOT
/* The precendence of boolean NOT is in fact here. See the comment below. */
%left '=' EQUAL_SYM GE '>' LE '<' NE
%nonassoc IS
%right BETWEEN_SYM
...
...
@@ -1093,6 +1094,24 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left '*' '/' '%' DIV_SYM MOD_SYM
%left '^'
%left MYSQL_CONCAT_SYM
/*
Boolean negation has a special branch in "expr" starting with NOT_SYM.
The precedence of logical negation is determined by the grammar itself
(without using Bison terminal symbol precedence) in this order
- Boolean factor (i.e. logical AND)
- Boolean NOT
- Boolean test (such as '=', IS NULL, IS TRUE)
But we also need a precedence for NOT_SYM in other contexts,
to shift (without reduce) in these cases:
predicate <here> NOT IN ...
predicate <here> NOT BETWEEN ...
predicate <here> NOT LIKE ...
predicate <here> NOT REGEXP ...
If the precedence of NOT_SYM was low, it would reduce immediately
after scanning "predicate" and then produce a syntax error on "NOT".
*/
%nonassoc NOT_SYM
%nonassoc NEG '~' NOT2_SYM BINARY
%nonassoc COLLATE_SYM
...
...
@@ -1339,6 +1358,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
literal insert_ident order_ident temporal_literal
simple_ident expr sum_expr in_sum_expr
variable variable_aux
boolean_test
predicate bit_expr parenthesized_expr
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
primary_expr string_factor_expr mysql_concatenation_expr
...
...
@@ -9797,79 +9817,83 @@ expr:
MYSQL_YYABORT;
}
}
| NOT_SYM expr
%prec LOW_PRIORITY_NOT
| NOT_SYM expr
{
$$= negate_expression(thd, $2);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| expr IS TRUE_SYM %prec IS
| boolean_test %prec PREC_BELOW_NOT
;
boolean_test:
boolean_test IS TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_istrue(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not TRUE_SYM %prec IS
|
boolean_test
IS not TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnottrue(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS FALSE_SYM %prec IS
|
boolean_test
IS FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isfalse(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not FALSE_SYM %prec IS
|
boolean_test
IS not FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotfalse(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS UNKNOWN_SYM %prec IS
|
boolean_test
IS UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not UNKNOWN_SYM %prec IS
|
boolean_test
IS not UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr IS NULL_SYM %prec PREC_BELOW_NOT
|
boolean_test IS NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
IS not NULL_SYM %prec IS
|
boolean_test
IS not NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
EQUAL_SYM predicate %prec EQUAL_SYM
|
boolean_test
EQUAL_SYM predicate %prec EQUAL_SYM
{
$$= new (thd->mem_root) Item_func_equal(thd, $1, $3);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
comp_op predicate %prec '='
|
boolean_test
comp_op predicate %prec '='
{
$$= (*$2)(0)->create(thd, $1, $3);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
expr
comp_op all_or_any '(' subselect ')' %prec '='
|
boolean_test
comp_op all_or_any '(' subselect ')' %prec '='
{
$$= all_any_subquery_creator(thd, $1, $2, $3, $5);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| predicate
| predicate
%prec BETWEEN_SYM
;
predicate:
...
...
storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result
0 → 100644
View file @
2743a510
#
# MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings()
#
for master_1
for child2
child2_1
child2_2
child2_3
for child3
connection child2_1;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
CREATE TABLE tbl_a (
a CHAR(5)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET GLOBAL sql_mode='';
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
CREATE TABLE tbl_a (
a CHAR(255)
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
SET sql_mode='';
INSERT INTO tbl_a VALUES ("this will be truncated");
NOT FOUND /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err
SET GLOBAL spider_log_result_errors=4;
INSERT INTO tbl_a VALUES ("this will be truncated");
FOUND 1 /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err
connection master_1;
SET GLOBAL spider_log_result_errors=DEFAULT;
SET sql_mode=DEFAULT;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
SET GLOBAL sql_mode=DEFAULT;
DROP DATABASE IF EXISTS auto_test_remote;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf
0 → 100644
View file @
2743a510
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test
0 → 100644
View file @
2743a510
--
echo
#
--
echo
# MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings()
--
echo
#
# The test case below does not cause the potential null pointer dereference.
# It is just for checking spider_db_mbase::fetch_and_print_warnings() works.
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
--
connection
child2_1
CREATE
DATABASE
auto_test_remote
;
USE
auto_test_remote
;
eval
CREATE
TABLE
tbl_a
(
a
CHAR
(
5
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
SET
GLOBAL
sql_mode
=
''
;
--
connection
master_1
CREATE
DATABASE
auto_test_local
;
USE
auto_test_local
;
eval
CREATE
TABLE
tbl_a
(
a
CHAR
(
255
)
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
COMMENT
=
'table "tbl_a", srv "s_2_1"'
;
SET
sql_mode
=
''
;
let
SEARCH_FILE
=
$MYSQLTEST_VARDIR
/
log
/
mysqld
.
1.1
.
err
;
let
SEARCH_PATTERN
=
\
[
WARN
SPIDER
RESULT
\
]
.*
Warning
1265
Data
truncated
for
column
'a'
at
row
1.
*
;
INSERT
INTO
tbl_a
VALUES
(
"this will be truncated"
);
--
source
include
/
search_pattern_in_file
.
inc
# should not find
SET
GLOBAL
spider_log_result_errors
=
4
;
INSERT
INTO
tbl_a
VALUES
(
"this will be truncated"
);
--
source
include
/
search_pattern_in_file
.
inc
# should find
--
connection
master_1
SET
GLOBAL
spider_log_result_errors
=
DEFAULT
;
SET
sql_mode
=
DEFAULT
;
DROP
DATABASE
IF
EXISTS
auto_test_local
;
--
connection
child2_1
SET
GLOBAL
sql_mode
=
DEFAULT
;
DROP
DATABASE
IF
EXISTS
auto_test_remote
;
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_deinit
.
inc
--
enable_query_log
--
enable_result_log
storage/spider/spd_db_mysql.cc
View file @
2743a510
...
...
@@ -2090,7 +2090,7 @@ int spider_db_mbase::exec_query(
db_conn
->
affected_rows
,
db_conn
->
insert_id
,
db_conn
->
server_status
,
db_conn
->
warning_count
);
if
(
spider_param_log_result_errors
()
>=
3
)
print_warnings
(
l_time
);
fetch_and_
print_warnings
(
l_time
);
}
else
if
(
log_result_errors
>=
4
)
{
time_t
cur_time
=
(
time_t
)
time
((
time_t
*
)
0
);
...
...
@@ -2172,61 +2172,43 @@ bool spider_db_mbase::is_xa_nota_error(
DBUG_RETURN
(
xa_nota
);
}
void
spider_db_mbase
::
print_warnings
(
struct
tm
*
l_time
)
{
DBUG_ENTER
(
"spider_db_mbase::print_warnings"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
if
(
db_conn
->
status
==
MYSQL_STATUS_READY
)
void
spider_db_mbase
::
fetch_and_print_warnings
(
struct
tm
*
l_time
)
{
DBUG_ENTER
(
"spider_db_mbase::fetch_and_print_warnings"
);
if
(
spider_param_dry_access
()
||
db_conn
->
status
!=
MYSQL_STATUS_READY
||
db_conn
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
)
DBUG_VOID_RETURN
;
if
(
mysql_real_query
(
db_conn
,
SPIDER_SQL_SHOW_WARNINGS_STR
,
SPIDER_SQL_SHOW_WARNINGS_LEN
))
DBUG_VOID_RETURN
;
MYSQL_RES
*
res
=
mysql_store_result
(
db_conn
);
if
(
!
res
)
DBUG_VOID_RETURN
;
uint
num_fields
=
mysql_num_fields
(
res
);
if
(
num_fields
!=
3
)
{
#if MYSQL_VERSION_ID < 50500
if
(
!
(
db_conn
->
last_used_con
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
))
#else
if
(
!
(
db_conn
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
))
#endif
{
if
(
spider_param_dry_access
()
||
!
mysql_real_query
(
db_conn
,
SPIDER_SQL_SHOW_WARNINGS_STR
,
SPIDER_SQL_SHOW_WARNINGS_LEN
)
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
=
NULL
;
uint
num_fields
;
if
(
spider_param_dry_access
()
||
!
(
res
=
mysql_store_result
(
db_conn
))
||
!
(
row
=
mysql_fetch_row
(
res
))
)
{
if
(
mysql_errno
(
db_conn
))
{
if
(
res
)
mysql_free_result
(
res
);
DBUG_VOID_RETURN
;
}
/* no record is ok */
}
num_fields
=
mysql_num_fields
(
res
);
if
(
num_fields
!=
3
)
{
mysql_free_result
(
res
);
DBUG_VOID_RETURN
;
}
while
(
row
)
{
fprintf
(
stderr
,
"%04d%02d%02d %02d:%02d:%02d [WARN SPIDER RESULT] "
"from [%s] %ld to %ld: %s %s %s
\n
"
,
mysql_free_result
(
res
);
DBUG_VOID_RETURN
;
}
MYSQL_ROW
row
=
mysql_fetch_row
(
res
);
while
(
row
)
{
fprintf
(
stderr
,
"%04d%02d%02d %02d:%02d:%02d [WARN SPIDER RESULT] from [%s] %ld "
"to %ld: %s %s %s
\n
"
,
l_time
->
tm_year
+
1900
,
l_time
->
tm_mon
+
1
,
l_time
->
tm_mday
,
l_time
->
tm_hour
,
l_time
->
tm_min
,
l_time
->
tm_sec
,
conn
->
tgt_host
,
(
ulong
)
db_conn
->
thread_id
,
(
ulong
)
current_thd
->
thread_id
,
row
[
0
],
row
[
1
],
row
[
2
]);
row
=
mysql_fetch_row
(
res
);
}
if
(
res
)
mysql_free_result
(
res
);
}
}
l_time
->
tm_hour
,
l_time
->
tm_min
,
l_time
->
tm_sec
,
conn
->
tgt_host
,
(
ulong
)
db_conn
->
thread_id
,
(
ulong
)
current_thd
->
thread_id
,
row
[
0
],
row
[
1
],
row
[
2
]);
row
=
mysql_fetch_row
(
res
);
}
mysql_free_result
(
res
);
DBUG_VOID_RETURN
;
}
...
...
storage/spider/spd_db_mysql.h
View file @
2743a510
...
...
@@ -392,9 +392,7 @@ class spider_db_mbase: public spider_db_conn
bool
is_xa_nota_error
(
int
error_num
);
void
print_warnings
(
struct
tm
*
l_time
);
void
fetch_and_print_warnings
(
struct
tm
*
l_time
);
spider_db_result
*
store_result
(
spider_db_result_buffer
**
spider_res_buf
,
st_spider_db_request_key
*
request_key
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment