Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2021-10-13 11:38:21 +03:00
commit 4a7dfda373
36 changed files with 358 additions and 51 deletions

2
.gitignore vendored
View File

@ -340,6 +340,7 @@ x86/
build/ build/
bld/ bld/
[Bb]in/ [Bb]in/
/cmake-build-debug/
[Oo]bj/ [Oo]bj/
# Roslyn cache directories # Roslyn cache directories
@ -521,4 +522,5 @@ compile_commands.json
# Visual Studio Code workspace # Visual Studio Code workspace
.vscode/ .vscode/
/.idea/
.cache/clangd .cache/clangd

View File

@ -1683,11 +1683,14 @@ static struct my_option my_long_options[] =
&opt_default_auth, &opt_default_auth, 0, &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binary-mode", 0, {"binary-mode", 0,
"By default, ASCII '\\0' is disallowed and '\\r\\n' is translated to '\\n'. " "Binary mode allows certain character sequences to be processed as data "
"This switch turns off both features, and also turns off parsing of all client" "that would otherwise be treated with a special meaning by the parser. "
"commands except \\C and DELIMITER, in non-interactive mode (for input " "Specifically, this switch turns off parsing of all client commands except "
"piped to mysql or loaded using the 'source' command). This is necessary " "\\C and DELIMITER in non-interactive mode (i.e., when binary mode is "
"when processing output from mysqlbinlog that may contain blobs.", "combined with either 1) piped input, 2) the --batch mysql option, or 3) "
"the 'source' command). Also, in binary mode, occurrences of '\\r\\n' and "
"ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is "
"translated to '\\n' and '\\0' is disallowed in user input.",
&opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };

View File

@ -90,7 +90,8 @@ void ft_free_stopwords(void);
FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t, FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t,
CHARSET_INFO *, uchar *); CHARSET_INFO *, uchar *);
my_bool ft_boolean_check_syntax_string(const uchar *); my_bool ft_boolean_check_syntax_string(const uchar *, size_t length,
CHARSET_INFO *cs);
/* Internal symbols for fulltext between maria and MyISAM */ /* Internal symbols for fulltext between maria and MyISAM */

View File

@ -52,6 +52,9 @@ struct my_context {
#ifdef MY_CONTEXT_USE_UCONTEXT #ifdef MY_CONTEXT_USE_UCONTEXT
#if defined(__APPLE__) && !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE
#endif
#include <ucontext.h> #include <ucontext.h>
struct my_context { struct my_context {

View File

@ -164,7 +164,7 @@
# if defined(__i386__) || defined(__ppc__) # if defined(__i386__) || defined(__ppc__)
# define SIZEOF_CHARP 4 # define SIZEOF_CHARP 4
# define SIZEOF_LONG 4 # define SIZEOF_LONG 4
# elif defined(__x86_64__) || defined(__ppc64__) # elif defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__)
# define SIZEOF_CHARP 8 # define SIZEOF_CHARP 8
# define SIZEOF_LONG 8 # define SIZEOF_LONG 8
# else # else

View File

@ -206,7 +206,14 @@ option\&.
.\" binary-mode option: mysql .\" binary-mode option: mysql
\fB\-\-binary\-mode\fR \fB\-\-binary\-mode\fR
.sp .sp
By default, ASCII '\e0' is disallowed and '\er\en' is translated to '\en'\&. This switch turns off both features, and also turns off parsing of all client commands except \eC and DELIMITER, in non-interactive mode (for input piped to mysql or loaded using the 'source' command)\&. This is necessary when processing output from mysqlbinlog that may contain blobs\&. Binary mode allows certain character sequences to be processed as data that
would otherwise be treated with a special meaning by the parser\&.
Specifically, this switch turns off parsing of all client commands except \eC
and DELIMITER in non-interactive mode (i\&.e\&., when binary mode is combined
with either 1) piped input, 2) the --batch mysql option, or 3) the 'source'
command)\&. Also, in binary mode, occurrences of '\er\en' and ASCII '\e0' are
preserved within strings, whereas by default, '\er\en' is translated to '\en'
and '\e0' is disallowed in user input\&.
.RE .RE
.sp .sp
.RS 4 .RS 4

View File

