Commit c0cb84bb authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch 'bb-5.5-serg' into 5.5

parents eb32dfd8 470f2598
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
/* Global Thread counter */ /* Global Thread counter */
uint counter= 0; uint counter= 0;
pthread_mutex_t init_mutex;
pthread_mutex_t counter_mutex; pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold; pthread_cond_t count_threshhold;
...@@ -421,8 +422,19 @@ static MYSQL *db_connect(char *host, char *database, ...@@ -421,8 +422,19 @@ static MYSQL *db_connect(char *host, char *database,
MYSQL *mysql; MYSQL *mysql;
if (verbose) if (verbose)
fprintf(stdout, "Connecting to %s\n", host ? host : "localhost"); fprintf(stdout, "Connecting to %s\n", host ? host : "localhost");
if (!(mysql= mysql_init(NULL))) if (opt_use_threads && !lock_tables)
return 0; {
pthread_mutex_lock(&init_mutex);
if (!(mysql= mysql_init(NULL)))
{
pthread_mutex_unlock(&init_mutex);
return 0;
}
pthread_mutex_unlock(&init_mutex);
}
else
if (!(mysql= mysql_init(NULL)))
return 0;
if (opt_compress) if (opt_compress)
mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS);
if (opt_local_file) if (opt_local_file)
...@@ -605,7 +617,7 @@ error: ...@@ -605,7 +617,7 @@ error:
pthread_cond_signal(&count_threshhold); pthread_cond_signal(&count_threshhold);
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
mysql_thread_end(); mysql_thread_end();
pthread_exit(0);
return 0; return 0;
} }
...@@ -629,15 +641,31 @@ int main(int argc, char **argv) ...@@ -629,15 +641,31 @@ int main(int argc, char **argv)
if (opt_use_threads && !lock_tables) if (opt_use_threads && !lock_tables)
{ {
pthread_t mainthread; /* Thread descriptor */ char **save_argv;
pthread_attr_t attr; /* Thread attributes */ uint worker_thread_count= 0, table_count= 0, i= 0;
pthread_t *worker_threads; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, pthread_attr_setdetachstate(&attr,
PTHREAD_CREATE_DETACHED); PTHREAD_CREATE_JOINABLE);
pthread_mutex_init(&init_mutex, NULL);
pthread_mutex_init(&counter_mutex, NULL); pthread_mutex_init(&counter_mutex, NULL);
pthread_cond_init(&count_threshhold, NULL); pthread_cond_init(&count_threshhold, NULL);
/* Count the number of tables. This number denotes the total number
of threads spawn.
*/
save_argv= argv;
for (table_count= 0; *argv != NULL; argv++)
table_count++;
argv= save_argv;
if (!(worker_threads= (pthread_t*) my_malloc(table_count *
sizeof(*worker_threads),
MYF(0))))
return -2;
for (counter= 0; *argv != NULL; argv++) /* Loop through tables */ for (counter= 0; *argv != NULL; argv++) /* Loop through tables */
{ {
pthread_mutex_lock(&counter_mutex); pthread_mutex_lock(&counter_mutex);
...@@ -652,15 +680,16 @@ int main(int argc, char **argv) ...@@ -652,15 +680,16 @@ int main(int argc, char **argv)
counter++; counter++;
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
/* now create the thread */ /* now create the thread */
if (pthread_create(&mainthread, &attr, worker_thread, if (pthread_create(&worker_threads[worker_thread_count], &attr,
(void *)*argv) != 0) worker_thread, (void *)*argv) != 0)
{ {
pthread_mutex_lock(&counter_mutex); pthread_mutex_lock(&counter_mutex);
counter--; counter--;
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
fprintf(stderr,"%s: Could not create thread\n", fprintf(stderr,"%s: Could not create thread\n", my_progname);
my_progname); continue;
} }
worker_thread_count++;
} }
/* /*
...@@ -675,9 +704,18 @@ int main(int argc, char **argv) ...@@ -675,9 +704,18 @@ int main(int argc, char **argv)
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime); pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
} }
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
pthread_mutex_destroy(&init_mutex);
pthread_mutex_destroy(&counter_mutex); pthread_mutex_destroy(&counter_mutex);
pthread_cond_destroy(&count_threshhold); pthread_cond_destroy(&count_threshhold);
pthread_attr_destroy(&attr); pthread_attr_destroy(&attr);
for(i= 0; i < worker_thread_count; i++)
{
if (pthread_join(worker_threads[i], NULL))
fprintf(stderr,"%s: Could not join worker thread.\n", my_progname);
}
my_free(worker_threads);
} }
else else
{ {
......
#
# show server variables
#
--disable_query_log
--echo ===== ENGINES =====
show engines;
--echo ===== VARIABLES =====
show variables;
--echo ===== STOP =====
--enable_query_log
exit;
...@@ -276,7 +276,6 @@ my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto"; ...@@ -276,7 +276,6 @@ my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto";
my $build_thread= 0; my $build_thread= 0;
my $opt_record; my $opt_record;
my $opt_report_features;
our $opt_resfile= $ENV{'MTR_RESULT_FILE'} || 0; our $opt_resfile= $ENV{'MTR_RESULT_FILE'} || 0;
...@@ -422,21 +421,6 @@ sub main { ...@@ -422,21 +421,6 @@ sub main {
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list); my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
mark_time_used('collect'); mark_time_used('collect');
if ( $opt_report_features ) {
# Put "report features" as the first test to run
my $tinfo = My::Test->new
(
name => 'report_features',
# No result_file => Prints result
path => 'include/report-features.test',
template_path => "include/default_my.cnf",
master_opt => [],
slave_opt => [],
suite => 'main',
);
unshift(@$tests, $tinfo);
}
####################################################################### #######################################################################
my $num_tests= @$tests; my $num_tests= @$tests;
if ( $opt_parallel eq "auto" ) { if ( $opt_parallel eq "auto" ) {
...@@ -1203,7 +1187,6 @@ sub command_line_setup { ...@@ -1203,7 +1187,6 @@ sub command_line_setup {
'client-libdir=s' => \$path_client_libdir, 'client-libdir=s' => \$path_client_libdir,
# Misc # Misc
'report-features' => \$opt_report_features,
'comment=s' => \$opt_comment, 'comment=s' => \$opt_comment,
'fast' => \$opt_fast, 'fast' => \$opt_fast,
'force-restart' => \$opt_force_restart, 'force-restart' => \$opt_force_restart,
...@@ -6569,7 +6552,6 @@ Misc options ...@@ -6569,7 +6552,6 @@ Misc options
gprof Collect profiling information using gprof. gprof Collect profiling information using gprof.
experimental=<file> Refer to list of tests considered experimental; experimental=<file> Refer to list of tests considered experimental;
failures will be marked exp-fail instead of fail. failures will be marked exp-fail instead of fail.
report-features First run a "test" that reports mysql features
timestamp Print timestamp before each test report line timestamp Print timestamp before each test report line
timediff With --timestamp, also print time passed since timediff With --timestamp, also print time passed since
*previous* test started *previous* test started
......
...@@ -574,3 +574,10 @@ drop table t1; ...@@ -574,3 +574,10 @@ drop table t1;
# #
# End of 5.5 tests # End of 5.5 tests
# #
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
ERROR HY000: Incorrect arguments to NAME_CONST
SELECT NAME_CONST('a', -(1 AND 2)) OR 1;
ERROR HY000: Incorrect arguments to NAME_CONST
SELECT NAME_CONST('a', -(1)) OR 1;
NAME_CONST('a', -(1)) OR 1
1
...@@ -507,7 +507,7 @@ DROP TABLE t1; ...@@ -507,7 +507,7 @@ DROP TABLE t1;
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
# #
CREATE TABLE t1(f1 INT); CREATE TABLE t1(f1 INT);
SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; SELECT 0xE1C330 INTO OUTFILE 't1.dat';
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
DROP TABLE t1; DROP TABLE t1;
# #
...@@ -532,3 +532,27 @@ FIELDS TERMINATED BY 't' LINES TERMINATED BY ''; ...@@ -532,3 +532,27 @@ FIELDS TERMINATED BY 't' LINES TERMINATED BY '';
Got one of the listed errors Got one of the listed errors
SET @@sql_mode= @old_mode; SET @@sql_mode= @old_mode;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#23080148 - Backport of Bug#20683959.
# Bug#20683959 LOAD DATA INFILE IGNORES A SPECIFIC ROW SILENTLY
# UNDER DB CHARSET IS UTF8.
#
CREATE DATABASE d1 CHARSET latin1;
USE d1;
CREATE TABLE t1 (val TEXT);
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT HEX(val) FROM t1;
HEX(val)
C38322525420406E696F757A656368756E3A20E98198E2889AF58081AEE7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE78999E880B3E7B8BAEFBDAAE7B9A7E89699E296A1E7B8BAE4BBA3EFBD8CE7B8BAEFBDA9E7B8B2E2889AE38184E7B99DEFBDB3E7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE5B3A8EFBD84E8ABA0EFBDA8E89C89F580948EE599AAE7B8BAEFBDAAE7B8BAE9A198EFBDA9EFBDB1E7B9A7E581B5E289A0E7B8BAEFBDBEE7B9A7E9A194EFBDA9E882B4EFBDA5EFBDB5E980A7F5808B96E28693E99EABE38287E58F99E7B8BAE58AB1E28691E7B8BAF5808B9AE7828AE98095EFBDB1E7B8BAEFBDAFE7B8B2E288ABE6A89FE89EB3E6BA98F58081ADE88EA0EFBDBAE98095E6BA98F58081AEE89D93EFBDBAE8AD9BEFBDACE980A7F5808B96E28693E7B8BAF580918EE288AAE7B8BAE4B88AEFBC9EE7B8BAE4B99DE28691E7B8BAF5808B96EFBCA0E88DB3E6A68AEFBDB9EFBDB3E981B2E5B3A8E296A1E7B8BAE7A4BCE7828AE88DB3E6A68AEFBDB0EFBDBDE7B8BAA0E7B8BAE88B93EFBDBEE5B899EFBC9E
CREATE DATABASE d2 CHARSET utf8;
USE d2;
CREATE TABLE t1 (val TEXT);
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
ERROR HY000: Invalid utf8 character string: '"RT @niouzechun: \9058\221A'
DROP TABLE d1.t1, d2.t1;
DROP DATABASE d1;
DROP DATABASE d2;
...@@ -320,3 +320,23 @@ c2 ...@@ -320,3 +320,23 @@ c2
DROP TRIGGER t1_ai; DROP TRIGGER t1_ai;
DROP TABLE t1, t2; DROP TABLE t1, t2;
End of 5.0 tests End of 5.0 tests
#
# Bug#21142859: FUNCTION UPDATING A VIEW FAILS TO FIND TABLE THAT ACTUALLY EXISTS
#
CREATE TABLE t1 SELECT 1 AS fld1, 'A' AS fld2;
CREATE TABLE t2 (fld3 INT, fld4 CHAR(1));
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TRIGGER t1_au AFTER UPDATE ON t1
FOR EACH ROW INSERT INTO t2 VALUES (new.fld1, new.fld2);
CREATE FUNCTION f1() RETURNS INT
BEGIN
UPDATE v1 SET fld2='B' WHERE fld1=1;
RETURN row_count();
END !
# Without the patch, an error was getting reported.
SELECT f1();
f1()
1
DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1,t2;
Ã"RT @niouzechun: 遘√繝上ャ繝斐繧ィ繝ウ繝牙耳縺ェ繧薙□縺代l縺ゥ縲√い繝ウ繝上ャ繝斐繧ィ繝ウ繝峨d諠ィ蜉噪縺ェ縺願ゥア繧偵≠縺セ繧顔ゥ肴・オ逧↓鞫ょ叙縺励↑縺炊逕ア縺ッ縲∫樟螳溘莠コ逕溘蝓コ譛ャ逧↓縺∪縺上>縺九↑縺@荳榊ケウ遲峨□縺礼炊荳榊ース縺縺苓セ帙>
DROP TABLE IF EXISTS t1 ;
# READ_ONLY does nothing to SUPER users
# so we use a non-SUPER one:
GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
connect con1,localhost,test,,test;
connection default;
SET GLOBAL READ_ONLY=1;
connection con1;
CREATE TEMPORARY TABLE t1 (a INT) ENGINE=INNODB;
# Test INSERTS with autocommit being off and on.
BEGIN;
INSERT INTO t1 VALUES (10);
COMMIT;
INSERT INTO t1 VALUES (20);
# Test UPDATES with autocommit being off and on.
BEGIN;
UPDATE t1 SET a=30 WHERE a=10;
COMMIT;
UPDATE t1 SET a=40 WHERE a=20;
connection default;
SET GLOBAL READ_ONLY=0;
# Test scenario where global read_only is enabled in the middle of transaction.
# Test INSERT operations on temporary tables, INSERTs should be successful even
# when global read_only is enabled.
connection con1;
BEGIN;
INSERT INTO t1 VALUES(50);
connection default;
SET GLOBAL READ_ONLY=1;
connection con1;
SELECT @@GLOBAL.READ_ONLY;
@@GLOBAL.READ_ONLY
1
COMMIT;
connection default;
SET GLOBAL READ_ONLY=0;
# Test UPDATE operations on temporary tables, UPDATEs should be successful even
# when global read_only is enabled.
connection con1;
BEGIN;
UPDATE t1 SET a=60 WHERE a=50;
connection default;
SET GLOBAL READ_ONLY=1;
connection con1;
SELECT @@GLOBAL.READ_ONLY;
@@GLOBAL.READ_ONLY
1
COMMIT;
SELECT * FROM t1;
a
30
40
60
# Clean up
connection default;
SET GLOBAL READ_ONLY=0;
disconnect con1;
DROP USER test@localhost;
# ==== Purpose ====
#
# Check that DMLs are allowed on temporary tables, when server is in read only
# mode and binary log is enabled with binlog-format being stmt/mixed mode.
#
# ==== Implementation ====
#
# Start the server with binary log being enabled. Mark the server as read only.
# Create a non-SUPER user and let the user to create a temporary table and
# perform DML operations on that temporary table. DMLs should not be blocked
# with a 'server read-only mode' error.
#
# ==== References ====
#
# Bug#12818255: READ-ONLY OPTION DOES NOT ALLOW INSERTS/UPDATES ON TEMPORARY
# TABLES
# Bug#14294223: CHANGES NOT ALLOWED TO TEMPORARY TABLES ON READ-ONLY SERVERS
###############################################################################
--source include/have_log_bin.inc
--source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1 ;
--enable_warnings
--enable_connect_log
--echo # READ_ONLY does nothing to SUPER users
--echo # so we use a non-SUPER one:
GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
connect (con1,localhost,test,,test);
connection default;
SET GLOBAL READ_ONLY=1;
connection con1;
CREATE TEMPORARY TABLE t1 (a INT) ENGINE=INNODB;
--echo # Test INSERTS with autocommit being off and on.
BEGIN;
INSERT INTO t1 VALUES (10);
COMMIT;
INSERT INTO t1 VALUES (20);
--echo # Test UPDATES with autocommit being off and on.
BEGIN;
UPDATE t1 SET a=30 WHERE a=10;
COMMIT;
UPDATE t1 SET a=40 WHERE a=20;
connection default;
SET GLOBAL READ_ONLY=0;
--echo # Test scenario where global read_only is enabled in the middle of transaction.
--echo # Test INSERT operations on temporary tables, INSERTs should be successful even
--echo # when global read_only is enabled.
connection con1;
BEGIN;
INSERT INTO t1 VALUES(50);
connection default;
SET GLOBAL READ_ONLY=1;
connection con1;
SELECT @@GLOBAL.READ_ONLY;
COMMIT;
connection default;
SET GLOBAL READ_ONLY=0;
--echo # Test UPDATE operations on temporary tables, UPDATEs should be successful even
--echo # when global read_only is enabled.
connection con1;
BEGIN;
UPDATE t1 SET a=60 WHERE a=50;
connection default;
SET GLOBAL READ_ONLY=1;
connection con1;
SELECT @@GLOBAL.READ_ONLY;
COMMIT;
SELECT * FROM t1;
--echo # Clean up
connection default;
SET GLOBAL READ_ONLY=0;
disconnect con1;
DROP USER test@localhost;
--disable_connect_log
...@@ -5,6 +5,9 @@ grant proxy on pam_test to test_pam; ...@@ -5,6 +5,9 @@ grant proxy on pam_test to test_pam;
show variables like 'pam%'; show variables like 'pam%';
Variable_name Value Variable_name Value
pam_use_cleartext_plugin ON pam_use_cleartext_plugin ON
#
# same test as in pam.test now fails
#
drop user test_pam; drop user test_pam;
drop user pam_test; drop user pam_test;
uninstall plugin pam; uninstall plugin pam;
...@@ -29,5 +29,6 @@ EOF ...@@ -29,5 +29,6 @@ EOF
--remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt --remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt
drop user test_pam; drop user test_pam;
drop user pam_test; drop user pam_test;
let $count_sessions= 1;
--source include/wait_until_count_sessions.inc
uninstall plugin pam; uninstall plugin pam;
...@@ -3,10 +3,22 @@ ...@@ -3,10 +3,22 @@
show variables like 'pam%'; show variables like 'pam%';
--write_file $MYSQLTEST_VARDIR/tmp/pam_good.txt
not very secret challenge
9225
select user(), current_user(), database();
EOF
--echo #
--echo # same test as in pam.test now fails
--echo #
--error 1 --error 1
--exec echo FAIL | $MYSQL_TEST -u test_pam --plugin-dir=$plugindir --exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good.txt
--remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt
drop user test_pam; drop user test_pam;
drop user pam_test; drop user pam_test;
let $count_sessions= 1;
--source include/wait_until_count_sessions.inc
uninstall plugin pam; uninstall plugin pam;
...@@ -12,6 +12,12 @@ SET @@global.general_log_file = mytest.log; ...@@ -12,6 +12,12 @@ SET @@global.general_log_file = mytest.log;
ERROR 42000: Incorrect argument type to variable 'general_log_file' ERROR 42000: Incorrect argument type to variable 'general_log_file'
SET @@global.general_log_file = 12; SET @@global.general_log_file = 12;
ERROR 42000: Incorrect argument type to variable 'general_log_file' ERROR 42000: Incorrect argument type to variable 'general_log_file'
SET @@global.general_log_file = 'my.cnf';
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'my.cnf'
SET @@global.general_log_file = '/tmp/my.cnf';
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/tmp/my.cnf'
SET @@global.general_log_file = '.my.cnf';
ERROR 42000: Variable 'general_log_file' can't be set to the value of '.my.cnf'
'#----------------------FN_DYNVARS_004_03------------------------#' '#----------------------FN_DYNVARS_004_03------------------------#'
SELECT @@global.general_log_file = VARIABLE_VALUE SELECT @@global.general_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......
...@@ -9,6 +9,12 @@ SET @@global.slow_query_log_file = mytest.log; ...@@ -9,6 +9,12 @@ SET @@global.slow_query_log_file = mytest.log;
ERROR 42000: Incorrect argument type to variable 'slow_query_log_file' ERROR 42000: Incorrect argument type to variable 'slow_query_log_file'
SET @@global.slow_query_log_file = 12; SET @@global.slow_query_log_file = 12;
ERROR 42000: Incorrect argument type to variable 'slow_query_log_file' ERROR 42000: Incorrect argument type to variable 'slow_query_log_file'
SET @@global.slow_query_log_file = 'my.cnf';
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'my.cnf'
SET @@global.slow_query_log_file = '/tmp/my.cnf';
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/tmp/my.cnf'
SET @@global.general_log_file = '.my.cnf';
ERROR 42000: Variable 'general_log_file' can't be set to the value of '.my.cnf'
'#----------------------FN_DYNVARS_004_03------------------------#' '#----------------------FN_DYNVARS_004_03------------------------#'
SELECT @@global.slow_query_log_file = VARIABLE_VALUE SELECT @@global.slow_query_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......
...@@ -58,6 +58,16 @@ SET @@global.general_log_file = mytest.log; ...@@ -58,6 +58,16 @@ SET @@global.general_log_file = mytest.log;
--error ER_WRONG_TYPE_FOR_VAR --error ER_WRONG_TYPE_FOR_VAR
SET @@global.general_log_file = 12; SET @@global.general_log_file = 12;
#
# MDEV-10465
#
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.general_log_file = 'my.cnf';
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.general_log_file = '/tmp/my.cnf';
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.general_log_file = '.my.cnf';
--echo '#----------------------FN_DYNVARS_004_03------------------------#' --echo '#----------------------FN_DYNVARS_004_03------------------------#'
############################################################################## ##############################################################################
......
...@@ -56,6 +56,16 @@ SET @@global.slow_query_log_file = mytest.log; ...@@ -56,6 +56,16 @@ SET @@global.slow_query_log_file = mytest.log;
--error ER_WRONG_TYPE_FOR_VAR --error ER_WRONG_TYPE_FOR_VAR
SET @@global.slow_query_log_file = 12; SET @@global.slow_query_log_file = 12;
#
# MDEV-10465
#
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.slow_query_log_file = 'my.cnf';
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.slow_query_log_file = '/tmp/my.cnf';
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.general_log_file = '.my.cnf';
--echo '#----------------------FN_DYNVARS_004_03------------------------#' --echo '#----------------------FN_DYNVARS_004_03------------------------#'
############################################################################## ##############################################################################
# Check if the value in GLOBAL Tables matches values in variable # # Check if the value in GLOBAL Tables matches values in variable #
......
...@@ -599,3 +599,13 @@ drop table t1; ...@@ -599,3 +599,13 @@ drop table t1;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
#
# Bug#12735545 - PARSER STACK OVERFLOW WITH NAME_CONST
# CONTAINING OR EXPRESSION
#
--error ER_WRONG_ARGUMENTS
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
--error ER_WRONG_ARGUMENTS
SELECT NAME_CONST('a', -(1 AND 2)) OR 1;
SELECT NAME_CONST('a', -(1)) OR 1;
...@@ -612,7 +612,7 @@ disconnect con1; ...@@ -612,7 +612,7 @@ disconnect con1;
--echo # --echo #
CREATE TABLE t1(f1 INT); CREATE TABLE t1(f1 INT);
EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; EVAL SELECT 0xE1C330 INTO OUTFILE 't1.dat';
--disable_warnings --disable_warnings
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
--enable_warnings --enable_warnings
...@@ -658,3 +658,26 @@ SET @@sql_mode= @old_mode; ...@@ -658,3 +658,26 @@ SET @@sql_mode= @old_mode;
--remove_file $MYSQLTEST_VARDIR/mysql --remove_file $MYSQLTEST_VARDIR/mysql
DROP TABLE t1; DROP TABLE t1;
--echo
--echo #
--echo # Bug#23080148 - Backport of Bug#20683959.
--echo # Bug#20683959 LOAD DATA INFILE IGNORES A SPECIFIC ROW SILENTLY
--echo # UNDER DB CHARSET IS UTF8.
--echo #
CREATE DATABASE d1 CHARSET latin1;
USE d1;
CREATE TABLE t1 (val TEXT);
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
SELECT COUNT(*) FROM t1;
SELECT HEX(val) FROM t1;
CREATE DATABASE d2 CHARSET utf8;
USE d2;
CREATE TABLE t1 (val TEXT);
--error ER_INVALID_CHARACTER_STRING
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
DROP TABLE d1.t1, d2.t1;
DROP DATABASE d1;
DROP DATABASE d2;
...@@ -388,3 +388,29 @@ DROP TABLE t1, t2; ...@@ -388,3 +388,29 @@ DROP TABLE t1, t2;
--echo End of 5.0 tests --echo End of 5.0 tests
--echo #
--echo # Bug#21142859: FUNCTION UPDATING A VIEW FAILS TO FIND TABLE THAT ACTUALLY EXISTS
--echo #
CREATE TABLE t1 SELECT 1 AS fld1, 'A' AS fld2;
CREATE TABLE t2 (fld3 INT, fld4 CHAR(1));
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TRIGGER t1_au AFTER UPDATE ON t1
FOR EACH ROW INSERT INTO t2 VALUES (new.fld1, new.fld2);
DELIMITER !;
CREATE FUNCTION f1() RETURNS INT
BEGIN
UPDATE v1 SET fld2='B' WHERE fld1=1;
RETURN row_count();
END !
DELIMITER ;!
--echo # Without the patch, an error was getting reported.
SELECT f1();
DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1,t2;
...@@ -159,6 +159,10 @@ char *argv[]; ...@@ -159,6 +159,10 @@ char *argv[];
if (argc > 4) if (argc > 4)
for (n = atoi(argv[3]); n > 0; n--) { for (n = atoi(argv[3]); n > 0; n--) {
if(sizeof(buf)-1 < strlen(argv[1]))
{
exit(EXIT_FAILURE);
}
(void) strcpy(buf, argv[1]); (void) strcpy(buf, argv[1]);
} }
else if (argc > 3) else if (argc > 3)
......
...@@ -1238,7 +1238,8 @@ int ha_commit_trans(THD *thd, bool all) ...@@ -1238,7 +1238,8 @@ int ha_commit_trans(THD *thd, bool all)
uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all); uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all);
/* rw_trans is TRUE when we in a transaction changing data */ /* rw_trans is TRUE when we in a transaction changing data */
bool rw_trans= is_real_trans && (rw_ha_count > 0); bool rw_trans= is_real_trans &&
(rw_ha_count > !thd->is_current_stmt_binlog_disabled());
MDL_request mdl_request; MDL_request mdl_request;
if (rw_trans) if (rw_trans)
......
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2016, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
...@@ -5371,6 +5371,15 @@ handle_view(THD *thd, Query_tables_list *prelocking_ctx, ...@@ -5371,6 +5371,15 @@ handle_view(THD *thd, Query_tables_list *prelocking_ctx,
&table_list->view->sroutines_list, &table_list->view->sroutines_list,
table_list->top_table()); table_list->top_table());
} }
/*
If a trigger was defined on one of the associated tables then assign the
'trg_event_map' value of the view to the next table in table_list. When a
Stored function is invoked, all the associated tables including the tables
associated with the trigger are prelocked.
*/
if (table_list->trg_event_map && table_list->next_global)
table_list->next_global->trg_event_map= table_list->trg_event_map;
return FALSE; return FALSE;
} }
......
...@@ -1389,8 +1389,8 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, ...@@ -1389,8 +1389,8 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
set_if_bigger(length,line_start.length()); set_if_bigger(length,line_start.length());
stack=stack_pos=(int*) sql_alloc(sizeof(int)*length); stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
if (!(buffer=(uchar*) my_malloc(buff_length+1,MYF(0)))) if (!(buffer=(uchar*) my_malloc(buff_length+1,MYF(MY_WME))))
error=1; /* purecov: inspected */ error= true; /* purecov: inspected */
else else
{ {
end_of_buff=buffer+buff_length; end_of_buff=buffer+buff_length;
...@@ -1581,37 +1581,50 @@ int READ_INFO::read_field() ...@@ -1581,37 +1581,50 @@ int READ_INFO::read_field()
} }
} }
#ifdef USE_MB #ifdef USE_MB
if (my_mbcharlen(read_charset, chr) > 1 && uint ml= my_mbcharlen(read_charset, chr);
to + my_mbcharlen(read_charset, chr) <= end_of_buff) if (ml == 0)
{ {
uchar* p= to; *to= '\0';
int ml, i; my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
*to++ = chr; read_charset->csname, buffer);
error= true;
ml= my_mbcharlen(read_charset, chr); return 1;
}
for (i= 1; i < ml; i++) if (ml > 1 &&
to + ml <= end_of_buff)
{ {
chr= GET; uchar* p= to;
if (chr == my_b_EOF) *to++ = chr;
for (uint i= 1; i < ml; i++)
{ {
/* chr= GET;
Need to back up the bytes already ready from illformed if (chr == my_b_EOF)
multi-byte char {
*/ /*
to-= i; Need to back up the bytes already ready from illformed
goto found_eof; multi-byte char
*/
to-= i;
goto found_eof;
}
*to++ = chr;
} }
*to++ = chr; if (my_ismbchar(read_charset,
}
if (my_ismbchar(read_charset,
(const char *)p, (const char *)p,
(const char *)to)) (const char *)to))
continue; continue;
for (i= 0; i < ml; i++) for (uint i= 0; i < ml; i++)
PUSH(*--to); PUSH(*--to);
chr= GET; chr= GET;
} }
else if (ml > 1)
{
// Buffer is too small, exit while loop, and reallocate.
PUSH(chr);
break;
}
#endif #endif
*to++ = (uchar) chr; *to++ = (uchar) chr;
} }
...@@ -1855,7 +1868,15 @@ int READ_INFO::read_value(int delim, String *val) ...@@ -1855,7 +1868,15 @@ int READ_INFO::read_value(int delim, String *val)
for (chr= GET; my_tospace(chr) != delim && chr != my_b_EOF;) for (chr= GET; my_tospace(chr) != delim && chr != my_b_EOF;)
{ {
#ifdef USE_MB #ifdef USE_MB
if (my_mbcharlen(read_charset, chr) > 1) uint ml= my_mbcharlen(read_charset, chr);
if (ml == 0)
{
chr= my_b_EOF;
val->length(0);
return chr;
}
if (ml > 1)
{ {
DBUG_PRINT("read_xml",("multi byte")); DBUG_PRINT("read_xml",("multi byte"));
int i, ml= my_mbcharlen(read_charset, chr); int i, ml= my_mbcharlen(read_charset, chr);
......
...@@ -3025,14 +3025,23 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) ...@@ -3025,14 +3025,23 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var)
if (!var->save_result.string_value.str) if (!var->save_result.string_value.str)
return true; return true;
if (var->save_result.string_value.length > FN_REFLEN) LEX_STRING *val= &var->save_result.string_value;
if (val->length > FN_REFLEN)
{ // path is too long { // path is too long
my_error(ER_PATH_LENGTH, MYF(0), self->name.str); my_error(ER_PATH_LENGTH, MYF(0), self->name.str);
return true; return true;
} }
static const LEX_CSTRING my_cnf= { STRING_WITH_LEN("my.cnf") };
if (val->length >= my_cnf.length)
{
if (strcasecmp(val->str + val->length - my_cnf.length, my_cnf.str) == 0)
return true; // log file name ends with "my.cnf"
}
char path[FN_REFLEN]; char path[FN_REFLEN];
size_t path_length= unpack_filename(path, var->save_result.string_value.str); size_t path_length= unpack_filename(path, val->str);
if (!path_length) if (!path_length)
return true; return true;
...@@ -3046,9 +3055,9 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) ...@@ -3046,9 +3055,9 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var)
return false; return false;
} }
(void) dirname_part(path, var->save_result.string_value.str, &path_length); (void) dirname_part(path, val->str, &path_length);
if (var->save_result.string_value.length - path_length >= FN_LEN) if (val->length - path_length >= FN_LEN)
{ // filename is too long { // filename is too long
my_error(ER_PATH_LENGTH, MYF(0), self->name.str); my_error(ER_PATH_LENGTH, MYF(0), self->name.str);
return true; return true;
......
...@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ...@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Place, Suite 330, Boston, MA 02111-1307 USA Street, Fifth Floor, Boston, MA 02110-1301, USA
*****************************************************************************/ *****************************************************************************/
......
...@@ -64,7 +64,7 @@ component, i.e. we show M.N.P as M.N */ ...@@ -64,7 +64,7 @@ component, i.e. we show M.N.P as M.N */
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
#ifndef PERCONA_INNODB_VERSION #ifndef PERCONA_INNODB_VERSION
#define PERCONA_INNODB_VERSION 37.9 #define PERCONA_INNODB_VERSION 38.0
#endif #endif
#define INNODB_VERSION_STR "5.5.49-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION) #define INNODB_VERSION_STR "5.5.49-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION)
......
...@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ...@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Place, Suite 330, Boston, MA 02111-1307 USA Street, Fifth Floor, Boston, MA 02110-1301, USA
*****************************************************************************/ *****************************************************************************/
......
...@@ -666,6 +666,7 @@ recv_check_cp_is_consistent( ...@@ -666,6 +666,7 @@ recv_check_cp_is_consistent(
} }
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
/********************************************************//** /********************************************************//**
Looks for the maximum consistent checkpoint from the log groups. Looks for the maximum consistent checkpoint from the log groups.
@return error code or DB_SUCCESS */ @return error code or DB_SUCCESS */
...@@ -692,8 +693,37 @@ recv_find_max_checkpoint( ...@@ -692,8 +693,37 @@ recv_find_max_checkpoint(
buf = log_sys->checkpoint_buf; buf = log_sys->checkpoint_buf;
while (group) { while (group) {
ulint log_hdr_log_block_size;
group->state = LOG_GROUP_CORRUPTED; group->state = LOG_GROUP_CORRUPTED;
/* Assert that we can reuse log_sys->checkpoint_buf to read the
part of the header that contains the log block size. */
ut_ad(LOG_FILE_OS_FILE_LOG_BLOCK_SIZE + 4
< OS_FILE_LOG_BLOCK_SIZE);
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->space_id, 0,
0, 0, OS_FILE_LOG_BLOCK_SIZE,
log_sys->checkpoint_buf, NULL);
log_hdr_log_block_size
= mach_read_from_4(log_sys->checkpoint_buf
+ LOG_FILE_OS_FILE_LOG_BLOCK_SIZE);
if (log_hdr_log_block_size == 0) {
/* 0 means default value */
log_hdr_log_block_size = 512;
}
if (log_hdr_log_block_size != srv_log_block_size) {
fprintf(stderr,
"InnoDB: Error: The block size of ib_logfile "
"%lu is not equal to innodb_log_block_size "
"%lu.\n"
"InnoDB: Error: Suggestion - Recreate log "
"files.\n",
log_hdr_log_block_size, srv_log_block_size);
return(DB_ERROR);
}
for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2; for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2;
field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) { field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) {
...@@ -2989,7 +3019,6 @@ recv_recovery_from_checkpoint_start_func( ...@@ -2989,7 +3019,6 @@ recv_recovery_from_checkpoint_start_func(
log_group_t* max_cp_group; log_group_t* max_cp_group;
log_group_t* up_to_date_group; log_group_t* up_to_date_group;
ulint max_cp_field; ulint max_cp_field;
ulint log_hdr_log_block_size;
ib_uint64_t checkpoint_lsn; ib_uint64_t checkpoint_lsn;
ib_uint64_t checkpoint_no; ib_uint64_t checkpoint_no;
ib_uint64_t old_scanned_lsn; ib_uint64_t old_scanned_lsn;
...@@ -3092,21 +3121,6 @@ recv_recovery_from_checkpoint_start_func( ...@@ -3092,21 +3121,6 @@ recv_recovery_from_checkpoint_start_func(
log_hdr_buf, max_cp_group); log_hdr_buf, max_cp_group);
} }
log_hdr_log_block_size
= mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE);
if (log_hdr_log_block_size == 0) {
/* 0 means default value */
log_hdr_log_block_size = 512;
}
if (log_hdr_log_block_size != srv_log_block_size) {
fprintf(stderr,
"InnoDB: Error: The block size of ib_logfile (%lu) "
"is not equal to innodb_log_block_size.\n"
"InnoDB: Error: Suggestion - Recreate log files.\n",
log_hdr_log_block_size);
return(DB_ERROR);
}
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
group = UT_LIST_GET_FIRST(log_sys->log_groups); group = UT_LIST_GET_FIRST(log_sys->log_groups);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment