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
8596b70f
Commit
8596b70f
authored
Oct 07, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: simplify the usage of WSREP_FORMAT macro
parent
d103e359
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
31 deletions
+27
-31
include/wsrep.h
include/wsrep.h
+0
-9
sql/log.cc
sql/log.cc
+5
-5
sql/sql_base.cc
sql/sql_base.cc
+2
-3
sql/sql_class.cc
sql/sql_class.cc
+5
-5
sql/sql_class.h
sql/sql_class.h
+7
-4
sql/sql_parse.cc
sql/sql_parse.cc
+2
-3
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+6
-2
No files found.
include/wsrep.h
View file @
8596b70f
...
...
@@ -22,14 +22,6 @@
#define IF_WSREP(A,B) A
#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A)
#if !defined(EMBEDDED_LIBRARY)
#define WSREP_FORMAT(my_format) \
((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \
((enum enum_binlog_format)wsrep_forced_binlog_format) : my_format)
#else
#define WSREP_FORMAT(my_format) my_format
#endif
/* && !EMBEDDED_LIBRARY */
#define WSREP_MYSQL_DB (char *)"mysql"
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
...
...
@@ -52,7 +44,6 @@
#define WSREP_INFO(...)
#define WSREP_WARN(...)
#define WSREP_ERROR(...)
#define WSREP_FORMAT(my_format) my_format
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_)
#define WSREP_TO_ISOLATION_END
#endif
...
...
sql/log.cc
View file @
8596b70f
...
...
@@ -1910,12 +1910,12 @@ static bool trans_cannot_safely_rollback(THD *thd, bool all)
return
((
thd
->
variables
.
option_bits
&
OPTION_KEEP_LOG
)
||
(
trans_has_updated_non_trans_table
(
thd
)
&&
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
)
==
BINLOG_FORMAT_STMT
)
||
thd
->
wsrep_binlog_format
(
)
==
BINLOG_FORMAT_STMT
)
||
(
cache_mngr
->
trx_cache
.
changes_to_non_trans_temp_table
()
&&
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
)
==
BINLOG_FORMAT_MIXED
)
||
thd
->
wsrep_binlog_format
(
)
==
BINLOG_FORMAT_MIXED
)
||
(
trans_has_updated_non_trans_table
(
thd
)
&&
ending_single_stmt_trans
(
thd
,
all
)
&&
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
)
==
BINLOG_FORMAT_MIXED
));
thd
->
wsrep_binlog_format
(
)
==
BINLOG_FORMAT_MIXED
));
}
...
...
@@ -2064,9 +2064,9 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
else
if
(
ending_trans
(
thd
,
all
)
||
(
!
(
thd
->
variables
.
option_bits
&
OPTION_KEEP_LOG
)
&&
(
!
stmt_has_updated_non_trans_table
(
thd
)
||
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
)
!=
BINLOG_FORMAT_STMT
)
&&
thd
->
wsrep_binlog_format
(
)
!=
BINLOG_FORMAT_STMT
)
&&
(
!
cache_mngr
->
trx_cache
.
changes_to_non_trans_temp_table
()
||
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
)
!=
BINLOG_FORMAT_MIXED
)))
thd
->
wsrep_binlog_format
(
)
!=
BINLOG_FORMAT_MIXED
)))
error
=
binlog_truncate_trx_cache
(
thd
,
cache_mngr
,
all
);
}
...
...
sql/sql_base.cc
View file @
8596b70f
...
...
@@ -3557,8 +3557,7 @@ thr_lock_type read_lock_type_for_table(THD *thd,
at THD::variables::sql_log_bin member.
*/
bool
log_on
=
mysql_bin_log
.
is_open
()
&&
thd
->
variables
.
sql_log_bin
;
ulong
binlog_format
=
thd
->
variables
.
binlog_format
;
if
((
log_on
==
FALSE
)
||
(
WSREP_FORMAT
((
enum
enum_binlog_format
)
binlog_format
)
==
BINLOG_FORMAT_ROW
)
||
if
((
log_on
==
FALSE
)
||
(
thd
->
wsrep_binlog_format
()
==
BINLOG_FORMAT_ROW
)
||
(
table_list
->
table
->
s
->
table_category
==
TABLE_CATEGORY_LOG
)
||
(
table_list
->
table
->
s
->
table_category
==
TABLE_CATEGORY_PERFORMANCE
)
||
!
(
is_update_query
(
prelocking_ctx
->
sql_command
)
||
...
...
@@ -5327,7 +5326,7 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
We can solve these problems in mixed mode by switching to binlogging
if at least one updated table is used by sub-statement
*/
if
(
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
)
!=
BINLOG_FORMAT_ROW
&&
tables
&&
if
(
thd
->
wsrep_binlog_format
()
!=
BINLOG_FORMAT_ROW
&&
tables
&&
has_write_table_with_auto_increment
(
thd
->
lex
->
first_not_own_table
()))
thd
->
lex
->
set_stmt_unsafe
(
LEX
::
BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS
);
}
...
...
sql/sql_class.cc
View file @
8596b70f
...
...
@@ -4350,7 +4350,7 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd)
{
if
(((
WSREP
(
thd
)
&&
wsrep_emulate_bin_log
)
||
mysql_bin_log
.
is_open
())
&&
thd
->
variables
.
option_bits
&
OPTION_BIN_LOG
)
return
(
int
)
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
);
return
(
int
)
thd
->
wsrep_binlog_format
(
);
else
return
BINLOG_FORMAT_UNSPEC
;
}
...
...
@@ -5080,7 +5080,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
binlog by filtering rules.
*/
if
(
mysql_bin_log
.
is_open
()
&&
(
variables
.
option_bits
&
OPTION_BIN_LOG
)
&&
!
(
WSREP_FORMAT
((
enum
enum_binlog_format
)
variables
.
binlog_format
)
==
BINLOG_FORMAT_STMT
&&
!
(
wsrep_binlog_format
(
)
==
BINLOG_FORMAT_STMT
&&
!
binlog_filter
->
db_ok
(
db
)))
{
/*
...
...
@@ -5290,7 +5290,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
*/
my_error
((
error
=
ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE
),
MYF
(
0
));
}
else
if
(
WSREP_FORMAT
((
enum
enum_binlog_format
)
variables
.
binlog_format
)
==
BINLOG_FORMAT_ROW
&&
else
if
(
wsrep_binlog_format
(
)
==
BINLOG_FORMAT_ROW
&&
sqlcom_can_generate_row_events
(
this
))
{
/*
...
...
@@ -5319,7 +5319,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
else
{
/* binlog_format = STATEMENT */
if
(
WSREP_FORMAT
((
enum
enum_binlog_format
)
variables
.
binlog_format
)
==
BINLOG_FORMAT_STMT
)
if
(
wsrep_binlog_format
(
)
==
BINLOG_FORMAT_STMT
)
{
if
(
lex
->
is_stmt_row_injection
())
{
...
...
@@ -5451,7 +5451,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
"and binlog_filter->db_ok(db) = %d"
,
mysql_bin_log
.
is_open
(),
(
variables
.
option_bits
&
OPTION_BIN_LOG
),
(
uint
)
WSREP_FORMAT
((
enum
enum_binlog_format
)
variables
.
binlog_format
),
(
uint
)
wsrep_binlog_format
(
),
binlog_filter
->
db_ok
(
db
)));
#endif
...
...
sql/sql_class.h
View file @
8596b70f
...
...
@@ -3286,8 +3286,7 @@ class THD :public Statement,
tests fail and so force them to propagate the
lex->binlog_row_based_if_mixed upwards to the caller.
*/
if
((
WSREP_FORMAT
((
enum
enum_binlog_format
)
variables
.
binlog_format
)
==
BINLOG_FORMAT_MIXED
)
&&
(
in_sub_stmt
==
0
))
if
((
wsrep_binlog_format
()
==
BINLOG_FORMAT_MIXED
)
&&
(
in_sub_stmt
==
0
))
set_current_stmt_binlog_format_row
();
DBUG_VOID_RETURN
;
...
...
@@ -3338,8 +3337,7 @@ class THD :public Statement,
show_system_thread
(
system_thread
)));
if
(
in_sub_stmt
==
0
)
{
if
(
WSREP_FORMAT
((
enum
enum_binlog_format
)
variables
.
binlog_format
)
==
BINLOG_FORMAT_ROW
)
if
(
wsrep_binlog_format
()
==
BINLOG_FORMAT_ROW
)
set_current_stmt_binlog_format_row
();
else
if
(
temporary_tables
==
NULL
)
set_current_stmt_binlog_format_stmt
();
...
...
@@ -3748,6 +3746,11 @@ class THD :public Statement,
(
rgi_slave
&&
rgi_have_temporary_tables
()));
}
inline
ulong
wsrep_binlog_format
()
const
{
return
WSREP_FORMAT
(
variables
.
binlog_format
);
}
#ifdef WITH_WSREP
const
bool
wsrep_applier
;
/* dedicated slave applier thread */
bool
wsrep_applier_closing
;
/* applier marked to close */
...
...
sql/sql_parse.cc
View file @
8596b70f
...
...
@@ -3132,9 +3132,8 @@ mysql_execute_command(THD *thd)
raise a warning, as it may cause problems
(see 'NAME_CONST issues' in 'Binary Logging of Stored Programs')
*/
if
(
thd
->
query_name_consts
&&
mysql_bin_log
.
is_open
()
&&
WSREP_FORMAT
((
enum
enum_binlog_format
)
thd
->
variables
.
binlog_format
)
==
BINLOG_FORMAT_STMT
&&
if
(
thd
->
query_name_consts
&&
mysql_bin_log
.
is_open
()
&&
thd
->
wsrep_binlog_format
()
==
BINLOG_FORMAT_STMT
&&
!
mysql_bin_log
.
is_query_in_union
(
thd
,
thd
->
query_id
))
{
List_iterator_fast
<
Item
>
it
(
select_lex
->
item_list
);
...
...
sql/wsrep_mysqld.h
View file @
8596b70f
...
...
@@ -169,8 +169,11 @@ extern wsrep_seqno_t wsrep_locked_seqno;
#define WSREP_EMULATE_BINLOG(thd) \
(WSREP(thd) && wsrep_emulate_bin_log)
// MySQL logging functions don't seem to understand long long length modifer.
// This is a workaround. It also prefixes all messages with "WSREP"
#define WSREP_FORMAT(my_format) \
((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) \
? wsrep_forced_binlog_format : (ulong)(my_format))
// prefix all messages with "WSREP"
#define WSREP_LOG(fun, ...) \
do { \
char msg[1024] = {'\0'}; \
...
...
@@ -309,6 +312,7 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
#define WSREP_ON (0)
#define WSREP_EMULATE_BINLOG(thd) (0)
#define WSREP_CLIENT(thd) (0)
#define WSREP_FORMAT(my_format) ((ulong)my_format)
#define wsrep_emulate_bin_log (0)
#define wsrep_xid_seqno(X) (0)
#define wsrep_to_isolation (0)
...
...
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