@ -8,3 +8,8 @@ character_set_server utf16
SHOW VARIABLES LIKE 'ft_stopword_file'; SHOW VARIABLES LIKE 'ft_stopword_file';
Variable_name Value Variable_name Value
ft_stopword_file (built-in) ft_stopword_file (built-in)
#
# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
#
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;

View File

@ -7,3 +7,10 @@ call mtr.add_suppression("'utf16' can not be used as client character set");
SHOW VARIABLES LIKE 'collation_server'; SHOW VARIABLES LIKE 'collation_server';
SHOW VARIABLES LIKE 'character_set_server'; SHOW VARIABLES LIKE 'character_set_server';
SHOW VARIABLES LIKE 'ft_stopword_file'; SHOW VARIABLES LIKE 'ft_stopword_file';
--echo #
--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
--echo #
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;

View File

@ -0,0 +1 @@
--character-set-server=utf32,latin1 --collation-server=utf32_general_ci

View File

@ -0,0 +1,6 @@
call mtr.add_suppression("'utf32' can not be used as client character set");
#
# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
#
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;

View File

@ -0,0 +1,9 @@
--source include/have_utf32.inc
call mtr.add_suppression("'utf32' can not be used as client character set");
--echo #
--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
--echo #
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;

View File

@ -3389,6 +3389,14 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`; ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT' ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-18278 Misleading error message in error log upon failed table creation
#
create table t1 (a int as (a));
ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
show warnings;
Level Code Message
Error 4029 Expression for field `a` is referring to uninitialized field `a`
# end of 10.2 test # end of 10.2 test
# #
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default # MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
@ -3405,3 +3413,4 @@ length(DEFAULT(h))
25 25
INSERT INTO t1 () VALUES (); INSERT INTO t1 () VALUES ();
drop table t1; drop table t1;
# end of 10.3 test

View File

@ -2109,6 +2109,13 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`; ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-18278 Misleading error message in error log upon failed table creation
--echo #
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create table t1 (a int as (a));
show warnings;
--echo # end of 10.2 test --echo # end of 10.2 test
--echo # --echo #
@ -2126,3 +2133,5 @@ SELECT DEFAULT(h) FROM t1;
SELECT length(DEFAULT(h)) FROM t1; SELECT length(DEFAULT(h)) FROM t1;
INSERT INTO t1 () VALUES (); INSERT INTO t1 () VALUES ();
drop table t1; drop table t1;
--echo # end of 10.3 test

View File

@ -0,0 +1 @@
--init_connect="set @a='something unique to have MTR start a dedicated mariadbd for this test and shutdown it after the test'"

View File

@ -0,0 +1,17 @@
#
# MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
#
SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
INSERT DELAYED INTO t1 VALUES (''||'');
ERROR 22007: Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# MDEV-24467 Memory not freed after failed INSERT DELAYED
#
CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
INSERT DELAYED INTO t1 (a) VALUES ('foo');
ERROR 22001: Data too long for column 'a' at row 1
DROP TABLE t1;

View File

@ -0,0 +1,21 @@
--echo #
--echo # MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
--echo #
SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
--error ER_TRUNCATED_WRONG_VALUE
INSERT DELAYED INTO t1 VALUES (''||'');
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-24467 Memory not freed after failed INSERT DELAYED
--echo #
CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
--error ER_DATA_TOO_LONG
INSERT DELAYED INTO t1 (a) VALUES ('foo');
DROP TABLE t1;

View File

@ -5014,6 +5014,18 @@ DROP TABLE t1;
# End of 10.1 tests # End of 10.1 tests
# #
# #
# Start of 10.2 tests
#
#
# MDEV-24742 Server crashes in Charset::numchars / String::numchars
#
SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux')
NULL
#
# End of 10.2 tests
#
#
# Start of 10.3 tests # Start of 10.3 tests
# #
# #

View File

@ -1987,6 +1987,22 @@ DROP TABLE t1;
--echo # --echo #
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-24742 Server crashes in Charset::numchars / String::numchars
--echo #
SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
--echo #
--echo # End of 10.2 tests
--echo #
--echo # --echo #
--echo # Start of 10.3 tests --echo # Start of 10.3 tests
--echo # --echo #

View File

