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
f2222a1e
Commit
f2222a1e
authored
Nov 20, 2007
by
skozlov/ksm@mysql.com/virtop.localdomain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL#3949, second part. Added soft switching of the binlog format (w/o restart a server)
parent
d7f570c0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
231 additions
and
49 deletions
+231
-49
mysql-test/lib/mtr_cases.pl
mysql-test/lib/mtr_cases.pl
+63
-18
mysql-test/lib/mtr_misc.pl
mysql-test/lib/mtr_misc.pl
+29
-0
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+43
-10
mysql-test/r/bdb_notembedded.result
mysql-test/r/bdb_notembedded.result
+35
-0
mysql-test/suite/rpl/r/rpl_invoked_features.result
mysql-test/suite/rpl/r/rpl_invoked_features.result
+12
-12
mysql-test/suite/rpl/t/rpl_invoked_features.test
mysql-test/suite/rpl/t/rpl_invoked_features.test
+8
-8
mysql-test/suite/rpl/t/rpl_misc_functions.test
mysql-test/suite/rpl/t/rpl_misc_functions.test
+1
-0
mysql-test/suite/rpl/t/rpl_session_var.test
mysql-test/suite/rpl/t/rpl_session_var.test
+2
-1
mysql-test/t/bdb_notembedded.test
mysql-test/t/bdb_notembedded.test
+38
-0
No files found.
mysql-test/lib/mtr_cases.pl
View file @
f2222a1e
...
...
@@ -367,6 +367,7 @@ sub collect_one_suite($$)
# ----------------------------------------------------------------------
if
(
$combinations
&&
$begin_index
<=
$#
{
@$cases
})
{
my
$prepared
=
{};
my
$end_index
=
$#
{
@$cases
};
my
$is_copy
;
# Keep original master/slave options
...
...
@@ -397,7 +398,7 @@ sub collect_one_suite($$)
@$new_arr
=
@
{
$orig_opts
[
$idx
]{
$param
}};
$copied_test
->
{
$param
}
=
$new_arr
;
}
elsif
(
$param
=~
/
(comment|combinations)
/
)
elsif
(
$param
=~
/
combinations
/
)
{
$copied_test
->
{
$param
}
=
'';
}
...
...
@@ -415,18 +416,29 @@ sub collect_one_suite($$)
if
(
$comb_opt
=~
/^--binlog-format=.+$/
)
{
my
@opt_pairs
=
split
(
/=/
,
$comb_opt
);
if
(
$test
->
{'
binlog_format
'}
=~
/^$opt_pairs[1]$/
||
$test
->
{'
binlog_format
'}
eq
''
)
if
(
defined
$::used_binlog_format
)
{
$test
->
{'
skip
'}
=
0
;
$test
->
{'
comment
'}
=
'';
if
(
$test
->
{'
binlog_format
'}
ne
$::used_binlog_format
)
{
$test
->
{'
skip
'}
=
1
;
$test
->
{'
comment
'}
=
"
Requiring binlog format
"
.
join
('
or
',
@
{
$test
->
{'
sup_binlog_formats
'}});
}
}
else
{
$test
->
{'
skip
'}
=
1
;
$test
->
{'
comment
'}
=
"
Requiring binlog format '
$test
->{'binlog_format'}'
";;
}
foreach
my
$binlog_format
(
@
{
$test
->
{'
sup_binlog_formats
'}})
{
$test
->
{'
binlog_format
'}
=
$binlog_format
if
(
$binlog_format
eq
$opt_pairs
[
1
]);
}
if
(
defined
$prepared
->
{
$test
->
{'
name
'}
.
'
|
'
.
$test
->
{'
binlog_format
'}}
and
$test
->
{'
skip
'}
ne
1
)
{
$test
->
{'
skip
'}
=
1
;
$test
->
{'
comment
'}
=
"
Test for binlog format '
$test
->{'binlog_format'}' already executed
";
}
}
}
}
$prepared
->
{
$test
->
{'
name
'}
.
'
|
'
.
$test
->
{'
binlog_format
'}}
=
1
;
$test
->
{'
combination
'}
=
$comb_set
;
}
$is_copy
=
1
;
...
...
@@ -524,6 +536,7 @@ sub collect_one_test_case($$$$$$$$$) {
$tinfo
->
{'
slave_opt
'}
=
[]
;
$tinfo
->
{'
slave_mi
'}
=
[]
;
# Add suite opts
foreach
my
$opt
(
@$suite_opts
)
{
...
...
@@ -737,14 +750,43 @@ sub collect_one_test_case($$$$$$$$$) {
return
;
}
if
(
defined
$tinfo
->
{'
binlog_format
'}
and
!
(
$tinfo
->
{'
binlog_format
'}
eq
$::used_binlog_format
)
)
# Replication test needs an adjustment of binlog format
if
(
$tinfo
->
{'
name
'}
=~
/^rpl/
)
{
$tinfo
->
{'
skip
'}
=
1
;
$tinfo
->
{'
comment
'}
=
"
Requiring binlog format '
$tinfo
->{'binlog_format'}'
";
return
;
# Set default binlog format priority
if
(
$tinfo
->
{'
name
'}
=~
/^rpl/
and
!
defined
$tinfo
->
{'
sup_binlog_formats
'})
{
if
(
$::mysql_version_id
>=
50100
)
{
$tinfo
->
{'
sup_binlog_formats
'}
=
["
mixed
",
"
row
",
"
statement
"];
}
else
{
$tinfo
->
{'
sup_binlog_formats
'}
=
["
statement
",
"
row
"];
}
}
# Check that a test supports binlog format defined via --binlog-format
if
(
defined
$::used_binlog_format
)
{
# Try to find a supported binlog formats
foreach
my
$binlog_format
(
@
{
$tinfo
->
{'
sup_binlog_formats
'}})
{
$tinfo
->
{'
binlog_format
'}
=
$binlog_format
unless
(
$binlog_format
ne
$::used_binlog_format
);
}
# Skip a test because
if
(
!
defined
$tinfo
->
{'
binlog_format
'})
{
$tinfo
->
{'
skip
'}
=
1
;
$tinfo
->
{'
comment
'}
=
"
Requiring binlog format
"
.
join
('
or
',
@
{
$tinfo
->
{'
sup_binlog_formats
'}});
return
;
}
}
else
{
$tinfo
->
{'
binlog_format
'}
=
$tinfo
->
{'
sup_binlog_formats
'}
->
[
0
];
}
}
if
(
$tinfo
->
{'
need_debug
'}
&&
!
$::debug_compiled_binaries
)
{
$tinfo
->
{'
skip
'}
=
1
;
...
...
@@ -824,10 +866,13 @@ sub collect_one_test_case($$$$$$$$$) {
our
@tags
=
(
["
include/have_innodb.inc
",
"
innodb_test
",
1
],
["
include/have_binlog_format_row.inc
",
"
binlog_format
",
"
row
"
],
["
include/have_binlog_format_row.inc
",
"
sup_binlog_formats
",
["
row
"]
],
["
include/have_log_bin.inc
",
"
need_binlog
",
1
],
["
include/have_binlog_format_statement.inc
",
"
binlog_format
",
"
statement
"],
["
include/have_binlog_format_mixed.inc
",
"
binlog_format
",
"
mixed
"],
["
include/have_binlog_format_statement.inc
",
"
sup_binlog_formats
",
["
statement
"]],
["
include/have_binlog_format_mixed.inc
",
"
sup_binlog_formats
",
["
mixed
"]],
["
include/have_binlog_format_mixed_or_row.inc
",
"
sup_binlog_formats
",
["
mixed
","
row
"]],
["
include/have_binlog_format_mixed_or_statement.inc
",
"
sup_binlog_formats
",
["
mixed
","
statement
"]],
["
include/have_binlog_format_row_or_statement.inc
",
"
sup_binlog_formats
",
["
row
","
statement
"]],
["
include/big_test.inc
",
"
big_test
",
1
],
["
include/have_debug.inc
",
"
need_debug
",
1
],
["
include/have_ndb.inc
",
"
ndb_test
",
1
],
...
...
@@ -853,8 +898,8 @@ sub mtr_options_from_test_file($$) {
{
if
(
index
(
$line
,
$tag
->
[
0
])
>=
0
)
{
# Tag matched, assign value to "tinfo"
$tinfo
->
{"
$tag
->[1]
"}
=
$tag
->
[
2
];
# Tag matched, assign value to "tinfo"
$tinfo
->
{"
$tag
->[1]
"}
=
$tag
->
[
2
];
}
}
...
...
mysql-test/lib/mtr_misc.pl
View file @
f2222a1e
...
...
@@ -280,4 +280,33 @@ sub mtr_cmp_opts ($$) {
return
0
;
# They are the same
}
#
# Compare two arrays and put all unequal elements into a new one
#
sub
mtr_diff_opts
($$)
{
my
$l1
=
shift
;
my
$l2
=
shift
;
my
$f
;
my
$l
=
[]
;
foreach
my
$e1
(
@$l1
)
{
$f
=
undef
;
foreach
my
$e2
(
@$l2
)
{
$f
=
1
unless
(
$e1
ne
$e2
);
}
push
(
@$l
,
$e1
)
unless
(
defined
$f
);
}
foreach
my
$e2
(
@$l2
)
{
$f
=
undef
;
foreach
my
$e1
(
@$l1
)
{
$f
=
1
unless
(
$e1
ne
$e2
);
}
push
(
@$l
,
$e2
)
unless
(
defined
$f
);
}
return
$l
;
}
1
;
mysql-test/mysql-test-run.pl
View file @
f2222a1e
...
...
@@ -792,20 +792,23 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Find out type of logging that are being used
# --------------------------------------------------------------------------
# NOTE if the default binlog format is changed, this has to be changed
$used_binlog_format
=
"
statement
";
if
(
!
$opt_extern
&&
$mysql_version_id
>=
50100
)
{
$used_binlog_format
=
"
mixed
";
# Default value for binlog format
foreach
my
$arg
(
@opt_extra_mysqld_opt
)
{
if
(
$arg
=~
/binlog[-_]format=(\S+)/
)
{
$used_binlog_format
=
$1
;
$used_binlog_format
=
$1
;
}
}
mtr_report
("
Using binlog format '
$used_binlog_format
'
");
if
(
defined
$used_binlog_format
)
{
mtr_report
("
Using binlog format '
$used_binlog_format
'
");
}
else
{
mtr_report
("
Using dynamic switching of binlog format
");
}
}
...
...
@@ -3304,6 +3307,7 @@ sub run_testcase_check_skip_test($)
sub
do_before_run_mysqltest
($)
{
my
$tinfo
=
shift
;
my
$args
;
# Remove old files produced by mysqltest
my
$base_file
=
mtr_match_extension
(
$tinfo
->
{'
result_file
'},
...
...
@@ -3324,6 +3328,26 @@ sub do_before_run_mysqltest($)
# if script decided to run mysqltest cluster _is_ installed ok
$ENV
{'
NDB_STATUS_OK
'}
=
"
YES
";
}
if
(
defined
$tinfo
->
{"
binlog_format
"}
and
$mysql_version_id
>
50100
)
{
foreach
my
$server
((
@$master
,
@$slave
))
{
if
(
$server
->
{'
pid
'})
{
mtr_init_args
(
\
$args
);
mtr_add_arg
(
$args
,
"
--no-defaults
");
mtr_add_arg
(
$args
,
"
--user=root
");
mtr_add_arg
(
$args
,
"
--port=
$server
->{'port'}
");
mtr_add_arg
(
$args
,
"
--socket=
$server
->{'path_sock'}
");
mtr_run
(
$exe_mysql
,
$args
,
"
$glob_mysql_test_dir
/include/set_binlog_format_
"
.
$tinfo
->
{"
binlog_format
"}
.
"
.inc
",
"",
"",
"",
{});
}
}
}
}
}
...
...
@@ -4218,10 +4242,19 @@ sub run_testcase_need_master_restart($)
elsif
(
!
mtr_same_opts
(
$master
->
[
0
]
->
{'
start_opts
'},
$tinfo
->
{'
master_opt
'})
)
{
$do_restart
=
1
;
mtr_verbose
("
Restart master: running with different options '
"
.
join
("
",
@
{
$tinfo
->
{'
master_opt
'}})
.
"
' != '
"
.
join
("
",
@
{
$master
->
[
0
]
->
{'
start_opts
'}})
.
"
'
"
);
# Chech that diff is binlog format only
my
$diff_opts
=
mtr_diff_opts
(
$master
->
[
0
]
->
{'
start_opts
'},
$tinfo
->
{'
master_opt
'});
if
(
scalar
(
@$diff_opts
)
eq
2
)
{
$do_restart
=
1
unless
(
$diff_opts
->
[
0
]
=~
/^--binlog-format=/
and
$diff_opts
->
[
1
]
=~
/^--binlog-format=/
);
}
else
{
$do_restart
=
1
;
mtr_verbose
("
Restart master: running with different options '
"
.
join
("
",
@
{
$tinfo
->
{'
master_opt
'}})
.
"
' != '
"
.
join
("
",
@
{
$master
->
[
0
]
->
{'
start_opts
'}})
.
"
'
"
);
}
}
elsif
(
!
$master
->
[
0
]
->
{'
pid
'}
)
{
...
...
mysql-test/r/bdb_notembedded.result
0 → 100644
View file @
f2222a1e
set autocommit=1;
reset master;
create table bug16206 (a int);
insert into bug16206 values(1);
start transaction;
insert into bug16206 values(2);
commit;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
f n Query 1 n use `test`; create table bug16206 (a int)
f n Query 1 n use `test`; insert into bug16206 values(1)
f n Query 1 n use `test`; insert into bug16206 values(2)
drop table bug16206;
reset master;
create table bug16206 (a int) engine= bdb;
insert into bug16206 values(0);
insert into bug16206 values(1);
start transaction;
insert into bug16206 values(2);
commit;
insert into bug16206 values(3);
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
f n Query 1 n use `test`; insert into bug16206 values(0)
f n Query 1 n use `test`; insert into bug16206 values(1)
f n Query 1 n use `test`; BEGIN
f n Query 1 n use `test`; insert into bug16206 values(2)
f n Query 1 n use `test`; COMMIT
f n Query 1 n use `test`; insert into bug16206 values(3)
drop table bug16206;
set autocommit=0;
End of 5.0 tests
mysql-test/suite/rpl/r/rpl_invoked_features.result
View file @
f2222a1e
...
...
@@ -116,23 +116,23 @@ t12
t13
t2
t3
SELECT table_name FROM information_schema.views WHERE table_schema='test';
SELECT table_name FROM information_schema.views WHERE table_schema='test'
ORDER BY table_name
;
table_name
v1
v11
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test'
ORDER BY trigger_name
;
trigger_name event_manipulation event_object_table
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test' ORDER BY routine_name;
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
SELECT event_name, status FROM information_schema.events WHERE event_schema='test'
ORDER BY event_name
;
event_name status
e1 DISABLED
e11 DISABLED
...
...
@@ -276,23 +276,23 @@ t12
t13
t2
t3
SELECT table_name FROM information_schema.views WHERE table_schema='test';
SELECT table_name FROM information_schema.views WHERE table_schema='test'
ORDER BY table_name
;
table_name
v1
v11
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test'
ORDER BY trigger_name
;
trigger_name event_manipulation event_object_table
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test' ORDER BY routine_name;
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
SELECT event_name, status FROM information_schema.events WHERE event_schema='test'
ORDER BY event_name
;
event_name status
e1 SLAVESIDE_DISABLED
e11 SLAVESIDE_DISABLED
...
...
mysql-test/suite/rpl/t/rpl_invoked_features.test
View file @
f2222a1e
...
...
@@ -202,10 +202,10 @@ SET GLOBAL EVENT_SCHEDULER = off;
# Check original objects
--
echo
SHOW
TABLES
LIKE
't%'
;
SELECT
table_name
FROM
information_schema
.
views
WHERE
table_schema
=
'test'
;
SELECT
trigger_name
,
event_manipulation
,
event_object_table
FROM
information_schema
.
triggers
WHERE
trigger_schema
=
'test'
;
SELECT
routine_type
,
routine_name
FROM
information_schema
.
routines
WHERE
routine_schema
=
'test'
;
SELECT
event_name
,
status
FROM
information_schema
.
events
WHERE
event_schema
=
'test'
;
SELECT
table_name
FROM
information_schema
.
views
WHERE
table_schema
=
'test'
ORDER
BY
table_name
;
SELECT
trigger_name
,
event_manipulation
,
event_object_table
FROM
information_schema
.
triggers
WHERE
trigger_schema
=
'test'
ORDER
BY
trigger_name
;
SELECT
routine_type
,
routine_name
FROM
information_schema
.
routines
WHERE
routine_schema
=
'test'
ORDER
BY
routine_name
;
SELECT
event_name
,
status
FROM
information_schema
.
events
WHERE
event_schema
=
'test'
ORDER
BY
event_name
;
# Check original data
--
echo
...
...
@@ -229,10 +229,10 @@ SELECT a,b FROM v11 ORDER BY a;
# Check replicated objects
--
echo
SHOW
TABLES
LIKE
't%'
;
SELECT
table_name
FROM
information_schema
.
views
WHERE
table_schema
=
'test'
;
SELECT
trigger_name
,
event_manipulation
,
event_object_table
FROM
information_schema
.
triggers
WHERE
trigger_schema
=
'test'
;
SELECT
routine_type
,
routine_name
FROM
information_schema
.
routines
WHERE
routine_schema
=
'test'
;
SELECT
event_name
,
status
FROM
information_schema
.
events
WHERE
event_schema
=
'test'
;
SELECT
table_name
FROM
information_schema
.
views
WHERE
table_schema
=
'test'
ORDER
BY
table_name
;
SELECT
trigger_name
,
event_manipulation
,
event_object_table
FROM
information_schema
.
triggers
WHERE
trigger_schema
=
'test'
ORDER
BY
trigger_name
;
SELECT
routine_type
,
routine_name
FROM
information_schema
.
routines
WHERE
routine_schema
=
'test'
ORDER
BY
routine_name
;
SELECT
event_name
,
status
FROM
information_schema
.
events
WHERE
event_schema
=
'test'
ORDER
BY
event_name
;
# Check replicated data
--
echo
...
...
mysql-test/suite/rpl/t/rpl_misc_functions.test
View file @
f2222a1e
...
...
@@ -109,6 +109,7 @@ DROP TABLE t1, t1_slave;
DROP
PROCEDURE
test_replication_sp1
;
DROP
PROCEDURE
test_replication_sp2
;
DROP
FUNCTION
test_replication_sf
;
--
remove_file
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
rpl_misc_functions
.
outfile
--
sync_slave_with_master
mysql-test/suite/rpl/t/rpl_session_var.test
View file @
f2222a1e
...
...
@@ -51,8 +51,9 @@ CREATE TABLE t1 (
`data`
varchar
(
100
),
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
MyISAM
;
--
disable_warnings
INSERT
INTO
t1
(
data
)
VALUES
(
SESSION_USER
());
--
enable_warnings
save_master_pos
;
connection
slave
;
sync_with_master
;
...
...
mysql-test/t/bdb_notembedded.test
0 → 100644
View file @
f2222a1e
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_bdb
.
inc
#
# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
#
set
autocommit
=
1
;
let
$VERSION
=
`select version()`
;
reset
master
;
create
table
bug16206
(
a
int
);
insert
into
bug16206
values
(
1
);
start
transaction
;
insert
into
bug16206
values
(
2
);
commit
;
--
replace_result
$VERSION
VERSION
--
replace_column
1
f
2
n
5
n
show
binlog
events
;
drop
table
bug16206
;
reset
master
;
create
table
bug16206
(
a
int
)
engine
=
bdb
;
insert
into
bug16206
values
(
0
);
insert
into
bug16206
values
(
1
);
start
transaction
;
insert
into
bug16206
values
(
2
);
commit
;
insert
into
bug16206
values
(
3
);
--
replace_result
$VERSION
VERSION
--
replace_column
1
f
2
n
5
n
show
binlog
events
;
drop
table
bug16206
;
set
autocommit
=
0
;
--
echo
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