File: outfile_fsync_debug.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (89 lines) | stat: -rw-r--r-- 3,444 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
--source include/not_windows.inc
--source include/have_debug.inc
--source include/no_valgrind_without_big.inc

--let $error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err
--remove_file $error_log
--source include/restart_mysqld.inc

--disable_query_log
--source include/outfile_fsync.inc
eval set @tmpdir='$MYSQLTEST_VARDIR/tmp';
--source include/have_outfile.inc
--enable_query_log

# Save the initial number of concurrent sessions
--source include/count_sessions.inc

SET SESSION select_into_buffer_size=262144;

# Table is used to check if exported data are the same as
# in original table(t2).
CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=INNODB;

# Create a table and populate it with some data
CREATE TABLE t2 (a TEXT, b TEXT) ENGINE=INNODB;

# Here we end up with 32768 rows in the table
--disable_query_log
INSERT INTO t2 (a, b) VALUES (REPEAT('a', 512), REPEAT('b', 512));
INSERT INTO t2 (a, b) VALUES (REPEAT('A', 512), REPEAT('B', 512));
let $i=14;
while ($i) {
  INSERT INTO t2 (a, b) SELECT a, b FROM t2;
  dec $i;
}

# Query1, check SELECT INTO OUTFILE, number of flushes is expected to be 129.
SET GLOBAL debug = '+d,print_select_into_flush_stats';
--eval SELECT /*+ SET_VAR(select_into_disk_sync = ON) */ * INTO OUTFILE "$MYSQLTEST_VARDIR/tmp/t2.txt" FROM t2;
# Check if data is the same as in original table.
SET GLOBAL debug = '-d,print_select_into_flush_stats';
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t2.txt' IGNORE INTO TABLE t1;
--let $diff_tables= test.t1, test.t2
--source include/diff_tables.inc
SET GLOBAL debug = '+d,print_select_into_flush_stats';
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt

# Query2, check SELECT INTO OUTFILE with delay, number of flushes is expected to be 1.
--error ER_QUERY_TIMEOUT
--eval SELECT /*+ MAX_EXECUTION_TIME(1000) SET_VAR(select_into_disk_sync_delay = 5000) SET_VAR(select_into_disk_sync = ON) */ * INTO OUTFILE "$MYSQLTEST_VARDIR/tmp/t2.txt" FROM t2;
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt

# Query3, check SELECT INTO DUMPFILE, number of flushes is expected to be 2.
DELETE FROM t2;
INSERT INTO t2 (a, b) VALUES (REPEAT('a', 10000), REPEAT('b', 10000));
--eval SELECT /*+ SET_VAR(select_into_disk_sync = ON) SET_VAR(select_into_buffer_size = 8192) */ * INTO DUMPFILE "$MYSQLTEST_VARDIR/tmp/t2.txt" FROM t2;
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt

--enable_query_log
--let $assert_file= $error_log
--let $assert_only_after = CURRENT_TEST: outfile_fsync_debug
--let $assert_count = 1
# Verify query1
--let $assert_select = \[select_to_file\]\[flush_count\] 129
--let $assert_text = Found expected number of select_to_file
--source include/assert_grep.inc

# Verify query2
--let $assert_select = \[select_to_file\]\[flush_count\] 001
--source include/assert_grep.inc

# Verify query3
--let $assert_select = \[select_to_file\]\[flush_count\] 002
--source include/assert_grep.inc

# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

SET GLOBAL debug = '-d,print_select_into_flush_stats';

# Check if system variable select_into_buffer_size, select_into_disk_sync,
# select_into_disk_sync_delay are hint-updatable.
SELECT /*+ SET_VAR(select_into_disk_sync_delay = 5000) 
           SET_VAR(select_into_disk_sync = ON)
           SET_VAR(select_into_buffer_size = 16384) */
  @@select_into_disk_sync_delay, @@select_into_disk_sync, @@select_into_buffer_size;

SET SESSION select_into_buffer_size=default;
DROP TABLE t1, t2;