Loading Makefile.am +2 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ test-bt: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1 @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --reorder --suite=funcs_1 -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 -if [ -d mysql-test/suite/nist ] ; then \ Loading @@ -179,7 +179,7 @@ test-force-full-pl: test-force-full test-ext-funcs: cd mysql-test ; \ @PERL@ ./mysql-test-run.pl --force --suite=funcs_1 ; \ @PERL@ ./mysql-test-run.pl --force --reorder --suite=funcs_1 ; \ @PERL@ ./mysql-test-run.pl --force --suite=funcs_2 test-ext: test-ext-funcs Loading client/mysql.cc +9 −33 Original line number Diff line number Diff line Loading @@ -1779,7 +1779,7 @@ static int read_and_execute(bool interactive) the very beginning of a text file when you save the file using "Unicode UTF-8" format. */ if (!line_number && if (line && !line_number && (uchar) line[0] == 0xEF && (uchar) line[1] == 0xBB && (uchar) line[2] == 0xBF) Loading Loading @@ -2081,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string, continue; } } else if (!*ml_comment && !*in_string && (end_of_line - pos) >= 10 && !my_strnncoll(charset_info, (uchar*) pos, 10, (const uchar*) "delimiter ", 10)) { // Flush previously accepted characters if (out != line) { buffer.append(line, (uint32) (out - line)); out= line; } // Flush possible comments in the buffer if (!buffer.is_empty()) { if (com_go(&buffer, 0) > 0) // < 0 is not fatal DBUG_RETURN(1); buffer.length(0); } /* Delimiter wants the get rest of the given line as argument to allow one to change ';' to ';;' and back */ buffer.append(pos); if (com_delimiter(&buffer, pos) > 0) DBUG_RETURN(1); buffer.length(0); break; } else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) { // Found a statement. Continue parsing after the delimiter Loading Loading @@ -2156,7 +2125,14 @@ static bool add_line(String &buffer,char *line,char *in_string, } else if (!*ml_comment && (!*in_string && (inchar == '#' || inchar == '-' && pos[1] == '-' && my_isspace(charset_info,pos[2])))) /* The third byte is either whitespace or is the end of the line -- which would occur only because of the user sending newline -- which is itself whitespace and should also match. */ (my_isspace(charset_info,pos[2]) || !pos[2])))) { // Flush previously accepted characters if (out != line) Loading mysql-test/Makefile.am +2 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(distdir)/std_data/ndb_backup50_data_be $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(distdir)/std_data/ndb_backup50_data_le $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(distdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(distdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib -rm -rf `find $(distdir)/suite -type d -name SCCS` Loading Loading @@ -106,7 +106,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_be $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_le $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(DESTDIR)$(testdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(DESTDIR)$(testdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib for f in `(cd $(srcdir); find suite -type f | grep -v SCCS)`; \ do \ Loading mysql-test/include/wait_condition.inc 0 → 100644 +59 −0 Original line number Diff line number Diff line # include/wait_condition.inc # # SUMMARY # # Waits until the passed statement returns true, or the operation # times out. # # USAGE # # let $wait_condition= # SELECT c = 3 FROM t; # --source include/wait_condition.inc # # OR # # let $wait_timeout= 60; # Override default 30 seconds with 60. # let $wait_condition= # SELECT c = 3 FROM t; # --source include/wait_condition.inc # --echo Executed the test condition $wait_condition_reps times # # EXAMPLE # events_bugs.test, events_time_zone.test # --disable_query_log let $wait_counter= 300; if ($wait_timeout) { let $wait_counter= `SELECT $wait_timeout * 10`; } # Reset $wait_timeout so that its value won't be used on subsequent # calls, and default will be used instead. let $wait_timeout= 0; # Keep track of how many times the wait condition is tested # This is used by some tests (e.g., main.status) let $wait_condition_reps= 0; while ($wait_counter) { let $success= `$wait_condition`; inc $wait_condition_reps; if ($success) { let $wait_counter= 0; } if (!$success) { real_sleep 0.1; dec $wait_counter; } } if (!$success) { echo Timeout in wait_condition.inc for $wait_condition; } --enable_query_log mysql-test/r/func_misc.result +90 −32 Original line number Diff line number Diff line Loading @@ -99,41 +99,99 @@ t1 CREATE TABLE `t1` ( `length(uuid())` int(10) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a timestamp default '2005-05-05 01:01:01', b timestamp default '2005-05-05 01:01:01'); insert into t1 set a = now(); select sleep(3); sleep(3) 0 update t1 set b = now(); select timediff(b, a) >= '00:00:03' from t1; timediff(b, a) >= '00:00:03' 1 drop table t1; set global query_cache_size=1355776; create table t1 (a int); insert into t1 values (1),(1),(1); create table t2 (a datetime default null, b datetime default null); insert into t2 set a = now(); select a from t1 where sleep(1); a update t2 set b = now() where b is null; insert into t2 set a = now(); select a from t1 where sleep(a); a update t2 set b = now() where b is null; insert into t2 set a = now(); select a from t1 where sleep(1); a update t2 set b = now() where b is null; select timediff(b, a) >= '00:00:03' from t2; timediff(b, a) >= '00:00:03' #------------------------------------------------------------------------ # Tests for Bug#6760 and Bug#12689 SET @row_count = 4; SET @sleep_time_per_result_row = 1; SET @max_acceptable_delay = 2; SET @@global.query_cache_size = 1024 * 64; DROP TEMPORARY TABLE IF EXISTS t_history; DROP TABLE IF EXISTS t1; CREATE TEMPORARY TABLE t_history (attempt SMALLINT, start_ts DATETIME, end_ts DATETIME, start_cached INTEGER, end_cached INTEGER); CREATE TABLE t1 (f1 BIGINT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t_history SET attempt = 4 - 4 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 4 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 4 + 1; INSERT INTO t_history SET attempt = 4 - 3 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 3 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 3 + 1; INSERT INTO t_history SET attempt = 4 - 2 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 2 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 2 + 1; INSERT INTO t_history SET attempt = 4 - 1 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 1 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 1 + 1; # Test 1: Does the query with SLEEP need a reasonable time? SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count BETWEEN 0 AND @max_acceptable_delay; SELECT @aux1 AS "Expect 1"; Expect 1 1 # Test 2: Does the query with SLEEP need a reasonable time even in case # of the non first execution? SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count BETWEEN 0 AND @max_acceptable_delay AND attempt > 1; SELECT @aux2 AS "Expect 1"; Expect 1 1 # Test 3: The query with SLEEP must be not cached. SELECT COUNT(*) = 4 INTO @aux3 FROM t_history WHERE end_cached = start_cached; SELECT @aux3 AS "Expect 1"; Expect 1 1 drop table t2; drop table t1; set global query_cache_size=default; DROP TABLE t1; DROP TEMPORARY TABLE t_history; SET @@global.query_cache_size = default; create table t1 select INET_ATON('255.255.0.1') as `a`; show create table t1; Table Create Table Loading Loading
Makefile.am +2 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ test-bt: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1 @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --reorder --suite=funcs_1 -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 -if [ -d mysql-test/suite/nist ] ; then \ Loading @@ -179,7 +179,7 @@ test-force-full-pl: test-force-full test-ext-funcs: cd mysql-test ; \ @PERL@ ./mysql-test-run.pl --force --suite=funcs_1 ; \ @PERL@ ./mysql-test-run.pl --force --reorder --suite=funcs_1 ; \ @PERL@ ./mysql-test-run.pl --force --suite=funcs_2 test-ext: test-ext-funcs Loading
client/mysql.cc +9 −33 Original line number Diff line number Diff line Loading @@ -1779,7 +1779,7 @@ static int read_and_execute(bool interactive) the very beginning of a text file when you save the file using "Unicode UTF-8" format. */ if (!line_number && if (line && !line_number && (uchar) line[0] == 0xEF && (uchar) line[1] == 0xBB && (uchar) line[2] == 0xBF) Loading Loading @@ -2081,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string, continue; } } else if (!*ml_comment && !*in_string && (end_of_line - pos) >= 10 && !my_strnncoll(charset_info, (uchar*) pos, 10, (const uchar*) "delimiter ", 10)) { // Flush previously accepted characters if (out != line) { buffer.append(line, (uint32) (out - line)); out= line; } // Flush possible comments in the buffer if (!buffer.is_empty()) { if (com_go(&buffer, 0) > 0) // < 0 is not fatal DBUG_RETURN(1); buffer.length(0); } /* Delimiter wants the get rest of the given line as argument to allow one to change ';' to ';;' and back */ buffer.append(pos); if (com_delimiter(&buffer, pos) > 0) DBUG_RETURN(1); buffer.length(0); break; } else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) { // Found a statement. Continue parsing after the delimiter Loading Loading @@ -2156,7 +2125,14 @@ static bool add_line(String &buffer,char *line,char *in_string, } else if (!*ml_comment && (!*in_string && (inchar == '#' || inchar == '-' && pos[1] == '-' && my_isspace(charset_info,pos[2])))) /* The third byte is either whitespace or is the end of the line -- which would occur only because of the user sending newline -- which is itself whitespace and should also match. */ (my_isspace(charset_info,pos[2]) || !pos[2])))) { // Flush previously accepted characters if (out != line) Loading
mysql-test/Makefile.am +2 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(distdir)/std_data/ndb_backup50_data_be $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(distdir)/std_data/ndb_backup50_data_le $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(distdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(distdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib -rm -rf `find $(distdir)/suite -type d -name SCCS` Loading Loading @@ -106,7 +106,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_be $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_le $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(DESTDIR)$(testdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(DESTDIR)$(testdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib for f in `(cd $(srcdir); find suite -type f | grep -v SCCS)`; \ do \ Loading
mysql-test/include/wait_condition.inc 0 → 100644 +59 −0 Original line number Diff line number Diff line # include/wait_condition.inc # # SUMMARY # # Waits until the passed statement returns true, or the operation # times out. # # USAGE # # let $wait_condition= # SELECT c = 3 FROM t; # --source include/wait_condition.inc # # OR # # let $wait_timeout= 60; # Override default 30 seconds with 60. # let $wait_condition= # SELECT c = 3 FROM t; # --source include/wait_condition.inc # --echo Executed the test condition $wait_condition_reps times # # EXAMPLE # events_bugs.test, events_time_zone.test # --disable_query_log let $wait_counter= 300; if ($wait_timeout) { let $wait_counter= `SELECT $wait_timeout * 10`; } # Reset $wait_timeout so that its value won't be used on subsequent # calls, and default will be used instead. let $wait_timeout= 0; # Keep track of how many times the wait condition is tested # This is used by some tests (e.g., main.status) let $wait_condition_reps= 0; while ($wait_counter) { let $success= `$wait_condition`; inc $wait_condition_reps; if ($success) { let $wait_counter= 0; } if (!$success) { real_sleep 0.1; dec $wait_counter; } } if (!$success) { echo Timeout in wait_condition.inc for $wait_condition; } --enable_query_log
mysql-test/r/func_misc.result +90 −32 Original line number Diff line number Diff line Loading @@ -99,41 +99,99 @@ t1 CREATE TABLE `t1` ( `length(uuid())` int(10) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a timestamp default '2005-05-05 01:01:01', b timestamp default '2005-05-05 01:01:01'); insert into t1 set a = now(); select sleep(3); sleep(3) 0 update t1 set b = now(); select timediff(b, a) >= '00:00:03' from t1; timediff(b, a) >= '00:00:03' 1 drop table t1; set global query_cache_size=1355776; create table t1 (a int); insert into t1 values (1),(1),(1); create table t2 (a datetime default null, b datetime default null); insert into t2 set a = now(); select a from t1 where sleep(1); a update t2 set b = now() where b is null; insert into t2 set a = now(); select a from t1 where sleep(a); a update t2 set b = now() where b is null; insert into t2 set a = now(); select a from t1 where sleep(1); a update t2 set b = now() where b is null; select timediff(b, a) >= '00:00:03' from t2; timediff(b, a) >= '00:00:03' #------------------------------------------------------------------------ # Tests for Bug#6760 and Bug#12689 SET @row_count = 4; SET @sleep_time_per_result_row = 1; SET @max_acceptable_delay = 2; SET @@global.query_cache_size = 1024 * 64; DROP TEMPORARY TABLE IF EXISTS t_history; DROP TABLE IF EXISTS t1; CREATE TEMPORARY TABLE t_history (attempt SMALLINT, start_ts DATETIME, end_ts DATETIME, start_cached INTEGER, end_cached INTEGER); CREATE TABLE t1 (f1 BIGINT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t_history SET attempt = 4 - 4 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 4 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 4 + 1; INSERT INTO t_history SET attempt = 4 - 3 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 3 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 3 + 1; INSERT INTO t_history SET attempt = 4 - 2 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 2 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 2 + 1; INSERT INTO t_history SET attempt = 4 - 1 + 1, start_ts = NOW(), start_cached = 0; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; f1 SLEEP(@sleep_time_per_result_row) 1 0 1 0 1 0 1 0 UPDATE t_history SET end_ts = NOW() WHERE attempt = 4 - 1 + 1; UPDATE t_history SET end_cached = 0 WHERE attempt = 4 - 1 + 1; # Test 1: Does the query with SLEEP need a reasonable time? SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count BETWEEN 0 AND @max_acceptable_delay; SELECT @aux1 AS "Expect 1"; Expect 1 1 # Test 2: Does the query with SLEEP need a reasonable time even in case # of the non first execution? SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count BETWEEN 0 AND @max_acceptable_delay AND attempt > 1; SELECT @aux2 AS "Expect 1"; Expect 1 1 # Test 3: The query with SLEEP must be not cached. SELECT COUNT(*) = 4 INTO @aux3 FROM t_history WHERE end_cached = start_cached; SELECT @aux3 AS "Expect 1"; Expect 1 1 drop table t2; drop table t1; set global query_cache_size=default; DROP TABLE t1; DROP TEMPORARY TABLE t_history; SET @@global.query_cache_size = default; create table t1 select INET_ATON('255.255.0.1') as `a`; show create table t1; Table Create Table Loading