@ -0,0 +1,52 @@
CREATE TABLE t1 (
pk INT,
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL,
KEY (f1),
PRIMARY KEY (pk)
) ENGINE=InnoDB;
CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL);
CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL),('g'),('e'),('g');
CREATE TABLE t3 (
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL
) ENGINE=InnoDB;
INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6);
CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB;
INSERT INTO t4 VALUES (8),(9);
UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 );
SET DEBUG_SYNC='now SIGNAL con1_dml';
connect con1,localhost,root,,test;
SET DEBUG_SYNC='now WAIT_FOR con1_dml';
begin;
SELECT * FROM t1 for update;
pk f1 f2 f3
-109 a r NULL
1 k g 6
2 y r 0
3 t q 1
5 z t NULL
SET DEBUG_SYNC='now SIGNAL default_dml';
connection default;
SET DEBUG_SYNC='now WAIT_FOR default_dml';
UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h';
connect con2,localhost,root,,test;
set debug_sync='now WAIT_FOR default_dml';
SET DEBUG_SYNC='now SIGNAL con1_dml2';
disconnect con2;
connection con1;
SET DEBUG_SYNC='now WAIT_FOR con1_dml2';
UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 );
connection default;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection con1;
COMMIT;
disconnect con1;
connection default;
DROP VIEW v4;
DROP TABLE t1, t2, t3, t4;
set debug_sync= reset;

View File

@ -0,0 +1 @@
--loose-innodb_lock_waits

View File

@ -0,0 +1,70 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
--source include/have_debug_sync.inc
CREATE TABLE t1 (
pk INT,
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL,
KEY (f1),
PRIMARY KEY (pk)
) ENGINE=InnoDB;
CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL);
CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL),('g'),('e'),('g');
CREATE TABLE t3 (
f1 VARCHAR(10) NOT NULL,
f2 VARCHAR(10) NULL,
f3 INT UNSIGNED NULL
) ENGINE=InnoDB;
INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6);
CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB;
INSERT INTO t4 VALUES (8),(9);
UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 );
SET DEBUG_SYNC='now SIGNAL con1_dml';
--connect (con1,localhost,root,,test)
SET DEBUG_SYNC='now WAIT_FOR con1_dml';
begin;
SELECT * FROM t1 for update; # Holds x lock of all records in the table t1
SET DEBUG_SYNC='now SIGNAL default_dml';
--connection default
SET DEBUG_SYNC='now WAIT_FOR default_dml';
--send UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h'
# It holds the lock of all record in t3 and tries to acquire record lock for the table t1.
--connect (con2,localhost,root,,test)
set debug_sync='now WAIT_FOR default_dml';
let $wait_condition=
select count(*) > 0 from information_schema.innodb_lock_waits;
--source include/wait_condition.inc
SET DEBUG_SYNC='now SIGNAL con1_dml2';
disconnect con2;
# Cleanup
--connection con1
SET DEBUG_SYNC='now WAIT_FOR con1_dml2';
UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 );
# It holds the record lock on table t1 and tries to acquire record lock on t3.
# leads to deadlock (con1 trx is waiting for default trx and vice versa)
--connection default
--error ER_LOCK_DEADLOCK
--reap
connection con1;
COMMIT;
disconnect con1;
--connection default
DROP VIEW v4;
DROP TABLE t1, t2, t3, t4;
set debug_sync= reset;

View File

@ -24,6 +24,22 @@ VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used latin1_swedish_ci 1 Collation used latin1_swedish_ci
1 Collation used utf8_bin 1 Collation used utf8_bin
1 Collation used utf8_general_ci 1 Collation used utf8_general_ci
prepare stmt from "SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' ORDER BY VARIABLE_NAME";
execute stmt;
VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used binary
1 Collation used latin1_bin
1 Collation used latin1_swedish_ci
1 Collation used utf8_bin
1 Collation used utf8_general_ci
execute stmt;
VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used binary
1 Collation used latin1_bin
1 Collation used latin1_swedish_ci
1 Collation used utf8_bin
1 Collation used utf8_general_ci
deallocate prepare stmt;
set global sql_mode=ONLY_FULL_GROUP_BY; set global sql_mode=ONLY_FULL_GROUP_BY;
6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
6: feedback plugin: server replied 'ok' feedback plugin: server replied 'ok'

View File

@ -38,6 +38,6 @@ perl;
while ($_=<LOG>) { while ($_=<LOG>) {
$logg{$&}++ if /feedback plugin:.*/; $logg{$&}++ if /feedback plugin:.*/;
} }
print "$logg{$_}: $_\n" for sort keys %logg; print "$_\n" for sort keys %logg;
close LOG; close LOG;
EOF EOF

