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
008363e8
Commit
008363e8
authored
Mar 11, 2013
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-26: Global transaction ID.
Add a missing check for correct table definition.
parent
5e414f6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
20 deletions
+24
-20
sql/rpl_gtid.cc
sql/rpl_gtid.cc
+18
-10
sql/rpl_gtid.h
sql/rpl_gtid.h
+3
-1
sql/sql_repl.cc
sql/sql_repl.cc
+3
-9
No files found.
sql/rpl_gtid.cc
View file @
008363e8
...
...
@@ -50,7 +50,8 @@ rpl_slave_state::update_state_hash(uint64 sub_id, rpl_gtid *gtid)
{
sql_print_warning
(
"Slave: Out of memory during slave state maintenance. "
"Some no longer necessary rows in table "
"mysql.rpl_slave_state may be left undeleted."
);
"mysql.%s may be left undeleted."
,
rpl_gtid_slave_state_table_name
.
str
);
/*
Such failure is not fatal. We will fail to delete the row for this
GTID, but it will do no harm and will be removed automatically on next
...
...
@@ -253,6 +254,21 @@ class Gtid_db_intact : public Table_check_intact
static
Gtid_db_intact
gtid_table_intact
;
/*
Check that the mysql.rpl_slave_state table has the correct definition.
*/
int
gtid_check_rpl_slave_state_table
(
TABLE
*
table
)
{
int
err
;
if
((
err
=
gtid_table_intact
.
check
(
table
,
&
mysql_rpl_slave_state_tabledef
)))
my_error
(
ER_GTID_OPEN_TABLE_FAILED
,
MYF
(
0
),
"mysql"
,
rpl_gtid_slave_state_table_name
.
str
);
return
err
;
}
/*
Write a gtid to the replication slave state table.
...
...
@@ -290,22 +306,14 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
table_opened
=
true
;
table
=
tlist
.
table
;
if
((
err
=
gtid_table_intact
.
check
(
table
,
&
mysql_rpl_slave_state_tabledef
)))
{
my_error
(
ER_GTID_OPEN_TABLE_FAILED
,
MYF
(
0
),
"mysql"
,
rpl_gtid_slave_state_table_name
.
str
);
if
((
err
=
gtid_check_rpl_slave_state_table
(
table
)))
goto
end
;
}
table
->
no_replicate
=
1
;
if
(
!
in_transaction
)
thd
->
variables
.
option_bits
&=
~
(
ulonglong
)(
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
);
/*
ToDo: Check the table definition, error if not as expected.
We need the correct first 4 columns with correct type, and the primary key.
*/
bitmap_set_all
(
table
->
write_set
);
table
->
field
[
0
]
->
store
((
ulonglong
)
gtid
->
domain_id
,
true
);
...
...
sql/rpl_gtid.h
View file @
008363e8
...
...
@@ -19,6 +19,8 @@
/* Definitions for MariaDB global transaction ID (GTID). */
extern
const
LEX_STRING
rpl_gtid_slave_state_table_name
;
class
String
;
struct
rpl_gtid
...
...
@@ -165,6 +167,6 @@ struct slave_connection_state
extern
bool
rpl_slave_state_tostring_helper
(
String
*
dest
,
const
rpl_gtid
*
gtid
,
bool
*
first
);
extern
const
LEX_STRING
rpl_gtid_slave_state_table_name
;
extern
int
gtid_check_rpl_slave_state_table
(
TABLE
*
table
)
;
#endif
/* RPL_GTID_H */
sql/sql_repl.cc
View file @
008363e8
...
...
@@ -3076,17 +3076,11 @@ rpl_load_gtid_slave_state(THD *thd)
goto
end
;
table_opened
=
true
;
table
=
tlist
.
table
;
table
->
no_replicate
=
1
;
/*
ToDo: Check the table definition, error if not as expected.
We need the correct first 4 columns with correct type, and the primary key.
*/
if
((
err
=
gtid_check_rpl_slave_state_table
(
table
)))
goto
end
;
bitmap_set_bit
(
table
->
read_set
,
table
->
field
[
0
]
->
field_index
);
bitmap_set_bit
(
table
->
read_set
,
table
->
field
[
1
]
->
field_index
);
bitmap_set_bit
(
table
->
read_set
,
table
->
field
[
2
]
->
field_index
);
bitmap_set_bit
(
table
->
read_set
,
table
->
field
[
3
]
->
field_index
);
bitmap_set_all
(
table
->
read_set
);
if
((
err
=
table
->
file
->
ha_rnd_init_with_error
(
1
)))
goto
end
;
table_scanned
=
true
;
...
...
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