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
c003b362
Commit
c003b362
authored
Jun 22, 2020
by
Sachin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-22777 Assertion `thd->rgi_slave' failed in process_commit_alter / process_rollback_alte
parent
148a4e38
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
44 deletions
+63
-44
sql/share/errmsg-utf8.txt
sql/share/errmsg-utf8.txt
+2
-0
sql/sql_alter.cc
sql/sql_alter.cc
+61
-44
No files found.
sql/share/errmsg-utf8.txt
View file @
c003b362
...
@@ -7943,3 +7943,5 @@ ER_WARN_HISTORY_ROW_START_TIME
...
@@ -7943,3 +7943,5 @@ ER_WARN_HISTORY_ROW_START_TIME
eng "Table `%s.%s` history row start '%s' is later than row end '%s'"
eng "Table `%s.%s` history row start '%s' is later than row end '%s'"
ER_PART_STARTS_BEYOND_INTERVAL
ER_PART_STARTS_BEYOND_INTERVAL
eng "%`s: STARTS is later than query time, first history partition may exceed INTERVAL value"
eng "%`s: STARTS is later than query time, first history partition may exceed INTERVAL value"
ER_MANUAL_SPLIT_ALTER
eng "Manual splitting of ALTER is not allowed"
sql/sql_alter.cc
View file @
c003b362
...
@@ -394,26 +394,29 @@ static int process_start_alter(THD *thd, uint64 thread_id)
...
@@ -394,26 +394,29 @@ static int process_start_alter(THD *thd, uint64 thread_id)
}
}
static
int
process_commit_alter
(
THD
*
thd
,
uint64
thread_id
)
static
int
process_commit_alter
(
THD
*
thd
,
uint64
thread_id
)
{
{
DBUG_ASSERT
(
thd
->
rgi_slave
);
start_alter_info
*
info
=
NULL
;
Master_info
*
mi
=
NULL
;
// pseudo_slave_mode is ON
if
(
!
thd
->
rgi_slave
)
goto
direct_commit
;
DBUG_EXECUTE_IF
(
"rpl_slave_stop_CA"
,
{
DBUG_EXECUTE_IF
(
"rpl_slave_stop_CA"
,
{
debug_sync_set_action
(
thd
,
debug_sync_set_action
(
thd
,
STRING_WITH_LEN
(
"now signal CA_1_processing WAIT_FOR proceed_CA_1"
));
STRING_WITH_LEN
(
"now signal CA_1_processing WAIT_FOR proceed_CA_1"
));
});
});
thd
->
gtid_flags3
|=
Gtid_log_event
::
FL_START_ALTER_E1
;
thd
->
gtid_flags3
|=
Gtid_log_event
::
FL_START_ALTER_E1
;
Master_info
*
mi
=
thd
->
rgi_slave
->
rli
->
mi
;
mi
=
thd
->
rgi_slave
->
rli
->
mi
;
start_alter_info
*
info
=
NULL
;
uint
count
=
0
;
mysql_mutex_lock
(
&
mi
->
start_alter_list_lock
);
mysql_mutex_lock
(
&
mi
->
start_alter_list_lock
);
{
List_iterator
<
start_alter_info
>
info_iterator
(
mi
->
start_alter_list
);
List_iterator
<
start_alter_info
>
info_iterator
(
mi
->
start_alter_list
);
while
((
info
=
info_iterator
++
))
while
((
info
=
info_iterator
++
))
{
{
count
++
;
if
(
info
->
thread_id
==
thread_id
)
if
(
info
->
thread_id
==
thread_id
)
{
{
info_iterator
.
remove
();
info_iterator
.
remove
();
break
;
break
;
}
}
}
}
}
mysql_mutex_unlock
(
&
mi
->
start_alter_list_lock
);
mysql_mutex_unlock
(
&
mi
->
start_alter_list_lock
);
if
(
!
info
||
info
->
thread_id
!=
thread_id
)
if
(
!
info
||
info
->
thread_id
!=
thread_id
)
{
{
...
@@ -421,10 +424,7 @@ static int process_commit_alter(THD *thd, uint64 thread_id)
...
@@ -421,10 +424,7 @@ static int process_commit_alter(THD *thd, uint64 thread_id)
//direct_commit_alter is used so that mysql_alter_table should not do
//direct_commit_alter is used so that mysql_alter_table should not do
//unnecessary binlogging or spawn new thread because there is no start
//unnecessary binlogging or spawn new thread because there is no start
//alter context
//alter context
thd
->
direct_commit_alter
=
1
;
goto
direct_commit
;
if
(
thd
->
open_temporary_tables
(
thd
->
lex
->
query_tables
))
return
START_ALTER_ERROR
;
return
START_ALTER_PARSE
;
}
}
/*
/*
start_alter_state must be ::REGISTERED
start_alter_state must be ::REGISTERED
...
@@ -446,13 +446,22 @@ static int process_commit_alter(THD *thd, uint64 thread_id)
...
@@ -446,13 +446,22 @@ static int process_commit_alter(THD *thd, uint64 thread_id)
if
(
write_bin_log
(
thd
,
true
,
thd
->
query
(),
thd
->
query_length
()))
if
(
write_bin_log
(
thd
,
true
,
thd
->
query
(),
thd
->
query_length
()))
return
START_ALTER_ERROR
;
return
START_ALTER_ERROR
;
return
START_ALTER_SKIP
;
return
START_ALTER_SKIP
;
direct_commit:
thd
->
direct_commit_alter
=
1
;
if
(
thd
->
open_temporary_tables
(
thd
->
lex
->
query_tables
))
return
START_ALTER_ERROR
;
return
START_ALTER_PARSE
;
}
}
static
int
process_rollback_alter
(
THD
*
thd
,
uint64
thread_id
)
static
int
process_rollback_alter
(
THD
*
thd
,
uint64
thread_id
)
{
{
DBUG_ASSERT
(
thd
->
rgi_slave
);
Master_info
*
mi
=
thd
->
rgi_slave
->
rli
->
mi
;
start_alter_info
*
info
=
NULL
;
start_alter_info
*
info
=
NULL
;
Master_info
*
mi
=
NULL
;
// pseudo_slave_mode is ON
if
(
!
thd
->
rgi_slave
)
goto
write_binlog
;
mi
=
thd
->
rgi_slave
->
rli
->
mi
;
mysql_mutex_lock
(
&
mi
->
start_alter_list_lock
);
mysql_mutex_lock
(
&
mi
->
start_alter_list_lock
);
{
List_iterator
<
start_alter_info
>
info_iterator
(
mi
->
start_alter_list
);
List_iterator
<
start_alter_info
>
info_iterator
(
mi
->
start_alter_list
);
while
((
info
=
info_iterator
++
))
while
((
info
=
info_iterator
++
))
{
{
...
@@ -462,13 +471,12 @@ static int process_rollback_alter(THD *thd, uint64 thread_id)
...
@@ -462,13 +471,12 @@ static int process_rollback_alter(THD *thd, uint64 thread_id)
break
;
break
;
}
}
}
}
}
mysql_mutex_unlock
(
&
mi
->
start_alter_list_lock
);
mysql_mutex_unlock
(
&
mi
->
start_alter_list_lock
);
if
(
!
info
||
info
->
thread_id
!=
thread_id
)
if
(
!
info
||
info
->
thread_id
!=
thread_id
)
{
{
//Just write the binlog because there is nothing to be done
//Just write the binlog because there is nothing to be done
if
(
write_bin_log
(
thd
,
true
,
thd
->
query
(),
thd
->
query_length
()))
goto
write_binlog
;
return
START_ALTER_ERROR
;
return
START_ALTER_SKIP
;
}
}
/*
/*
start_alter_state must be ::REGISTERED
start_alter_state must be ::REGISTERED
...
@@ -487,6 +495,7 @@ static int process_rollback_alter(THD *thd, uint64 thread_id)
...
@@ -487,6 +495,7 @@ static int process_rollback_alter(THD *thd, uint64 thread_id)
mysql_mutex_unlock
(
&
mi
->
start_alter_lock
);
mysql_mutex_unlock
(
&
mi
->
start_alter_lock
);
mysql_cond_destroy
(
&
info
->
start_alter_cond
);
mysql_cond_destroy
(
&
info
->
start_alter_cond
);
my_free
(
info
);
my_free
(
info
);
write_binlog:
if
(
write_bin_log
(
thd
,
true
,
thd
->
query
(),
thd
->
query_length
()))
if
(
write_bin_log
(
thd
,
true
,
thd
->
query
(),
thd
->
query_length
()))
return
START_ALTER_ERROR
;
return
START_ALTER_ERROR
;
return
START_ALTER_SKIP
;
return
START_ALTER_SKIP
;
...
@@ -523,7 +532,6 @@ bool Sql_cmd_alter_table::execute(THD *thd)
...
@@ -523,7 +532,6 @@ bool Sql_cmd_alter_table::execute(THD *thd)
ulong
priv
=
0
;
ulong
priv
=
0
;
ulong
priv_needed
=
ALTER_ACL
;
ulong
priv_needed
=
ALTER_ACL
;
bool
result
;
bool
result
;
int
alter_res
=
0
;
DBUG_ENTER
(
"Sql_cmd_alter_table::execute"
);
DBUG_ENTER
(
"Sql_cmd_alter_table::execute"
);
...
@@ -644,7 +652,17 @@ bool Sql_cmd_alter_table::execute(THD *thd)
...
@@ -644,7 +652,17 @@ bool Sql_cmd_alter_table::execute(THD *thd)
We will follow a different executation path if it is START ALTER
We will follow a different executation path if it is START ALTER
or commit/rollback alter
or commit/rollback alter
*/
*/
switch
(
alter_info
.
alter_state
)
{
// SA/CA will be processed only if we are slave or in pseduo_slave_mode
if
(
alter_info
.
alter_state
>
Alter_info
::
ALTER_TABLE_NORMAL
)
{
if
(
!
thd
->
slave_thread
&&
!
thd
->
variables
.
pseudo_slave_mode
)
{
my_error
(
ER_MANUAL_SPLIT_ALTER
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
int
alter_res
=
0
;
switch
(
alter_info
.
alter_state
)
{
case
Alter_info
:
:
ALTER_TABLE_START
:
case
Alter_info
:
:
ALTER_TABLE_START
:
alter_res
=
process_start_alter
(
thd
,
alter_info
.
alter_identifier
);
alter_res
=
process_start_alter
(
thd
,
alter_info
.
alter_identifier
);
break
;
break
;
...
@@ -654,16 +672,15 @@ bool Sql_cmd_alter_table::execute(THD *thd)
...
@@ -654,16 +672,15 @@ bool Sql_cmd_alter_table::execute(THD *thd)
case
Alter_info
:
:
ALTER_TABLE_ROLLBACK
:
case
Alter_info
:
:
ALTER_TABLE_ROLLBACK
:
alter_res
=
process_rollback_alter
(
thd
,
alter_info
.
alter_identifier
);
alter_res
=
process_rollback_alter
(
thd
,
alter_info
.
alter_identifier
);
break
;
break
;
case
Alter_info
:
:
ALTER_TABLE_NORMAL
:
default:
default:
alter_res
=
START_ALTER_PARSE
;
break
;
break
;
}
}
if
(
alter_res
==
START_ALTER_SKIP
)
if
(
alter_res
==
START_ALTER_SKIP
)
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
FALSE
);
else
if
(
alter_res
==
START_ALTER_ERROR
)
else
if
(
alter_res
==
START_ALTER_ERROR
)
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
// START_ALTER_PARSE -->
result
=
mysql_alter_table
(
thd
,
&
select_lex
->
db
,
&
lex
->
name
,
result
=
mysql_alter_table
(
thd
,
&
select_lex
->
db
,
&
lex
->
name
,
&
create_info
,
&
create_info
,
first_table
,
first_table
,
...
...
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