View File

@ -29,6 +29,10 @@
#endif #endif
#ifdef MY_CONTEXT_USE_UCONTEXT #ifdef MY_CONTEXT_USE_UCONTEXT
#ifdef __APPLE__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
/* /*
The makecontext() only allows to pass integers into the created context :-( The makecontext() only allows to pass integers into the created context :-(
We want to pass pointers, so we do it this kinda hackish way. We want to pass pointers, so we do it this kinda hackish way.
@ -154,6 +158,9 @@ my_context_destroy(struct my_context *c)
DBUG_FREE_CODE_STATE(&c->dbug_state); DBUG_FREE_CODE_STATE(&c->dbug_state);
} }
#ifdef __APPLE__
#pragma GCC diagnostic pop
#endif
#endif /* MY_CONTEXT_USE_UCONTEXT */ #endif /* MY_CONTEXT_USE_UCONTEXT */

View File

@ -359,6 +359,8 @@ String *Item_aes_crypt::val_str(String *str2)
rkey, AES_KEY_LENGTH / 8, 0, 0)) rkey, AES_KEY_LENGTH / 8, 0, 0))
{ {
str2->length((uint) aes_length); str2->length((uint) aes_length);
DBUG_ASSERT(collation.collation == &my_charset_bin);
str2->set_charset(&my_charset_bin);
return str2; return str2;
} }
} }

View File

