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
221dba14
Commit
221dba14
authored
Aug 28, 2007
by
msvensson@pilot.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge pilot.(none):/data/msvensson/mysql/mysql-5.0-maint
into pilot.(none):/data/msvensson/mysql/mysql-5.1-new-maint
parents
26afeffa
440caf3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
66 deletions
+79
-66
client/mysqltest.c
client/mysqltest.c
+69
-0
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+0
-54
mysql-test/t/loaddata.test
mysql-test/t/loaddata.test
+10
-12
No files found.
client/mysqltest.c
View file @
221dba14
...
@@ -590,6 +590,71 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
...
@@ -590,6 +590,71 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
}
}
/*
Run query and dump the result to stdout in vertical format
NOTE! This function should be safe to call when an error
has occured and thus any further errors will be ignored(although logged)
SYNOPSIS
show_query
mysql - connection to use
query - query to run
*/
static
void
show_query
(
MYSQL
*
mysql
,
const
char
*
query
)
{
MYSQL_RES
*
res
;
DBUG_ENTER
(
"show_query"
);
if
(
!
mysql
)
DBUG_VOID_RETURN
;
if
(
mysql_query
(
mysql
,
query
))
{
log_msg
(
"Error running query '%s': %d %s"
,
query
,
mysql_errno
(
mysql
),
mysql_error
(
mysql
));
DBUG_VOID_RETURN
;
}
if
((
res
=
mysql_store_result
(
mysql
))
==
NULL
)
{
/* No result set returned */
DBUG_VOID_RETURN
;
}
{
MYSQL_ROW
row
;
unsigned
int
i
;
unsigned
int
row_num
=
0
;
unsigned
int
num_fields
=
mysql_num_fields
(
res
);
MYSQL_FIELD
*
fields
=
mysql_fetch_fields
(
res
);
fprintf
(
stderr
,
"=== %s ===
\n
"
,
query
);
while
((
row
=
mysql_fetch_row
(
res
)))
{
unsigned
long
*
lengths
=
mysql_fetch_lengths
(
res
);
row_num
++
;
fprintf
(
stderr
,
"---- %d. ----
\n
"
,
row_num
);
for
(
i
=
0
;
i
<
num_fields
;
i
++
)
{
fprintf
(
stderr
,
"%s
\t
%.*s
\n
"
,
fields
[
i
].
name
,
(
int
)
lengths
[
i
],
row
[
i
]
?
row
[
i
]
:
"NULL"
);
}
}
for
(
i
=
0
;
i
<
strlen
(
query
)
+
8
;
i
++
)
fprintf
(
stderr
,
"="
);
fprintf
(
stderr
,
"
\n\n
"
);
}
mysql_free_result
(
res
);
DBUG_VOID_RETURN
;
}
/*
/*
Show any warnings just before the error. Since the last error
Show any warnings just before the error. Since the last error
is added to the warning stack, only print @@warning_count-1 warnings.
is added to the warning stack, only print @@warning_count-1 warnings.
...
@@ -3147,7 +3212,11 @@ void do_sync_with_master2(long offset)
...
@@ -3147,7 +3212,11 @@ void do_sync_with_master2(long offset)
*/
*/
mysql_free_result
(
res
);
mysql_free_result
(
res
);
if
(
tries
++
==
30
)
if
(
tries
++
==
30
)
{
show_query
(
mysql
,
"SHOW MASTER STATUS"
);
show_query
(
mysql
,
"SHOW SLAVE STATUS"
);
die
(
"could not sync with master ('%s' returned NULL)"
,
query_buf
);
die
(
"could not sync with master ('%s' returned NULL)"
,
query_buf
);
}
sleep
(
1
);
/* So at most we will wait 30 seconds and make 31 tries */
sleep
(
1
);
/* So at most we will wait 30 seconds and make 31 tries */
goto
wait_for_position
;
goto
wait_for_position
;
}
}
...
...
mysql-test/mysql-test-run.pl
View file @
221dba14
...
@@ -3388,56 +3388,6 @@ sub find_testcase_skipped_reason($)
...
@@ -3388,56 +3388,6 @@ sub find_testcase_skipped_reason($)
}
}
sub
analyze_testcase_failure_sync_with_master
($)
{
my
(
$tinfo
)
=
@_
;
my
$args
;
mtr_init_args
(
\
$args
);
mtr_add_arg
(
$args
,
"
--no-defaults
");
mtr_add_arg
(
$args
,
"
--silent
");
mtr_add_arg
(
$args
,
"
--skip-safemalloc
");
mtr_add_arg
(
$args
,
"
--tmpdir=%s
",
$opt_tmpdir
);
mtr_add_arg
(
$args
,
"
--character-sets-dir=%s
",
$path_charsetsdir
);
mtr_add_arg
(
$args
,
"
--socket=%s
",
$master
->
[
0
]
->
{'
path_sock
'});
mtr_add_arg
(
$args
,
"
--port=%d
",
$master
->
[
0
]
->
{'
port
'});
mtr_add_arg
(
$args
,
"
--database=test
");
mtr_add_arg
(
$args
,
"
--user=%s
",
$opt_user
);
mtr_add_arg
(
$args
,
"
--password=
");
# Run the test file and append output to log file
mtr_run_test
(
$exe_mysqltest
,
$args
,
"
include/analyze_failure_sync_with_master.test
",
"
$path_timefile
",
"
$path_timefile
","",
{
append_log_file
=>
1
});
}
sub
analyze_testcase_failure
($)
{
my
(
$tinfo
)
=
@_
;
# Open mysqltest.log
my
$F
=
IO::
File
->
new
(
$path_timefile
)
or
return
;
while
(
my
$line
=
<
$F
>
)
{
# Look for "mysqltest: At line nnn: <error>
if
(
$line
=~
/mysqltest: At line [0-9]*: (.*)/
)
{
my
$error
=
$1
;
# Look for "could not sync with master"
if
(
$error
=~
/could not sync with master/
)
{
analyze_testcase_failure_sync_with_master
(
$tinfo
);
}
}
}
}
##############################################################################
##############################################################################
#
#
# Run a single test case
# Run a single test case
...
@@ -3537,10 +3487,6 @@ sub run_testcase ($) {
...
@@ -3537,10 +3487,6 @@ sub run_testcase ($) {
}
}
elsif
(
$res
==
1
)
elsif
(
$res
==
1
)
{
{
if
(
$opt_force
)
{
analyze_testcase_failure
(
$tinfo
);
}
# Test case failure reported by mysqltest
# Test case failure reported by mysqltest
report_failure_and_restart
(
$tinfo
);
report_failure_and_restart
(
$tinfo
);
}
}
...
...
mysql-test/t/loaddata.test
View file @
221dba14
...
@@ -43,7 +43,7 @@ delete from t1;
...
@@ -43,7 +43,7 @@ delete from t1;
eval
load
data
infile
'$MYSQLTEST_VARDIR/tmp/t1'
into
table
t1
;
eval
load
data
infile
'$MYSQLTEST_VARDIR/tmp/t1'
into
table
t1
;
enable_query_log
;
enable_query_log
;
select
*
from
t1
;
select
*
from
t1
;
--
exec
rm
$MYSQLTEST_VARDIR
/
tmp
/
t1
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
t1
;
disable_query_log
;
disable_query_log
;
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t1'
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t1'
...
@@ -54,7 +54,7 @@ eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1
...
@@ -54,7 +54,7 @@ eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1
FIELDS
TERMINATED
BY
''
OPTIONALLY
ENCLOSED
BY
''
LINES
TERMINATED
BY
'\r\n'
;
FIELDS
TERMINATED
BY
''
OPTIONALLY
ENCLOSED
BY
''
LINES
TERMINATED
BY
'\r\n'
;
enable_query_log
;
enable_query_log
;
select
*
from
t1
;
select
*
from
t1
;
--
exec
rm
$MYSQLTEST_VARDIR
/
tmp
/
t1
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
t1
;
SET
@@
SQL_MODE
=@
OLD_SQL_MODE
;
SET
@@
SQL_MODE
=@
OLD_SQL_MODE
;
drop
table
t1
;
drop
table
t1
;
...
@@ -89,17 +89,16 @@ INSERT INTO t1 (c1) VALUES
...
@@ -89,17 +89,16 @@ INSERT INTO t1 (c1) VALUES
(
'.r.'
),
(
'.rr.'
),
(
'.rrr.'
),
(
'.rrrr.'
);
(
'.r.'
),
(
'.rr.'
),
(
'.rrr.'
),
(
'.rrrr.'
);
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
--
exec
rm
-
f
$MYSQLTEST_VARDIR
/
tmp
/
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t1'
FIELDS
ENCLOSED
BY
'r'
FROM
t1
;
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t1'
FIELDS
ENCLOSED
BY
'r'
FROM
t1
;
--
exec
cat
$MYSQLTEST_VARDIR
/
tmp
/
t1
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
t1
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/t1'
INTO
TABLE
t2
FIELDS
ENCLOSED
BY
'r'
;
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/t1'
INTO
TABLE
t2
FIELDS
ENCLOSED
BY
'r'
;
SELECT
t1
.
id
,
c1
,
c2
FROM
t1
LEFT
JOIN
t2
ON
t1
.
id
=
t2
.
id
WHERE
c1
!=
c2
;
SELECT
t1
.
id
,
c1
,
c2
FROM
t1
LEFT
JOIN
t2
ON
t1
.
id
=
t2
.
id
WHERE
c1
!=
c2
;
SELECT
t1
.
id
,
c1
,
c2
FROM
t1
RIGHT
JOIN
t2
ON
t1
.
id
=
t2
.
id
WHERE
c1
!=
c2
;
SELECT
t1
.
id
,
c1
,
c2
FROM
t1
RIGHT
JOIN
t2
ON
t1
.
id
=
t2
.
id
WHERE
c1
!=
c2
;
--
exec
rm
$MYSQLTEST_VARDIR
/
tmp
/
t1
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
t1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
# End of 4.1 tests
# End of 4.1 tests
...
@@ -188,7 +187,7 @@ SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
...
@@ -188,7 +187,7 @@ SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
eval
load
data
infile
'$MYSQLTEST_VARDIR/tmp/t1'
into
table
t2
;
eval
load
data
infile
'$MYSQLTEST_VARDIR/tmp/t1'
into
table
t2
;
enable_query_log
;
enable_query_log
;
select
*
from
t2
;
select
*
from
t2
;
--
exec
rm
$MYSQLTEST_VARDIR
/
tmp
/
t1
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
t1
;
SET
@@
SQL_MODE
=@
OLD_SQL_MODE
;
SET
@@
SQL_MODE
=@
OLD_SQL_MODE
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
@@ -204,7 +203,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2;
...
@@ -204,7 +203,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2;
eval
load
data
infile
'$MYSQLTEST_VARDIR/tmp/t2'
into
table
t1
;
eval
load
data
infile
'$MYSQLTEST_VARDIR/tmp/t2'
into
table
t1
;
enable_query_log
;
enable_query_log
;
select
f1
from
t1
where
f2
<>
'0000-00-00 00:00:00'
order
by
f1
;
select
f1
from
t1
where
f2
<>
'0000-00-00 00:00:00'
order
by
f1
;
--
exec
rm
$MYSQLTEST_VARDIR
/
tmp
/
t2
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
t2
;
delete
from
t1
;
delete
from
t1
;
disable_query_log
;
disable_query_log
;
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t2'
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t2'
...
@@ -214,7 +213,7 @@ eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1
...
@@ -214,7 +213,7 @@ eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1
FIELDS
TERMINATED
BY
''
OPTIONALLY
ENCLOSED
BY
''
LINES
TERMINATED
BY
'\r\n'
;
FIELDS
TERMINATED
BY
''
OPTIONALLY
ENCLOSED
BY
''
LINES
TERMINATED
BY
'\r\n'
;
enable_query_log
;
enable_query_log
;
select
f1
from
t1
where
f2
<>
'0000-00-00 00:00:00'
order
by
f1
;
select
f1
from
t1
where
f2
<>
'0000-00-00 00:00:00'
order
by
f1
;
--
exec
rm
$MYSQLTEST_VARDIR
/
tmp
/
t2
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
t2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
#
...
@@ -227,11 +226,10 @@ CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
...
@@ -227,11 +226,10 @@ CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
INSERT
INTO
t1
(
c1
,
c2
,
c3
,
c4
)
VALUES
(
10
,
'1970-02-01 01:02:03'
,
1.1E-100
,
1.1E+100
);
INSERT
INTO
t1
(
c1
,
c2
,
c3
,
c4
)
VALUES
(
10
,
'1970-02-01 01:02:03'
,
1.1E-100
,
1.1E+100
);
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
--
exec
rm
-
f
$MYSQLTEST_VARDIR
/
tmp
/
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t1'
FIELDS
ENCLOSED
BY
'-'
FROM
t1
;
eval
SELECT
*
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/t1'
FIELDS
ENCLOSED
BY
'-'
FROM
t1
;
--
exec
cat
$MYSQLTEST_VARDIR
/
tmp
/
t1
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
t1
;
--
exec
echo
EOF
echo
EOF
;
TRUNCATE
t1
;
TRUNCATE
t1
;
...
@@ -239,7 +237,7 @@ TRUNCATE t1;
...
@@ -239,7 +237,7 @@ TRUNCATE t1;
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/t1'
INTO
TABLE
t1
FIELDS
ENCLOSED
BY
'-'
;
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/t1'
INTO
TABLE
t1
FIELDS
ENCLOSED
BY
'-'
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
--
exec
rm
$MYSQLTEST_VARDIR
/
tmp
/
t1
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# End of 5.0 tests
# End of 5.0 tests
...
...
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