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
32c3d775
Commit
32c3d775
authored
May 31, 2022
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Online alter: set read_set early, before row reads
also * don't modify write_set * backup/restore rpl_write_set
parent
df0771c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
sql/handler.cc
sql/handler.cc
+6
-3
sql/table.cc
sql/table.cc
+23
-1
No files found.
sql/handler.cc
View file @
32c3d775
...
...
@@ -7272,14 +7272,17 @@ static int binlog_log_row_online_alter(TABLE* table,
trans_register_ha
(
thd
,
true
,
binlog_hton
,
0
);
}
// We need to log all columns for the case if alter table changes primary key.
table
->
use_all_columns
();
bitmap_set_all
(
table
->
rpl_write_set
);
// We need to log all columns for the case if alter table changes primary key
DBUG_ASSERT
(
!
before_record
||
bitmap_is_set_all
(
table
->
read_set
));
MY_BITMAP
*
old_rpl_write_set
=
table
->
rpl_write_set
;
table
->
rpl_write_set
=
&
table
->
s
->
all_set
;
int
error
=
(
*
log_func
)(
thd
,
table
,
table
->
s
->
online_alter_binlog
,
table
->
online_alter_cache
,
has_trans
,
before_record
,
after_record
);
table
->
rpl_write_set
=
old_rpl_write_set
;
return
unlikely
(
error
)
?
HA_ERR_RBR_LOGGING_FAILED
:
0
;
}
#endif // HAVE_REPLICATION
...
...
sql/table.cc
View file @
32c3d775
...
...
@@ -7681,6 +7681,17 @@ void TABLE::mark_columns_needed_for_delete()
bitmap_set_bit
(
write_set
,
s
->
vers
.
end_fieldno
);
need_signal
=
true
;
}
#ifdef HAVE_REPLICATION
if
(
s
->
online_alter_binlog
)
{
/*
For online alter we have to read all columns, because we need PK columns
in the row event, and we don't know what columns will be in PK after ALTER
*/
bitmap_set_all
(
read_set
);
need_signal
=
true
;
}
#endif
if
(
need_signal
)
file
->
column_bitmaps_signal
();
...
...
@@ -7767,9 +7778,20 @@ void TABLE::mark_columns_needed_for_update()
For System Versioning we have to read all columns since we store
a copy of previous row with modified row_end back to a table.
*/
bitmap_
union
(
read_set
,
&
s
->
all
_set
);
bitmap_
set_all
(
read
_set
);
need_signal
=
true
;
}
#ifdef HAVE_REPLICATION
if
(
s
->
online_alter_binlog
)
{
/*
For online alter we have to read all columns, because we need PK columns
in the row event, and we don't know what columns will be in PK after ALTER
*/
bitmap_set_all
(
read_set
);
need_signal
=
true
;
}
#endif
if
(
check_constraints
)
{
mark_check_constraint_columns_for_read
();
...
...
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