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
bdbd3573
Commit
bdbd3573
authored
Jul 04, 2022
by
Nikita Malyavin
Committed by
Sergei Golubchik
Aug 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify rgi->get_table_data call
parent
b8c5f94b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
18 deletions
+30
-18
sql/rpl_record.cc
sql/rpl_record.cc
+8
-9
sql/rpl_rli.h
sql/rpl_rli.h
+22
-9
No files found.
sql/rpl_record.cc
View file @
bdbd3573
...
...
@@ -223,12 +223,10 @@ int unpack_row(rpl_group_info *rgi, TABLE *table, uint const colcnt,
// The "current" null bits
unsigned
int
null_bits
=
*
null_ptr
++
;
uint
i
=
0
;
table_def
*
tabledef
=
NULL
;
TABLE
*
conv_table
=
NULL
;
const
Copy_field
*
copy_fields
;
const
Copy_field
*
copy_fields_end
;
bool
table_found
=
rgi
&&
rgi
->
get_table_data
(
table
,
&
tabledef
,
&
conv_table
,
&
copy_fields
,
&
copy_fields_end
);
Rpl_table_data
rpl_data
{};
bool
table_found
=
rgi
&&
rgi
->
get_table_data
(
table
,
&
rpl_data
);
const
table_def
*
tabledef
=
rpl_data
.
tabledef
;
const
TABLE
*
conv_table
=
rpl_data
.
conv_table
;
DBUG_PRINT
(
"debug"
,
(
"Table data: table_found: %d, tabldef: %p, conv_table: %p"
,
table_found
,
tabledef
,
conv_table
));
DBUG_ASSERT
(
table_found
);
...
...
@@ -350,7 +348,7 @@ int unpack_row(rpl_group_info *rgi, TABLE *table, uint const colcnt,
If copy_fields is set, it means we are doing an online alter table,
and will use copy_fields set up in copy_data_between_tables
*/
if
(
conv_field
&&
!
copy_fields
)
if
(
conv_field
&&
!
rpl_data
.
is_online_alter
()
)
{
Copy_field
copy
;
#ifndef DBUG_OFF
...
...
@@ -382,9 +380,10 @@ int unpack_row(rpl_group_info *rgi, TABLE *table, uint const colcnt,
i
++
;
}
if
(
copy_fields
)
if
(
rpl_data
.
is_online_alter
()
)
{
for
(
const
auto
*
copy
=
copy_fields
;
copy
!=
copy_fields_end
;
copy
++
)
for
(
const
auto
*
copy
=
rpl_data
.
copy_fields
;
copy
!=
rpl_data
.
copy_fields_end
;
copy
++
)
{
copy
->
do_copy
(
copy
);
}
...
...
sql/rpl_rli.h
View file @
bdbd3573
...
...
@@ -669,6 +669,23 @@ struct start_alter_info
mysql_cond_t
start_alter_cond
;
};
struct
Rpl_table_data
{
const
table_def
*
tabledef
;
TABLE
*
conv_table
;
const
Copy_field
*
copy_fields
;
const
Copy_field
*
copy_fields_end
;
Rpl_table_data
&
operator
=
(
const
RPL_TABLE_LIST
&
rpl_table_list
)
{
tabledef
=
&
rpl_table_list
.
m_tabledef
;
conv_table
=
rpl_table_list
.
m_conv_table
;
copy_fields
=
rpl_table_list
.
m_online_alter_copy_fields
;
copy_fields_end
=
rpl_table_list
.
m_online_alter_copy_fields_end
;
return
*
this
;
}
bool
is_online_alter
()
const
{
return
copy_fields
!=
NULL
;
}
};
/*
This is data for various state needed to be kept for the processing of
one event group (transaction) during replication.
...
...
@@ -941,24 +958,20 @@ struct rpl_group_info
}
}
bool
get_table_data
(
TABLE
*
table_arg
,
table_def
**
tabledef_var
,
TABLE
**
conv_table_var
,
const
Copy_field
*
copy
[],
const
Copy_field
**
copy_end
)
const
bool
get_table_data
(
const
TABLE
*
table_arg
,
Rpl_table_data
*
table_data
)
const
{
DBUG_ASSERT
(
table
def_var
&&
conv_table_var
);
DBUG_ASSERT
(
table
_data
);
for
(
TABLE_LIST
*
ptr
=
tables_to_lock
;
ptr
!=
NULL
;
ptr
=
ptr
->
next_global
)
if
(
ptr
->
table
==
table_arg
)
{
auto
*
rpl_table_list
=
static_cast
<
RPL_TABLE_LIST
*>
(
ptr
);
DBUG_ASSERT
(
rpl_table_list
->
m_tabledef_valid
);
*
tabledef_var
=
&
rpl_table_list
->
m_tabledef
;
*
conv_table_var
=
rpl_table_list
->
m_conv_table
;
*
copy
=
rpl_table_list
->
m_online_alter_copy_fields
;
*
copy_end
=
rpl_table_list
->
m_online_alter_copy_fields_end
;
*
table_data
=
*
rpl_table_list
;
DBUG_PRINT
(
"debug"
,
(
"Fetching table data for table %s.%s:"
" tabledef: %p, conv_table: %p"
,
table_arg
->
s
->
db
.
str
,
table_arg
->
s
->
table_name
.
str
,
*
tabledef_var
,
*
conv_table_var
));
table_data
->
tabledef
,
table_data
->
conv_table
));
return
true
;
}
return
false
;
...
...
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