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
0dfbb05c
Commit
0dfbb05c
authored
Mar 04, 2020
by
Nikita Malyavin
Committed by
Sergei Golubchik
Aug 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16329 [1/5] add THD::binlog_get_cache_mngr
parent
f5e50137
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
36 deletions
+28
-36
sql/log.cc
sql/log.cc
+27
-36
sql/sql_class.h
sql/sql_class.h
+1
-0
No files found.
sql/log.cc
View file @
0dfbb05c
...
...
@@ -1763,12 +1763,11 @@ binlog_trans_log_truncate(THD *thd, my_off_t pos)
DBUG_ENTER
(
"binlog_trans_log_truncate"
);
DBUG_PRINT
(
"enter"
,
(
"pos: %lu"
,
(
ulong
)
pos
));
DBUG_ASSERT
(
thd
_get_ha_data
(
thd
,
binlog_hton
)
!=
NULL
);
DBUG_ASSERT
(
thd
->
binlog_get_cache_mngr
(
)
!=
NULL
);
/* Only true if binlog_trans_log_savepos() wasn't called before */
DBUG_ASSERT
(
pos
!=
~
(
my_off_t
)
0
);
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
cache_mngr
->
trx_cache
.
restore_savepoint
(
pos
);
DBUG_VOID_RETURN
;
}
...
...
@@ -1808,8 +1807,7 @@ int binlog_init(void *p)
static
int
binlog_close_connection
(
handlerton
*
hton
,
THD
*
thd
)
{
DBUG_ENTER
(
"binlog_close_connection"
);
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
#ifdef WITH_WSREP
if
(
WSREP
(
thd
)
&&
cache_mngr
&&
!
cache_mngr
->
trx_cache
.
empty
())
{
IO_CACHE
*
cache
=
cache_mngr
->
get_binlog_cache_log
(
true
);
...
...
@@ -2265,8 +2263,7 @@ int binlog_commit(THD *thd, bool all, bool ro_1pc)
PSI_stage_info
org_stage
;
DBUG_ENTER
(
"binlog_commit"
);
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
if
(
!
cache_mngr
)
{
...
...
@@ -2368,8 +2365,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
DBUG_ENTER
(
"binlog_rollback"
);
int
error
=
0
;
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
if
(
!
cache_mngr
)
{
...
...
@@ -2463,7 +2459,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
void
binlog_reset_cache
(
THD
*
thd
)
{
binlog_cache_mngr
*
const
cache_mngr
=
opt_bin_log
?
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
)
:
0
;
thd
->
binlog_get_cache_mngr
(
)
:
0
;
DBUG_ENTER
(
"binlog_reset_cache"
);
if
(
cache_mngr
)
{
...
...
@@ -5791,8 +5787,7 @@ bool MYSQL_BIN_LOG::is_query_in_union(THD *thd, query_id_t query_id_param)
bool
trans_has_updated_trans_table
(
const
THD
*
thd
)
{
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
return
(
cache_mngr
?
!
cache_mngr
->
trx_cache
.
empty
()
:
0
);
}
...
...
@@ -5841,8 +5836,7 @@ bool use_trans_cache(const THD* thd, bool is_transactional)
{
if
(
is_transactional
)
return
1
;
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
auto
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
return
((
thd
->
is_current_stmt_binlog_format_row
()
||
thd
->
variables
.
binlog_direct_non_trans_update
)
?
0
:
...
...
@@ -6008,7 +6002,7 @@ void THD::set_binlog_start_alter_seq_no(uint64 s_no)
void
THD
::
binlog_start_trans_and_stmt
()
{
binlog_cache_mngr
*
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
binlog_cache_mngr
*
cache_mngr
=
binlog_get_cache_mngr
(
);
DBUG_ENTER
(
"binlog_start_trans_and_stmt"
);
DBUG_PRINT
(
"enter"
,
(
"cache_mngr: %p cache_mngr->trx_cache.get_prev_position(): %lu"
,
cache_mngr
,
...
...
@@ -6095,8 +6089,7 @@ THD::binlog_start_trans_and_stmt()
}
void
THD
::
binlog_set_stmt_begin
()
{
binlog_cache_mngr
*
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
binlog_cache_mngr
*
cache_mngr
=
binlog_get_cache_mngr
();
/*
The call to binlog_trans_log_savepos() might create the cache_mngr
...
...
@@ -6106,7 +6099,7 @@ void THD::binlog_set_stmt_begin() {
*/
my_off_t
pos
=
0
;
binlog_trans_log_savepos
(
this
,
&
pos
);
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
cache_mngr
=
binlog_get_cache_mngr
(
);
cache_mngr
->
trx_cache
.
set_prev_position
(
pos
);
}
...
...
@@ -6265,8 +6258,7 @@ bool THD::binlog_write_table_map(TABLE *table, bool with_annotate)
Table_map_log_event
the_event
(
this
,
table
,
table
->
s
->
table_map_id
,
is_transactional
);
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
binlog_get_cache_mngr
();
binlog_cache_data
*
cache_data
=
(
cache_mngr
->
get_binlog_cache_data
(
is_transactional
));
IO_CACHE
*
file
=
&
cache_data
->
cache_log
;
...
...
@@ -6305,6 +6297,12 @@ bool THD::binlog_write_table_map(TABLE *table, bool with_annotate)
}
binlog_cache_mngr
*
THD
::
binlog_get_cache_mngr
()
const
{
return
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
}
/**
This function retrieves a pending row event from a cache which is
specified through the parameter @c is_transactional. Respectively, when it
...
...
@@ -6320,8 +6318,7 @@ Rows_log_event*
THD
::
binlog_get_pending_rows_event
(
bool
is_transactional
)
const
{
Rows_log_event
*
rows
=
NULL
;
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
binlog_get_cache_mngr
();
/*
This is less than ideal, but here's the story: If there is no cache_mngr,
...
...
@@ -6376,8 +6373,7 @@ MYSQL_BIN_LOG::remove_pending_rows_event(THD *thd, bool is_transactional)
{
DBUG_ENTER
(
"MYSQL_BIN_LOG::remove_pending_rows_event"
);
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
DBUG_ASSERT
(
cache_mngr
);
...
...
@@ -6412,8 +6408,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
DBUG_ASSERT
(
WSREP_EMULATE_BINLOG
(
thd
)
||
mysql_bin_log
.
is_open
());
DBUG_PRINT
(
"enter"
,
(
"event: %p"
,
event
));
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
DBUG_ASSERT
(
cache_mngr
);
...
...
@@ -11817,7 +11812,7 @@ mysql_bin_log_commit_pos(THD *thd, ulonglong *out_pos, const char **out_file)
{
binlog_cache_mngr
*
cache_mngr
;
if
(
opt_bin_log
&&
(
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
)))
(
cache_mngr
=
thd
->
binlog_get_cache_mngr
(
)))
{
*
out_file
=
cache_mngr
->
last_commit_pos_file
;
*
out_pos
=
(
ulonglong
)(
cache_mngr
->
last_commit_pos_offset
);
...
...
@@ -11930,7 +11925,7 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
binlog_cache_mngr
*
cache_mngr
;
if
(
thd
&&
opt_bin_log
)
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
cache_mngr
=
thd
->
binlog_get_cache_mngr
(
);
else
cache_mngr
=
0
;
...
...
@@ -12055,8 +12050,7 @@ maria_declare_plugin_end;
IO_CACHE
*
wsrep_get_cache
(
THD
*
thd
,
bool
is_transactional
)
{
DBUG_ASSERT
(
binlog_hton
->
slot
!=
HA_SLOT_UNDEF
);
binlog_cache_mngr
*
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
if
(
cache_mngr
)
return
cache_mngr
->
get_binlog_cache_log
(
is_transactional
);
...
...
@@ -12072,8 +12066,7 @@ void wsrep_thd_binlog_trx_reset(THD * thd)
/*
todo: fix autocommit select to not call the caller
*/
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
if
(
cache_mngr
)
{
cache_mngr
->
reset
(
false
,
true
);
...
...
@@ -12091,8 +12084,7 @@ void wsrep_thd_binlog_stmt_rollback(THD * thd)
{
DBUG_ENTER
(
"wsrep_thd_binlog_stmt_rollback"
);
WSREP_DEBUG
(
"wsrep_thd_binlog_stmt_rollback"
);
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
if
(
cache_mngr
)
{
thd
->
binlog_remove_pending_rows_event
(
TRUE
,
TRUE
);
...
...
@@ -12117,8 +12109,7 @@ void wsrep_register_binlog_handler(THD *thd, bool trx)
back a statement or a transaction. However, notifications do not happen
if the binary log is set as read/write.
*/
binlog_cache_mngr
*
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
cache_mngr
=
thd
->
binlog_get_cache_mngr
();
/* cache_mngr may be missing e.g. in mtr test ev51914.test */
if
(
cache_mngr
)
{
...
...
sql/sql_class.h
View file @
0dfbb05c
...
...
@@ -2964,6 +2964,7 @@ class THD: public THD_count, /* this must be first */
/*
Member functions to handle pending event for row-level logging.
*/
binlog_cache_mngr
*
binlog_get_cache_mngr
()
const
;
template
<
class
RowsEventT
>
Rows_log_event
*
binlog_prepare_pending_rows_event
(
TABLE
*
table
,
uint32
serv_id
,
size_t
needed
,
...
...
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