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
bbe64166
Commit
bbe64166
authored
Mar 10, 2020
by
Sachin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
States reduced
parent
bb91facb
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
7525 deletions
+112
-7525
mysql-test/suite/rpl/include/start_alter_include.test
mysql-test/suite/rpl/include/start_alter_include.test
+14
-14
mysql-test/suite/rpl/r/rpl_start_alter.result
mysql-test/suite/rpl/r/rpl_start_alter.result
+23
-7477
mysql-test/suite/rpl/r/rpl_start_alter_shutdown_1.result
mysql-test/suite/rpl/r/rpl_start_alter_shutdown_1.result
+58
-0
mysql-test/suite/rpl/t/rpl_start_alter.test
mysql-test/suite/rpl/t/rpl_start_alter.test
+1
-1
mysql-test/suite/rpl/t/rpl_start_alter_shutdown_1.test
mysql-test/suite/rpl/t/rpl_start_alter_shutdown_1.test
+1
-4
sql/rpl_mi.h
sql/rpl_mi.h
+1
-3
sql/slave.cc
sql/slave.cc
+8
-4
sql/sql_table.cc
sql/sql_table.cc
+6
-22
No files found.
mysql-test/suite/rpl/include/start_alter_include.test
View file @
bbe64166
...
...
@@ -10,12 +10,12 @@ insert into t1 values(1,1, NULL);
--
error
ER_DUP_ENTRY
alter
table
t1
change
a
a
int
unique
;
--
sync_slave_with_master
source
include
/
show_binlog_events
.
inc
;
#
source include/show_binlog_events.inc;
show
create
table
t1
;
--
connection
master
drop
table
t1
;
--
sync_slave_with_master
--
source
include
/
reset_master_slave_binlog
.
inc
#
--source include/reset_master_slave_binlog.inc
--
echo
# Innodb
--
connection
master
...
...
@@ -29,12 +29,12 @@ insert into t1 values(1,1, NULL);
--
error
ER_DUP_ENTRY
alter
table
t1
change
a
a
int
unique
;
--
sync_slave_with_master
source
include
/
show_binlog_events
.
inc
;
#
source include/show_binlog_events.inc;
show
create
table
t1
;
--
connection
master
drop
table
t1
;
--
sync_slave_with_master
--
source
include
/
reset_master_slave_binlog
.
inc
#
--source include/reset_master_slave_binlog.inc
--
echo
# Aria
...
...
@@ -49,12 +49,12 @@ insert into t1 values(1,1, NULL);
--
error
ER_DUP_ENTRY
alter
table
t1
change
a
a
int
unique
;
--
sync_slave_with_master
source
include
/
show_binlog_events
.
inc
;
#
source include/show_binlog_events.inc;
show
create
table
t1
;
--
connection
master
drop
table
t1
;
--
sync_slave_with_master
--
source
include
/
reset_master_slave_binlog
.
inc
#
--source include/reset_master_slave_binlog.inc
--
connection
master
--
echo
#concurrent alter Myisam
...
...
@@ -62,8 +62,8 @@ drop table t1;
--
let
$alter_algorithm
=
copy
--
source
include
/
start_alter_concurrent
.
test
--
sync_slave_with_master
source
include
/
show_binlog_events
.
inc
;
--
source
include
/
reset_master_slave_binlog
.
inc
#
source include/show_binlog_events.inc;
#
--source include/reset_master_slave_binlog.inc
--
connection
master
--
echo
#concurrent alter Aria
...
...
@@ -71,8 +71,8 @@ source include/show_binlog_events.inc;
--
let
$alter_algorithm
=
copy
--
source
include
/
start_alter_concurrent
.
test
--
sync_slave_with_master
source
include
/
show_binlog_events
.
inc
;
--
source
include
/
reset_master_slave_binlog
.
inc
#
source include/show_binlog_events.inc;
#
--source include/reset_master_slave_binlog.inc
--
connection
master
--
echo
#concurrent alter Innodb copy
...
...
@@ -80,8 +80,8 @@ source include/show_binlog_events.inc;
--
let
$alter_algorithm
=
copy
--
source
include
/
start_alter_concurrent
.
test
--
sync_slave_with_master
source
include
/
show_binlog_events
.
inc
;
--
source
include
/
reset_master_slave_binlog
.
inc
#
source include/show_binlog_events.inc;
#
--source include/reset_master_slave_binlog.inc
--
connection
master
--
echo
#concurrent alter Innodb Inplace
...
...
@@ -89,5 +89,5 @@ source include/show_binlog_events.inc;
--
let
$alter_algorithm
=
inplace
--
source
include
/
start_alter_concurrent
.
test
--
sync_slave_with_master
source
include
/
show_binlog_events
.
inc
;
--
source
include
/
reset_master_slave_binlog
.
inc
#
source include/show_binlog_events.inc;
#
--source include/reset_master_slave_binlog.inc
mysql-test/suite/rpl/r/rpl_start_alter.result
View file @
bbe64166
This diff is collapsed.
Click to expand it.
mysql-test/suite/rpl/r/rpl_start_alter_shutdown_1.result
0 → 100644
View file @
bbe64166
include/master-slave.inc
[connection master]
connection slave;
SET @old_debug_slave= @@global.debug;
set global debug_dbug="+d,start_alter_delay_slave";
stop slave;
SET GLOBAL slave_parallel_threads=10;
set global slave_parallel_mode=optimistic;
start slave;
connection master;
SET @old_debug_master= @@global.debug;
set global debug_dbug="+d,start_alter_delay_master";
set global binlog_split_alter=true;
create table t1( a int primary key, b int) engine=myisam;
create table t2( a int primary key, b int) engine=myisam;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
alter table t1 add column c int;;
connection con2;
alter table t2 add column c int;;
connection slave;
select master_gtid_wait('0-1-4');
master_gtid_wait('0-1-4')
0
select @@gtid_binlog_state;
@@gtid_binlog_state
0-1-4
select @@gtid_slave_pos;
@@gtid_slave_pos
0-1-4
include/stop_slave.inc
connection con1;
connection con2;
create table t3( a int primary key, b int) engine=innodb;
connection slave;
include/start_slave.inc
connection master;
connection slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
connection master;
SET GLOBAL debug_dbug= @old_debug_master;
drop table t1,t2,t3;
set global binlog_split_alter= false;
connection slave;
SET GLOBAL debug_dbug= @old_debug_slave;
stop slave;
SET GLOBAL slave_parallel_threads=0;
set global slave_parallel_mode=conservative;
start slave;
include/rpl_end.inc
mysql-test/suite/rpl/t/rpl_start_alter.test
View file @
bbe64166
--
source
include
/
have_
binlog_format_row
.
inc
--
source
include
/
have_
log_bin
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
master
-
slave
.
inc
--
source
include
/
have_debug
.
inc
...
...
mysql-test/suite/rpl/t/rpl_start_alter_shutdown_1.test
View file @
bbe64166
--
source
include
/
have_
binlog_format_row
.
inc
--
source
include
/
have_
log_bin
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
master
-
slave
.
inc
--
source
include
/
have_debug
.
inc
...
...
@@ -33,8 +33,6 @@ connect (con2,localhost,root,,);
select
master_gtid_wait
(
'0-1-4'
);
select
@@
gtid_binlog_state
;
select
@@
gtid_slave_pos
;
#--let $rpl_server_number= 2
#--source include/rpl_stop_server.inc
--
source
include
/
stop_slave
.
inc
--
connection
con1
...
...
@@ -48,7 +46,6 @@ create table t3( a int primary key, b int) engine=innodb;
--
connection
master
--
sync_slave_with_master
show
create
table
t1
;
show
binlog
events
;
--
connection
master
...
...
sql/rpl_mi.h
View file @
bbe64166
...
...
@@ -151,9 +151,7 @@ enum start_alter_state
REGISTERED
=
0
,
// Start Alter exist, Default state
COMMIT_ALTER
,
// COMMIT the alter
ROLLBACK_ALTER
,
// Rollback the alter
COMMITTED
,
// COMMIT/ROLLBACK Alter written in binlog
SHUTDOWN_RECIEVED
,
//Got shutdown in between
SHUTDOWN_COMPLETED
//Shutdown formalities done on spawned thd side
COMMITTED
// COMMIT/ROLLBACK Alter written in binlog
};
struct
start_alter_info
{
...
...
sql/slave.cc
View file @
bbe64166
...
...
@@ -5763,14 +5763,18 @@ pthread_handler_t handle_slave_sql(void *arg)
List_iterator
<
start_alter_info
>
info_iterator
(
mi
->
start_alter_list
);
while
((
info
=
info_iterator
++
))
{
info
->
state
=
start_alter_state
::
SHUTDOWN_RECIEVED
;
mysql_mutex_lock
(
&
mi
->
start_alter_lock
);
info
->
state
=
start_alter_state
::
ROLLBACK_ALTER
;
mysql_cond_broadcast
(
&
info
->
start_alter_cond
);
mysql_mutex_unlock
(
&
mi
->
start_alter_lock
);
mysql_mutex_lock
(
&
mi
->
start_alter_lock
);
while
(
info
->
state
==
start_alter_state
::
SHUTDOWN_RECIEVED
)
while
(
info
->
state
==
start_alter_state
::
ROLLBACK_ALTER
)
mysql_cond_wait
(
&
info
->
start_alter_cond
,
&
mi
->
start_alter_lock
);
DBUG_ASSERT
(
info
->
state
==
start_alter_state
::
SHUTDOWN_COMPLETED
);
info_iterator
.
remove
();
mysql_mutex_unlock
(
&
mi
->
start_alter_lock
);
DBUG_ASSERT
(
info
->
state
==
start_alter_state
::
COMMITTED
);
info_iterator
.
remove
();
mysql_cond_destroy
(
&
info
->
start_alter_cond
);
my_free
(
info
);
}
/* When master_pos_wait() wakes up it will check this and terminate */
rli
->
slave_running
=
MYSQL_SLAVE_NOT_RUN
;
...
...
sql/sql_table.cc
View file @
bbe64166
...
...
@@ -84,7 +84,6 @@ static bool write_start_alter(THD *thd, bool* partial_alter, start_alter_info *i
static
void
wait_for_master
(
THD
*
thd
,
start_alter_info
*
info
);
static
int
master_result
(
THD
*
thd
,
Master_info
*
mi
,
start_alter_info
*
info
,
int
alter_result
);
static
void
mark_shutdown
(
start_alter_info
*
info
,
Master_info
*
mi
);
/**
@brief Helper function for explain_filename
...
...
@@ -9415,20 +9414,10 @@ static int master_result(THD *thd, Master_info *mi, start_alter_info *info,
thd
->
is_slave_error
=
1
;
return
MASTER_RESULT_COMMIT_ERROR
;
}
else
if
(
info
->
state
==
start_alter_state
::
SHUTDOWN_RECIEVED
)
return
MASTER_RESULT_SHUTDOWN
;
DBUG_ASSERT
(
info
->
state
==
start_alter_state
::
COMMIT_ALTER
&&
!
alter_result
);
return
0
;
}
static
void
mark_shutdown
(
start_alter_info
*
info
,
Master_info
*
mi
)
{
mysql_mutex_lock
(
&
mi
->
start_alter_lock
);
info
->
state
=
start_alter_state
::
SHUTDOWN_COMPLETED
;
mysql_mutex_unlock
(
&
mi
->
start_alter_lock
);
mysql_cond_broadcast
(
&
info
->
start_alter_cond
);
}
static
bool
write_start_alter
(
THD
*
thd
,
bool
*
partial_alter
,
start_alter_info
*
info
)
{
//No need to write start alter , It must be already written
...
...
@@ -9445,7 +9434,7 @@ static bool write_start_alter(THD *thd, bool* partial_alter, start_alter_info *i
mysql_mutex_unlock
(
&
mi
->
start_alter_list_lock
);
mysql_cond_broadcast
(
&
mi
->
start_alter_list_cond
);
DBUG_EXECUTE_IF
(
"start_alter_delay_slave"
,
{
my_sleep
(
10
000000
);
my_sleep
(
5
000000
);
});
if
(
thd
->
slave_shutdown
)
return
true
;
...
...
@@ -9460,7 +9449,7 @@ static bool write_start_alter(THD *thd, bool* partial_alter, start_alter_info *i
return
true
;
*
partial_alter
=
true
;
DBUG_EXECUTE_IF
(
"start_alter_delay_master"
,
{
my_sleep
(
10
000000
);
my_sleep
(
5
000000
);
});
return
false
;
}
...
...
@@ -10402,8 +10391,7 @@ do_continue:;
{
DBUG_ASSERT
(
thd
->
slave_thread
);
wait_for_master
(
thd
,
info
);
if
(
info
->
state
==
start_alter_state
::
ROLLBACK_ALTER
||
info
->
state
==
start_alter_state
::
SHUTDOWN_RECIEVED
)
if
(
info
->
state
==
start_alter_state
::
ROLLBACK_ALTER
)
goto
err_new_table_cleanup
;
}
/* Close lock if this is a transactional table */
...
...
@@ -10470,8 +10458,7 @@ do_continue:;
{
DBUG_ASSERT
(
thd
->
slave_thread
);
wait_for_master
(
thd
,
info
);
if
(
info
->
state
==
start_alter_state
::
ROLLBACK_ALTER
||
info
->
state
==
start_alter_state
::
SHUTDOWN_RECIEVED
)
if
(
info
->
state
==
start_alter_state
::
ROLLBACK_ALTER
)
goto
err_new_table_cleanup
;
}
engine_changed
=
((
new_table
->
file
->
ht
!=
table
->
file
->
ht
)
&&
...
...
@@ -10706,11 +10693,8 @@ do_continue:;
alter_ctx
.
get_tmp_path
());
//STODO
if
(
thd
->
start_alter_id
&&
!
thd
->
direct_commit_alter
)
{
if
(
master_result
(
thd
,
mi
,
info
,
1
)
==
MASTER_RESULT_SHUTDOWN
)
mark_shutdown
(
info
,
mi
);
}
else
master_result
(
thd
,
mi
,
info
,
1
);
else
if
(
opt_binlog_split_alter
)
{
thd
->
gtid_flags3
|=
Gtid_log_event
::
FL_ROLLBACK_ALTER_E1
;
sprintf
(
send_query
,
"/*!100001 %s */"
,
thd
->
query
());
...
...
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