@ -9808,7 +9808,9 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
if (global_system_variables.low_priority_updates) if (global_system_variables.low_priority_updates)
thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY;
if (ft_boolean_check_syntax_string((uchar*) ft_boolean_syntax)) if (ft_boolean_check_syntax_string((uchar*) ft_boolean_syntax,
strlen(ft_boolean_syntax),
system_charset_info))
{ {
sql_print_error("Invalid ft-boolean-syntax string: %s\n", sql_print_error("Invalid ft-boolean-syntax string: %s\n",
ft_boolean_syntax); ft_boolean_syntax);

View File

@ -121,11 +121,13 @@ public:
*/ */
enum explain_connection_type connection_type; enum explain_connection_type connection_type;
protected:
/* /*
A node may have children nodes. When a node's explain structure is A node may have children nodes. When a node's explain structure is
created, children nodes may not yet have QPFs. This is why we store ids. created, children nodes may not yet have QPFs. This is why we store ids.
*/ */
Dynamic_array<int> children; Dynamic_array<int> children;
public:
void add_child(int select_no) void add_child(int select_no)
{ {
children.append(select_no); children.append(select_no);

View File

@ -1266,7 +1266,18 @@ values_loop_end:
abort: abort:
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED) if (lock_type == TL_WRITE_DELAYED)
{
end_delayed_insert(thd); end_delayed_insert(thd);
/*
In case of an error (e.g. data truncation), the data type specific data
in fields (e.g. Field_blob::value) was not taken over
by the delayed writer thread. All fields in table_list->table
will be freed by free_root() soon. We need to free the specific
data before free_root() to avoid a memory leak.
*/
for (Field **ptr= table_list->table->field ; *ptr ; ptr++)
(*ptr)->free();
}
#endif #endif
if (table != NULL) if (table != NULL)
table->file->ha_release_auto_increment(); table->file->ha_release_auto_increment();

View File

@ -19996,26 +19996,33 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
will be re-evaluated again. It could be fixed, but, probably, will be re-evaluated again. It could be fixed, but, probably,
it's not worth doing now. it's not worth doing now.
*/ */
if (tab->select_cond && !tab->select_cond->val_int()) if (tab->select_cond)
{ {
/* The condition attached to table tab is false */ const longlong res= tab->select_cond->val_int();
if (tab == join_tab) if (join->thd->is_error())
DBUG_RETURN(NESTED_LOOP_ERROR);
if (!res)
{ {
found= 0; /* The condition attached to table tab is false */
if (not_exists_opt_is_applicable) if (tab == join_tab)
DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS); {
} found= 0;
else if (not_exists_opt_is_applicable)
{ DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
/* }
Set a return point if rejected predicate is attached
not to the last table of the current nest level.
*/
join->return_tab= tab;
if (not_exists_opt_is_applicable)
DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
else else
DBUG_RETURN(NESTED_LOOP_OK); {
/*
Set a return point if rejected predicate is attached
not to the last table of the current nest level.
*/
join->return_tab= tab;
if (not_exists_opt_is_applicable)
DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
else
DBUG_RETURN(NESTED_LOOP_OK);
}
} }
} }
} }

View File

@ -1095,7 +1095,9 @@ static Sys_var_ulong Sys_flush_time(
static bool check_ftb_syntax(sys_var *self, THD *thd, set_var *var) static bool check_ftb_syntax(sys_var *self, THD *thd, set_var *var)
{ {
return ft_boolean_check_syntax_string((uchar*) return ft_boolean_check_syntax_string((uchar*)
(var->save_result.string_value.str)); (var->save_result.string_value.str),
var->save_result.string_value.length,
self->charset(thd));
} }
static bool query_cache_flush(sys_var *self, THD *thd, enum_var_type type) static bool query_cache_flush(sys_var *self, THD *thd, enum_var_type type)
{ {

View File

@ -1167,7 +1167,10 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
if (check_vcol_forward_refs(field, field->vcol_info, 0) || if (check_vcol_forward_refs(field, field->vcol_info, 0) ||
check_vcol_forward_refs(field, field->check_constraint, 1) || check_vcol_forward_refs(field, field->check_constraint, 1) ||
check_vcol_forward_refs(field, field->default_value, 0)) check_vcol_forward_refs(field, field->default_value, 0))
{
*error_reported= true;
goto end; goto end;
}
} }
res=0; res=0;

View File

@ -12,6 +12,7 @@
#include <mysql.h> #include <mysql.h>
#include <sql_error.h> #include <sql_error.h>
#include <stdio.h> #include <stdio.h>
#include <cassert>
#include "bsonudf.h" #include "bsonudf.h"
@ -621,7 +622,7 @@ PVAL BJNX::GetCalcValue(PGLOBAL g, PBVAL bap, int n)
{ {
// For calculated arrays, a local Value must be used // For calculated arrays, a local Value must be used
int lng = 0; int lng = 0;
short type, prec = 0; short type = 0, prec = 0;
bool b = n < Nod - 1; bool b = n < Nod - 1;
PVAL valp; PVAL valp;
PBVAL vlp, vp; PBVAL vlp, vp;
@ -690,7 +691,7 @@ PVAL BJNX::GetCalcValue(PGLOBAL g, PBVAL bap, int n)
break; break;
default: default:
break; DBUG_ASSERT(!"Implement new op type support.");
} // endswitch Op } // endswitch Op
return valp = AllocateValue(g, type, lng, prec); return valp = AllocateValue(g, type, lng, prec);
@ -4978,7 +4979,7 @@ char *bbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result,
uint n = 2; uint n = 2;
int* x = GetIntArgPtr(g, args, n); int* x = GetIntArgPtr(g, args, n);
BJNX bnx(g, NULL, TYPE_STRING); BJNX bnx(g, NULL, TYPE_STRING);
PBVAL jarp, top, jvp = NULL; PBVAL jarp = NULL, top = NULL, jvp = NULL;
PBVAL jsp = bnx.MakeValue(args, 0, true, &top); PBVAL jsp = bnx.MakeValue(args, 0, true, &top);
if (bnx.CheckPath(g, args, jsp, jvp, 2)) if (bnx.CheckPath(g, args, jsp, jvp, 2))
@ -5611,7 +5612,7 @@ char *bbin_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result,
if (!bsp) { if (!bsp) {
if (!CheckMemory(g, initid, args, 1, true, true)) { if (!CheckMemory(g, initid, args, 1, true, true)) {
BJNX bnx(g); BJNX bnx(g);
PBVAL top, jarp; PBVAL top, jarp = NULL;
PBVAL jvp = bnx.MakeValue(args, 0, true, &top); PBVAL jvp = bnx.MakeValue(args, 0, true, &top);
if (jvp->Type == TYPE_JOB) { if (jvp->Type == TYPE_JOB) {

View File

@ -193,17 +193,17 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section )
secno++; secno++;
} }
for (key = section->key; key; key = key->next) for (key= section->key; key; key= key->next) {
if (key->name && key->name[0]) { if (key->name[0]) {
fprintf(file, "%s", SVP(key->name)); fprintf(file, "%s", SVP(key->name));
if (key->value) if (key->value)
fprintf(file, "=%s", SVP(key->value)); fprintf(file, "=%s", SVP(key->value));
fprintf(file, "\n"); fprintf(file, "\n");
} // endif key->name } // endif key->name
}
} // endfor section } // endfor section
} // end of PROFILE_Save } // end of PROFILE_Save

View File

@ -871,7 +871,7 @@ PBVAL BCUTIL::MakeBson(PGLOBAL g, PBVAL jsp, int n)
/***********************************************************************/ /***********************************************************************/
PBVAL BCUTIL::GetRowValue(PGLOBAL g, PBVAL row, int i) PBVAL BCUTIL::GetRowValue(PGLOBAL g, PBVAL row, int i)
{ {
int nod = Cp->Nod, n = nod - 1; int nod = Cp->Nod;
JNODE *nodes = Cp->Nodes; JNODE *nodes = Cp->Nodes;
PBVAL arp; PBVAL arp;
PBVAL bvp = NULL; PBVAL bvp = NULL;

View File

@ -800,13 +800,9 @@ loop:
/** Flush the recently written changes to the log file. /** Flush the recently written changes to the log file.
and invoke log_mutex_enter(). */ and invoke log_mutex_enter(). */
static static void log_write_flush_to_disk_low()
void
log_write_flush_to_disk_low()
{ {
/* FIXME: This is not holding log_sys.mutex while ut_a(log_sys.n_pending_flushes);
calling os_event_set()! */
ut_a(log_sys.n_pending_flushes == 1); /* No other threads here */
bool do_flush = srv_file_flush_method != SRV_O_DSYNC; bool do_flush = srv_file_flush_method != SRV_O_DSYNC;
@ -814,7 +810,6 @@ log_write_flush_to_disk_low()
fil_flush(SRV_LOG_SPACE_FIRST_ID); fil_flush(SRV_LOG_SPACE_FIRST_ID);
} }
log_mutex_enter(); log_mutex_enter();
if (do_flush) { if (do_flush) {
log_sys.flushed_to_disk_lsn = log_sys.current_flush_lsn; log_sys.flushed_to_disk_lsn = log_sys.current_flush_lsn;
@ -1128,7 +1123,7 @@ ATTRIBUTE_COLD void log_write_and_flush()
/* Code adapted from log_write_flush_to_disk_low() */ /* Code adapted from log_write_flush_to_disk_low() */
ut_a(log_sys.n_pending_flushes == 1); /* No other threads here */ ut_a(log_sys.n_pending_flushes);
if (srv_file_flush_method != SRV_O_DSYNC) if (srv_file_flush_method != SRV_O_DSYNC)
fil_flush(SRV_LOG_SPACE_FIRST_ID); fil_flush(SRV_LOG_SPACE_FIRST_ID);

View File

@ -78,18 +78,25 @@ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root)
DBUG_RETURN(wlist); DBUG_RETURN(wlist);
} }
my_bool ft_boolean_check_syntax_string(const uchar *str) my_bool ft_boolean_check_syntax_string(const uchar *str, size_t length,
CHARSET_INFO *cs)
{ {
uint i, j; uint i, j;
if (cs->mbminlen != 1)
{
DBUG_ASSERT(0);
return 1;
}
if (!str || if (!str ||
(strlen((char*) str)+1 != sizeof(DEFAULT_FTB_SYNTAX)) || (length + 1 != sizeof(DEFAULT_FTB_SYNTAX)) ||
(str[0] != ' ' && str[1] != ' ')) (str[0] != ' ' && str[1] != ' '))
return 1; return 1;
for (i=0; i<sizeof(DEFAULT_FTB_SYNTAX); i++) for (i=0; i<sizeof(DEFAULT_FTB_SYNTAX); i++)
{ {
/* limiting to 7-bit ascii only */ /* limiting to 7-bit ascii only */
if ((unsigned char)(str[i]) > 127 || my_isalnum(default_charset_info, str[i])) if ((unsigned char)(str[i]) > 127 || my_isalnum(cs, str[i]))
return 1; return 1;
for (j=0; j<i; j++) for (j=0; j<i; j++)
if (str[i] == str[j] && (i != 11 || j != 10)) if (str[i] == str[j] && (i != 11 || j != 10))