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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
fa9bacb2
Commit
fa9bacb2
authored
Aug 14, 2007
by
tsmith@ramayana.hindu.god
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to allow innodb.test to be run with --embedded-server,
including a small change to build_table_filename().
parent
bde83389
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
112 deletions
+100
-112
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+0
-20
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+3
-36
mysql-test/suite/binlog/r/binlog_innodb.result
mysql-test/suite/binlog/r/binlog_innodb.result
+33
-0
mysql-test/suite/binlog/t/binlog_innodb.test
mysql-test/suite/binlog/t/binlog_innodb.test
+39
-0
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+11
-52
sql/sql_table.cc
sql/sql_table.cc
+14
-4
No files found.
mysql-test/mysql-test-run.pl
View file @
fa9bacb2
...
@@ -933,26 +933,6 @@ sub command_line_setup () {
...
@@ -933,26 +933,6 @@ sub command_line_setup () {
mtr_error
("
Will not run in record mode without a specific test case
");
mtr_error
("
Will not run in record mode without a specific test case
");
}
}
# --------------------------------------------------------------------------
# Embedded server flag
# --------------------------------------------------------------------------
if
(
$opt_embedded_server
)
{
$glob_use_embedded_server
=
1
;
push
(
@glob_test_mode
,
"
embedded
");
$opt_skip_rpl
=
1
;
# We never run replication with embedded
$opt_skip_ndbcluster
=
1
;
# Turn off use of NDB cluster
$opt_skip_ssl
=
1
;
# Turn off use of SSL
# Turn off use of bin log
push
(
@opt_extra_mysqld_opt
,
"
--skip-log-bin
");
if
(
$opt_extern
)
{
mtr_error
("
Can't use --extern with --embedded-server
");
}
}
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
# ps protcol flag
# ps protcol flag
...
...
mysql-test/r/innodb.result
View file @
fa9bacb2
...
@@ -1086,39 +1086,6 @@ n d
...
@@ -1086,39 +1086,6 @@ n d
1 30
1 30
2 20
2 20
drop table t1,t2;
drop table t1,t2;
CREATE TABLE `t1` (
`a`
int(11) NOT NULL auto_increment,
`b`
int(11) default NULL,
PRIMARY KEY (`a`)
)
ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a`
int(11) NOT NULL auto_increment,
`b`
int(11) default NULL,
PRIMARY KEY (`a`)
)
ENGINE=INNODB DEFAULT CHARSET=latin1 ;
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t1.a+2;
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t2 /* must be (3,1), (4,4) */;
a b
1 1
4 4
show master status /* there must no UPDATE in binlog */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be no UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
drop table t1, t2;
create table t1 (a int, b int) engine=innodb;
create table t1 (a int, b int) engine=innodb;
insert into t1 values(20,null);
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
...
@@ -1784,13 +1751,13 @@ Variable_name Value
...
@@ -1784,13 +1751,13 @@ Variable_name Value
Innodb_page_size 16384
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
show status like "Innodb_rows_deleted";
Variable_name Value
Variable_name Value
Innodb_rows_deleted 7
2
Innodb_rows_deleted 7
0
show status like "Innodb_rows_inserted";
show status like "Innodb_rows_inserted";
Variable_name Value
Variable_name Value
Innodb_rows_inserted 108
8
Innodb_rows_inserted 108
3
show status like "Innodb_rows_updated";
show status like "Innodb_rows_updated";
Variable_name Value
Variable_name Value
Innodb_rows_updated 88
8
Innodb_rows_updated 88
6
show status like "Innodb_row_lock_waits";
show status like "Innodb_row_lock_waits";
Variable_name Value
Variable_name Value
Innodb_row_lock_waits 0
Innodb_row_lock_waits 0
...
...
mysql-test/suite/binlog/r/binlog_innodb.result
View file @
fa9bacb2
...
@@ -135,4 +135,37 @@ show status like "binlog_cache_disk_use";
...
@@ -135,4 +135,37 @@ show status like "binlog_cache_disk_use";
Variable_name Value
Variable_name Value
Binlog_cache_disk_use 1
Binlog_cache_disk_use 1
drop table t1;
drop table t1;
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t1.a+2;
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t2 /* must be (3,1), (4,4) */;
a b
1 1
4 4
show master status /* there must no UPDATE in binlog */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be no UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
drop table t1, t2;
End of tests
End of tests
mysql-test/suite/binlog/t/binlog_innodb.test
View file @
fa9bacb2
...
@@ -130,4 +130,43 @@ show status like "binlog_cache_use";
...
@@ -130,4 +130,43 @@ show status like "binlog_cache_use";
show
status
like
"binlog_cache_disk_use"
;
show
status
like
"binlog_cache_disk_use"
;
drop
table
t1
;
drop
table
t1
;
#
# Bug#27716 multi-update did partially and has not binlogged
#
CREATE
TABLE
`t1`
(
`a`
int
(
11
)
NOT
NULL
auto_increment
,
`b`
int
(
11
)
default
NULL
,
PRIMARY
KEY
(
`a`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
CREATE
TABLE
`t2`
(
`a`
int
(
11
)
NOT
NULL
auto_increment
,
`b`
int
(
11
)
default
NULL
,
PRIMARY
KEY
(
`a`
)
)
ENGINE
=
INNODB
DEFAULT
CHARSET
=
latin1
;
# A. testing multi_update::send_eof() execution branch
insert
into
t1
values
(
1
,
1
),(
2
,
2
);
insert
into
t2
values
(
1
,
1
),(
4
,
4
);
reset
master
;
--
error
ER_DUP_ENTRY
UPDATE
t2
,
t1
SET
t2
.
a
=
t1
.
a
+
2
;
# check
select
*
from
t2
/* must be (3,1), (4,4) */
;
show
master
status
/* there must no UPDATE in binlog */
;
# B. testing multi_update::send_error() execution branch
delete
from
t1
;
delete
from
t2
;
insert
into
t1
values
(
1
,
2
),(
3
,
4
),(
4
,
4
);
insert
into
t2
values
(
1
,
2
),(
3
,
4
),(
4
,
4
);
reset
master
;
--
error
ER_DUP_ENTRY
UPDATE
t2
,
t1
SET
t2
.
a
=
t2
.
b
where
t2
.
a
=
t1
.
a
;
show
master
status
/* there must be no UPDATE query event */
;
# cleanup bug#27716
drop
table
t1
,
t2
;
--
echo
End
of
tests
--
echo
End
of
tests
mysql-test/t/innodb.test
View file @
fa9bacb2
...
@@ -11,13 +11,7 @@
...
@@ -11,13 +11,7 @@
# #
# #
#######################################################################
#######################################################################
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_log_bin
.
inc
# Disabling it temporarily for statement-based logging since some
# tests are not safe while binlog is on.
--
source
include
/
have_binlog_format_mixed_or_row
.
inc
#
#
# Small basic test with ignore
# Small basic test with ignore
...
@@ -759,45 +753,6 @@ select * from t1;
...
@@ -759,45 +753,6 @@ select * from t1;
select
*
from
t2
;
select
*
from
t2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# Bug#27716 multi-update did partially and has not binlogged
#
CREATE
TABLE
`t1`
(
`a`
int
(
11
)
NOT
NULL
auto_increment
,
`b`
int
(
11
)
default
NULL
,
PRIMARY
KEY
(
`a`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
CREATE
TABLE
`t2`
(
`a`
int
(
11
)
NOT
NULL
auto_increment
,
`b`
int
(
11
)
default
NULL
,
PRIMARY
KEY
(
`a`
)
)
ENGINE
=
INNODB
DEFAULT
CHARSET
=
latin1
;
# A. testing multi_update::send_eof() execution branch
insert
into
t1
values
(
1
,
1
),(
2
,
2
);
insert
into
t2
values
(
1
,
1
),(
4
,
4
);
reset
master
;
--
error
ER_DUP_ENTRY
UPDATE
t2
,
t1
SET
t2
.
a
=
t1
.
a
+
2
;
# check
select
*
from
t2
/* must be (3,1), (4,4) */
;
show
master
status
/* there must no UPDATE in binlog */
;
# B. testing multi_update::send_error() execution branch
delete
from
t1
;
delete
from
t2
;
insert
into
t1
values
(
1
,
2
),(
3
,
4
),(
4
,
4
);
insert
into
t2
values
(
1
,
2
),(
3
,
4
),(
4
,
4
);
reset
master
;
--
error
ER_DUP_ENTRY
UPDATE
t2
,
t1
SET
t2
.
a
=
t2
.
b
where
t2
.
a
=
t1
.
a
;
show
master
status
/* there must be no UPDATE query event */
;
# cleanup bug#27716
drop
table
t1
,
t2
;
#
#
# Testing of IFNULL
# Testing of IFNULL
#
#
...
@@ -1175,9 +1130,8 @@ drop table t2;
...
@@ -1175,9 +1130,8 @@ drop table t2;
# Test error handling
# Test error handling
# Clean up filename -- embedded server reports whole path without .frm,
# Embedded server doesn't chdir to data directory
# regular server reports relative path with .frm (argh!)
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
replace_result
\\
/
$MYSQL_TEST_DIR
.
/
var
/
master
-
data
/
/
t2
.
frm
t2
--
error
ER_WRONG_FK_DEF
--
error
ER_WRONG_FK_DEF
create
table
t2
(
id
int
(
11
)
not
null
,
id2
int
(
11
)
not
null
,
constraint
t1_id_fk
foreign
key
(
id2
,
id
)
references
t1
(
id
))
engine
=
innodb
;
create
table
t2
(
id
int
(
11
)
not
null
,
id2
int
(
11
)
not
null
,
constraint
t1_id_fk
foreign
key
(
id2
,
id
)
references
t1
(
id
))
engine
=
innodb
;
...
@@ -1369,9 +1323,8 @@ source include/varchar.inc;
...
@@ -1369,9 +1323,8 @@ source include/varchar.inc;
# Some errors/warnings on create
# Some errors/warnings on create
#
#
# Clean up filename -- embedded server reports whole path without .frm,
# Embedded server doesn't chdir to data directory
# regular server reports relative path with .frm (argh!)
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
replace_result
\\
/
$MYSQL_TEST_DIR
.
/
var
/
master
-
data
/
/
t1
.
frm
t1
create
table
t1
(
v
varchar
(
65530
),
key
(
v
));
create
table
t1
(
v
varchar
(
65530
),
key
(
v
));
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
v
varchar
(
65536
));
create
table
t1
(
v
varchar
(
65536
));
...
@@ -1645,6 +1598,7 @@ disconnect b;
...
@@ -1645,6 +1598,7 @@ disconnect b;
set
foreign_key_checks
=
0
;
set
foreign_key_checks
=
0
;
create
table
t2
(
a
int
primary
key
,
b
int
,
foreign
key
(
b
)
references
t1
(
a
))
engine
=
innodb
;
create
table
t2
(
a
int
primary
key
,
b
int
,
foreign
key
(
b
)
references
t1
(
a
))
engine
=
innodb
;
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
error
1005
--
error
1005
create
table
t1
(
a
char
(
10
)
primary
key
,
b
varchar
(
20
))
engine
=
innodb
;
create
table
t1
(
a
char
(
10
)
primary
key
,
b
varchar
(
20
))
engine
=
innodb
;
...
@@ -1656,6 +1610,7 @@ drop table t2;
...
@@ -1656,6 +1610,7 @@ drop table t2;
set
foreign_key_checks
=
0
;
set
foreign_key_checks
=
0
;
create
table
t1
(
a
varchar
(
10
)
primary
key
)
engine
=
innodb
DEFAULT
CHARSET
=
latin1
;
create
table
t1
(
a
varchar
(
10
)
primary
key
)
engine
=
innodb
DEFAULT
CHARSET
=
latin1
;
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
error
1005
--
error
1005
create
table
t2
(
a
varchar
(
10
),
foreign
key
(
a
)
references
t1
(
a
))
engine
=
innodb
DEFAULT
CHARSET
=
utf8
;
create
table
t2
(
a
varchar
(
10
),
foreign
key
(
a
)
references
t1
(
a
))
engine
=
innodb
DEFAULT
CHARSET
=
utf8
;
...
@@ -1686,6 +1641,7 @@ drop table t2,t1;
...
@@ -1686,6 +1641,7 @@ drop table t2,t1;
set
foreign_key_checks
=
0
;
set
foreign_key_checks
=
0
;
create
table
t2
(
a
varchar
(
10
),
foreign
key
(
a
)
references
t1
(
a
))
engine
=
innodb
DEFAULT
CHARSET
=
latin1
;
create
table
t2
(
a
varchar
(
10
),
foreign
key
(
a
)
references
t1
(
a
))
engine
=
innodb
DEFAULT
CHARSET
=
latin1
;
create
table
t3
(
a
varchar
(
10
)
primary
key
)
engine
=
innodb
DEFAULT
CHARSET
=
utf8
;
create
table
t3
(
a
varchar
(
10
)
primary
key
)
engine
=
innodb
DEFAULT
CHARSET
=
utf8
;
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
error
1025
--
error
1025
rename
table
t3
to
t1
;
rename
table
t3
to
t1
;
...
@@ -2311,7 +2267,10 @@ CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
...
@@ -2311,7 +2267,10 @@ CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
1
);
ALTER
TABLE
t2
ADD
FOREIGN
KEY
(
a
)
REFERENCES
t1
(
a
)
ON
DELETE
SET
NULL
;
ALTER
TABLE
t2
ADD
FOREIGN
KEY
(
a
)
REFERENCES
t1
(
a
)
ON
DELETE
SET
NULL
;
--
replace_regex
/
'\.\/test\/#sql-[0-9a-f_]*'
/
'#sql-temporary'
/
# mysqltest first does replace_regex, then replace_result
--
replace_regex
/
'[^'
]
*
test
\
/
#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
master
-
data
/
''
--
error
1025
--
error
1025
ALTER
TABLE
t2
MODIFY
a
INT
NOT
NULL
;
ALTER
TABLE
t2
MODIFY
a
INT
NOT
NULL
;
DELETE
FROM
t1
;
DELETE
FROM
t1
;
...
...
sql/sql_table.cc
View file @
fa9bacb2
...
@@ -157,6 +157,7 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
...
@@ -157,6 +157,7 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
SYNOPSIS
SYNOPSIS
build_table_filename()
build_table_filename()
buff Where to write result in my_charset_filename.
buff Where to write result in my_charset_filename.
This may be the same as table_name.
bufflen buff size
bufflen buff size
db Database name in system_charset_info.
db Database name in system_charset_info.
table_name Table name in system_charset_info.
table_name Table name in system_charset_info.
...
@@ -186,10 +187,11 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
...
@@ -186,10 +187,11 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
uint
build_table_filename
(
char
*
buff
,
size_t
bufflen
,
const
char
*
db
,
uint
build_table_filename
(
char
*
buff
,
size_t
bufflen
,
const
char
*
db
,
const
char
*
table_name
,
const
char
*
ext
,
uint
flags
)
const
char
*
table_name
,
const
char
*
ext
,
uint
flags
)
{
{
uint
length
;
char
dbbuff
[
FN_REFLEN
];
char
dbbuff
[
FN_REFLEN
];
char
tbbuff
[
FN_REFLEN
];
char
tbbuff
[
FN_REFLEN
];
DBUG_ENTER
(
"build_table_filename"
);
DBUG_ENTER
(
"build_table_filename"
);
DBUG_PRINT
(
"enter"
,
(
"db: '%s' table_name: '%s' ext: '%s' flags: %x"
,
db
,
table_name
,
ext
,
flags
));
if
(
flags
&
FN_IS_TMP
)
// FN_FROM_IS_TMP | FN_TO_IS_TMP
if
(
flags
&
FN_IS_TMP
)
// FN_FROM_IS_TMP | FN_TO_IS_TMP
strnmov
(
tbbuff
,
table_name
,
sizeof
(
tbbuff
));
strnmov
(
tbbuff
,
table_name
,
sizeof
(
tbbuff
));
...
@@ -197,10 +199,18 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
...
@@ -197,10 +199,18 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
VOID
(
tablename_to_filename
(
table_name
,
tbbuff
,
sizeof
(
tbbuff
)));
VOID
(
tablename_to_filename
(
table_name
,
tbbuff
,
sizeof
(
tbbuff
)));
VOID
(
tablename_to_filename
(
db
,
dbbuff
,
sizeof
(
dbbuff
)));
VOID
(
tablename_to_filename
(
db
,
dbbuff
,
sizeof
(
dbbuff
)));
length
=
strxnmov
(
buff
,
bufflen
,
mysql_data_home
,
FN_ROOTDIR
,
dbbuff
,
FN_ROOTDIR
,
tbbuff
,
ext
,
NullS
)
-
buff
;
char
*
end
=
buff
+
bufflen
;
/* Don't add FN_ROOTDIR if mysql_data_home already includes it */
char
*
pos
=
strnmov
(
buff
,
mysql_data_home
,
bufflen
);
int
rootdir_len
=
strlen
(
FN_ROOTDIR
);
if
(
pos
-
rootdir_len
>=
buff
&&
memcmp
(
pos
-
rootdir_len
,
FN_ROOTDIR
,
rootdir_len
)
!=
0
)
pos
=
strnmov
(
pos
,
FN_ROOTDIR
,
end
-
pos
);
pos
=
strxnmov
(
pos
,
end
-
pos
,
dbbuff
,
FN_ROOTDIR
,
tbbuff
,
ext
,
NullS
);
DBUG_PRINT
(
"exit"
,
(
"buff: '%s'"
,
buff
));
DBUG_PRINT
(
"exit"
,
(
"buff: '%s'"
,
buff
));
DBUG_RETURN
(
length
);
DBUG_RETURN
(
pos
-
buff
);
}
}
...
...
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