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
381f4709
Commit
381f4709
authored
Jan 18, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify THD::binlog_setup_trx_data() usage
parent
fd9b911b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
23 deletions
+12
-23
sql/log.cc
sql/log.cc
+10
-21
sql/sql_class.cc
sql/sql_class.cc
+1
-1
sql/sql_class.h
sql/sql_class.h
+1
-1
No files found.
sql/log.cc
View file @
381f4709
...
...
@@ -1531,10 +1531,7 @@ binlog_trans_log_savepos(THD *thd, my_off_t *pos)
{
DBUG_ENTER
(
"binlog_trans_log_savepos"
);
DBUG_ASSERT
(
pos
!=
NULL
);
if
(
thd_get_ha_data
(
thd
,
binlog_hton
)
==
NULL
)
thd
->
binlog_setup_trx_data
();
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_setup_trx_data
();
DBUG_ASSERT
(
mysql_bin_log
.
is_open
());
*
pos
=
cache_mngr
->
trx_cache
.
get_byte_position
();
DBUG_PRINT
(
"return"
,
(
"*pos: %lu"
,
(
ulong
)
*
pos
));
...
...
@@ -4719,14 +4716,14 @@ bool stmt_has_updated_non_trans_table(const THD* thd)
binlog_hton, which has internal linkage.
*/
int
THD
::
binlog_setup_trx_data
()
binlog_cache_mngr
*
THD
::
binlog_setup_trx_data
()
{
DBUG_ENTER
(
"THD::binlog_setup_trx_data"
);
binlog_cache_mngr
*
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
if
(
cache_mngr
)
DBUG_RETURN
(
0
);
// Already set up
DBUG_RETURN
(
cache_mngr
);
// Already set up
cache_mngr
=
(
binlog_cache_mngr
*
)
my_malloc
(
sizeof
(
binlog_cache_mngr
),
MYF
(
MY_ZEROFILL
));
if
(
!
cache_mngr
||
...
...
@@ -4736,18 +4733,18 @@ int THD::binlog_setup_trx_data()
LOG_PREFIX
,
binlog_cache_size
,
MYF
(
MY_WME
)))
{
my_free
(
cache_mngr
);
DBUG_RETURN
(
1
);
// Didn't manage to set it up
DBUG_RETURN
(
0
);
// Didn't manage to set it up
}
thd_set_ha_data
(
this
,
binlog_hton
,
cache_mngr
);
cache_mngr
=
new
(
thd_get_ha_data
(
this
,
binlog_hton
)
)
cache_mngr
=
new
(
cache_mngr
)
binlog_cache_mngr
(
max_binlog_stmt_cache_size
,
max_binlog_cache_size
,
&
binlog_stmt_cache_use
,
&
binlog_stmt_cache_disk_use
,
&
binlog_cache_use
,
&
binlog_cache_disk_use
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
cache_mngr
);
}
/*
...
...
@@ -4830,9 +4827,7 @@ binlog_start_consistent_snapshot(handlerton *hton, THD *thd)
int
err
=
0
;
DBUG_ENTER
(
"binlog_start_consistent_snapshot"
);
thd
->
binlog_setup_trx_data
();
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_setup_trx_data
();
/* Server layer calls us with LOCK_commit_ordered locked, so this is safe. */
strmake
(
cache_mngr
->
last_commit_pos_file
,
mysql_bin_log
.
last_commit_pos_file
,
...
...
@@ -4944,11 +4939,7 @@ THD::binlog_get_pending_rows_event(bool is_transactional) const
void
THD
::
binlog_set_pending_rows_event
(
Rows_log_event
*
ev
,
bool
is_transactional
)
{
if
(
thd_get_ha_data
(
this
,
binlog_hton
)
==
NULL
)
binlog_setup_trx_data
();
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
this
,
binlog_hton
);
binlog_cache_mngr
*
const
cache_mngr
=
binlog_setup_trx_data
();
DBUG_ASSERT
(
cache_mngr
);
...
...
@@ -5119,12 +5110,10 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
}
else
{
if
(
thd
->
binlog_setup_trx_data
())
binlog_cache_mngr
*
const
cache_mngr
=
thd
->
binlog_setup_trx_data
();
if
(
!
cache_mngr
)
goto
err
;
binlog_cache_mngr
*
const
cache_mngr
=
(
binlog_cache_mngr
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
is_trans_cache
=
use_trans_cache
(
thd
,
using_trans
);
file
=
cache_mngr
->
get_binlog_cache_log
(
is_trans_cache
);
cache_data
=
cache_mngr
->
get_binlog_cache_data
(
is_trans_cache
);
...
...
sql/sql_class.cc
View file @
381f4709
...
...
@@ -4909,7 +4909,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
There is no good place to set up the transactional data, so we
have to do it here.
*/
if
(
binlog_setup_trx_data
())
if
(
binlog_setup_trx_data
()
==
NULL
)
DBUG_RETURN
(
NULL
);
Rows_log_event
*
pending
=
binlog_get_pending_rows_event
(
is_transactional
);
...
...
sql/sql_class.h
View file @
381f4709
...
...
@@ -1734,7 +1734,7 @@ class THD :public Statement,
bool
save_prep_leaf_list
;
#ifndef MYSQL_CLIENT
int
binlog_setup_trx_data
();
binlog_cache_mngr
*
binlog_setup_trx_data
();
/*
Public interface to write RBR events to the binlog
...
...
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