#At file:///home/hezx/work/mysql/bzr/w5778/trunk/ based on revid:hezx@stripped
3520 He Zhenxing 2011-03-03
WL#5778 Binlog interface
Moved Binlog related member variables in THD to Binlog_data
modified:
sql/binlog.cc
sql/binlog.h
sql/rpl_master.cc
sql/sp_head.cc
sql/sql_binlog.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_parse.cc
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc 2011-03-01 06:23:58 +0000
+++ b/sql/binlog.cc 2011-03-03 07:45:12 +0000
@@ -1006,7 +1006,7 @@ static void adjust_linfo_offsets(my_off_
while ((tmp=it++))
{
LOG_INFO* linfo;
- if ((linfo = tmp->current_linfo))
+ if ((linfo = BINLOG(tmp)->current_linfo))
{
mysql_mutex_lock(&linfo->lock);
/*
@@ -1037,7 +1037,7 @@ static bool log_in_use(const char* log_n
while ((tmp=it++))
{
LOG_INFO* linfo;
- if ((linfo = tmp->current_linfo))
+ if ((linfo = BINLOG(tmp)->current_linfo))
{
mysql_mutex_lock(&linfo->lock);
result = !memcmp(log_name, linfo->log_file_name, log_name_len);
@@ -1482,7 +1482,7 @@ bool show_binlog_events(THD *thd, MYSQL_
}
mysql_mutex_lock(&LOCK_thread_count);
- thd->current_linfo = &linfo;
+ BINLOG(thd)->current_linfo = &linfo;
mysql_mutex_unlock(&LOCK_thread_count);
if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0)
@@ -1575,7 +1575,7 @@ err:
my_eof(thd);
mysql_mutex_lock(&LOCK_thread_count);
- thd->current_linfo = 0;
+ BINLOG(thd)->current_linfo = 0;
mysql_mutex_unlock(&LOCK_thread_count);
thd->variables.max_allowed_packet= old_max_allowed_packet;
DBUG_RETURN(ret);
@@ -3234,23 +3234,23 @@ bool MYSQL_BIN_LOG::flush_and_sync(bool
void MYSQL_BIN_LOG::start_union_events(THD *thd, query_id_t query_id_param)
{
- DBUG_ASSERT(!thd->binlog_evt_union.do_union);
- thd->binlog_evt_union.do_union= TRUE;
- thd->binlog_evt_union.unioned_events= FALSE;
- thd->binlog_evt_union.unioned_events_trans= FALSE;
- thd->binlog_evt_union.first_query_id= query_id_param;
+ DBUG_ASSERT(!BINLOG(thd)->binlog_evt_union.do_union);
+ BINLOG(thd)->binlog_evt_union.do_union= TRUE;
+ BINLOG(thd)->binlog_evt_union.unioned_events= FALSE;
+ BINLOG(thd)->binlog_evt_union.unioned_events_trans= FALSE;
+ BINLOG(thd)->binlog_evt_union.first_query_id= query_id_param;
}
void MYSQL_BIN_LOG::stop_union_events(THD *thd)
{
- DBUG_ASSERT(thd->binlog_evt_union.do_union);
- thd->binlog_evt_union.do_union= FALSE;
+ DBUG_ASSERT(BINLOG(thd)->binlog_evt_union.do_union);
+ BINLOG(thd)->binlog_evt_union.do_union= FALSE;
}
bool MYSQL_BIN_LOG::is_query_in_union(THD *thd, query_id_t query_id_param)
{
- return (thd->binlog_evt_union.do_union &&
- query_id_param >= thd->binlog_evt_union.first_query_id);
+ return (BINLOG(thd)->binlog_evt_union.do_union &&
+ query_id_param >= BINLOG(thd)->binlog_evt_union.first_query_id);
}
@@ -3351,14 +3351,14 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
DBUG_ENTER("MYSQL_BIN_LOG::write(Log_event *)");
binlog_cache_data *cache_data= 0;
- if (thd->binlog_evt_union.do_union)
+ if (BINLOG(thd)->binlog_evt_union.do_union)
{
/*
In Stored function; Remember that function call caused an update.
We will log the function call to the binary log on function exit
*/
- thd->binlog_evt_union.unioned_events= TRUE;
- thd->binlog_evt_union.unioned_events_trans |=
+ BINLOG(thd)->binlog_evt_union.unioned_events= TRUE;
+ BINLOG(thd)->binlog_evt_union.unioned_events_trans |=
event_info->use_trans_cache();
DBUG_RETURN(0);
}
@@ -4509,7 +4509,7 @@ int Binlog::binlog_write_table_map(THD*
Table_map_log_event
the_event(thd, table, table->s->table_map_id, is_transactional);
- if (thd->binlog_table_maps == 0)
+ if (BINLOG(thd)->binlog_table_maps == 0)
binlog_start_trans_and_stmt(thd);
binlog_cache_mngr *const cache_mngr=
@@ -4530,7 +4530,7 @@ int Binlog::binlog_write_table_map(THD*
if ((error= the_event.write(file)))
DBUG_RETURN(error);
- thd->binlog_table_maps++;
+ BINLOG(thd)->binlog_table_maps++;
DBUG_RETURN(0);
}
@@ -4925,12 +4925,12 @@ int Binlog::decide_logging_format(THD* t
7. Warning: Unsafe statement logged as statement due to
binlog_format = STATEMENT
*/
- thd->binlog_unsafe_warning_flags|= unsafe_flags;
+ BINLOG(thd)->binlog_unsafe_warning_flags|= unsafe_flags;
DBUG_PRINT("info", ("Scheduling warning to be issued by "
"binlog_query: '%s'",
ER(ER_BINLOG_UNSAFE_STATEMENT)));
DBUG_PRINT("info", ("binlog_unsafe_warning_flags: 0x%x",
- thd->binlog_unsafe_warning_flags));
+ BINLOG(thd)->binlog_unsafe_warning_flags));
}
/* log in statement format! */
}
@@ -5425,7 +5425,7 @@ int Binlog::binlog_remove_pending_rows_e
mysql_bin_log.remove_pending_rows_event(thd, is_transactional);
if (clear_maps)
- thd->binlog_table_maps= 0;
+ BINLOG(thd)->binlog_table_maps= 0;
DBUG_RETURN(0);
}
@@ -5453,7 +5453,7 @@ int Binlog::binlog_flush_pending_rows_ev
if (stmt_end)
{
pending->set_flags(Rows_log_event::STMT_END_F);
- thd->binlog_table_maps= 0;
+ BINLOG(thd)->binlog_table_maps= 0;
}
error= mysql_bin_log.flush_and_set_pending_rows_event(thd, 0,
@@ -5478,9 +5478,9 @@ void Binlog::issue_unsafe_warnings(THD*
bits. This is actually a constant expression.
*/
DBUG_ASSERT(LEX::BINLOG_STMT_UNSAFE_COUNT <=
- sizeof(thd->binlog_unsafe_warning_flags) * CHAR_BIT);
+ sizeof(BINLOG(thd)->binlog_unsafe_warning_flags) * CHAR_BIT);
- uint32 unsafe_type_flags= thd->binlog_unsafe_warning_flags;
+ uint32 unsafe_type_flags= BINLOG(thd)->binlog_unsafe_warning_flags;
/*
For each unsafe_type, check if the statement is unsafe in this way
@@ -5682,7 +5682,7 @@ int Binlog::binlog_query(THD* thd,
the variables.option_bits & OPTION_BIN_LOG is false.
*/
if ((thd->variables.option_bits & OPTION_BIN_LOG) &&
- thd->spcont == NULL && !thd->binlog_evt_union.do_union)
+ thd->spcont == NULL && !BINLOG(thd)->binlog_evt_union.do_union)
issue_unsafe_warnings(thd);
switch (qtype) {
@@ -5726,7 +5726,7 @@ int Binlog::binlog_query(THD* thd,
table maps were written.
*/
int error= mysql_bin_log.write(&qinfo);
- thd->binlog_table_maps= 0;
+ BINLOG(thd)->binlog_table_maps= 0;
DBUG_RETURN(error);
}
break;
@@ -6111,6 +6111,19 @@ void Binlog::stop_union_events(THD* thd)
{
mysql_bin_log.stop_union_events(thd);
}
+bool Binlog::unioned_events(THD* thd)
+{
+ return BINLOG(thd)->binlog_evt_union.unioned_events;
+}
+bool Binlog::unioned_events_trans(THD* thd)
+{
+ return BINLOG(thd)->binlog_evt_union.unioned_events_trans;
+}
+bool Binlog::do_union(THD* thd)
+{
+ return BINLOG(thd)->binlog_evt_union.do_union;
+}
+
int Binlog::purge_expired_logs(time_t start_time)
{
#ifdef HAVE_REPLICATION
@@ -6166,15 +6179,15 @@ int Binlog::get_current_log(LOG_INFO* lo
return mysql_bin_log.get_current_log(log_info);
}
int Binlog::is_current_stmt_binlog_format_row(THD* thd) const {
- DBUG_ASSERT(thd->current_stmt_binlog_format == BINLOG_FORMAT_STMT ||
- thd->current_stmt_binlog_format == BINLOG_FORMAT_ROW);
- return thd->current_stmt_binlog_format == BINLOG_FORMAT_ROW;
+ DBUG_ASSERT(BINLOG(thd)->current_stmt_binlog_format == BINLOG_FORMAT_STMT ||
+ BINLOG(thd)->current_stmt_binlog_format == BINLOG_FORMAT_ROW);
+ return BINLOG(thd)->current_stmt_binlog_format == BINLOG_FORMAT_ROW;
}
uint Binlog::get_binlog_table_maps(THD* thd) const {
- return thd->binlog_table_maps;
+ return BINLOG(thd)->binlog_table_maps;
}
void Binlog::clear_binlog_table_maps(THD* thd) {
- thd->binlog_table_maps= 0;
+ BINLOG(thd)->binlog_table_maps= 0;
}
void Binlog::set_current_stmt_binlog_format_row_if_mixed(THD* thd)
{
@@ -6205,13 +6218,13 @@ void Binlog::set_current_stmt_binlog_for
void Binlog::set_current_stmt_binlog_format_row(THD* thd)
{
DBUG_ENTER("set_current_stmt_binlog_format_row");
- thd->current_stmt_binlog_format= BINLOG_FORMAT_ROW;
+ BINLOG(thd)->current_stmt_binlog_format= BINLOG_FORMAT_ROW;
DBUG_VOID_RETURN;
}
void Binlog::clear_current_stmt_binlog_format_row(THD* thd)
{
DBUG_ENTER("clear_current_stmt_binlog_format_row");
- thd->current_stmt_binlog_format= BINLOG_FORMAT_STMT;
+ BINLOG(thd)->current_stmt_binlog_format= BINLOG_FORMAT_STMT;
DBUG_VOID_RETURN;
}
void Binlog::reset_current_stmt_binlog_format_row(THD* thd)
@@ -6245,6 +6258,12 @@ void Binlog::reset_current_stmt_binlog_f
}
DBUG_VOID_RETURN;
}
+void Binlog::reset_for_next_command(THD* thd)
+{
+ reset_current_stmt_binlog_format_row(thd);
+ BINLOG(thd)->binlog_unsafe_warning_flags= 0;
+}
+
void Binlog::binlog_invoker(THD* thd)
{
thd->m_binlog_invoker= TRUE;
@@ -6253,3 +6272,19 @@ bool Binlog::need_binlog_invoker(THD* th
{
return thd->m_binlog_invoker;
}
+void* Binlog::get_thd_data()
+{
+ return new Binlog_data;
+}
+void Binlog::free_thd_data(void* data)
+{
+ Binlog_data* binlog_data= (Binlog_data*) data;
+#ifndef EMBEDDED_LIBRARY
+ if (binlog_data->rli_fake)
+ {
+ delete binlog_data->rli_fake;
+ binlog_data->rli_fake= NULL;
+ }
+#endif
+ delete binlog_data;
+}
=== modified file 'sql/binlog.h'
--- a/sql/binlog.h 2011-03-01 06:23:58 +0000
+++ b/sql/binlog.h 2011-03-03 07:45:12 +0000
@@ -32,6 +32,79 @@ extern const char *log_bin_basename;
void check_binlog_cache_size(THD *thd);
bool thd_binlog_rows_query_log_events(THD *thd);
+class Binlog_data {
+public:
+ Binlog_data()
+ :rli_fake(0),
+ current_stmt_binlog_format(BINLOG_FORMAT_UNSPEC),
+ binlog_unsafe_warning_flags(0),
+ binlog_table_maps(0),
+ current_linfo(0)
+ {
+ bzero(&binlog_evt_union, sizeof(binlog_evt_union));
+ }
+
+ /* Used to execute base64 coded binlog events in MySQL server */
+ Relay_log_info* rli_fake;
+ /**
+ Indicates the format in which the current statement will be
+ logged. This can only be set from @c decide_logging_format().
+ */
+ enum_binlog_format current_stmt_binlog_format;
+
+ /**
+ Bit field for the state of binlog warnings.
+
+ The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of
+ unsafeness that the current statement has.
+
+ This must be a member of THD and not of LEX, because warnings are
+ detected and issued in different places (@c
+ decide_logging_format() and @c binlog_query(), respectively).
+ Between these calls, the THD->lex object may change; e.g., if a
+ stored routine is invoked. Only THD persists between the calls.
+ */
+ uint32 binlog_unsafe_warning_flags;
+ /*
+ Number of outstanding table maps, i.e., table maps in the
+ transaction cache.
+ */
+ uint binlog_table_maps;
+ /*
+ If we do a purge of binary logs, log index info of the threads
+ that are currently reading it needs to be adjusted. To do that
+ each thread that is using LOG_INFO needs to adjust the pointer to it
+ */
+ LOG_INFO* current_linfo;
+ struct {
+ /*
+ If true, mysql_bin_log::write(Log_event) call will not write events to
+ binlog, and maintain 2 below variables instead (use
+ mysql_bin_log.start_union_events to turn this on)
+ */
+ bool do_union;
+ /*
+ If TRUE, at least one mysql_bin_log::write(Log_event) call has been
+ made after last mysql_bin_log.start_union_events() call.
+ */
+ bool unioned_events;
+ /*
+ If TRUE, at least one mysql_bin_log::write(Log_event e), where
+ e.cache_stmt == TRUE call has been made after last
+ mysql_bin_log.start_union_events() call.
+ */
+ bool unioned_events_trans;
+
+ /*
+ 'queries' (actually SP statements) that run under inside this binlog
+ union have thd->query_id >= first_query_id.
+ */
+ query_id_t first_query_id;
+ } binlog_evt_union;
+};
+
+#define BINLOG(thd) ((Binlog_data*) thd->binlog_data)
+
class Binlog {
public:
enum enum_binlog_query_type {
@@ -50,8 +123,11 @@ public:
int init_log_path();
int init();
void end();
+ void* get_thd_data();
+ void free_thd_data(void* data);
bool enabled();
bool enabled(const THD* thd);
+ void reset_for_next_command(THD* thd);
int set_max_size(ulong max_size);
int get_current_log(LOG_INFO* log_info);
bool open(const char *log_name, ulong max_size);
@@ -59,6 +135,9 @@ public:
bool is_query_in_union(THD* thd, query_id_t query_id);
void start_union_events(THD* thd, query_id_t query_id);
void stop_union_events(THD* thd);
+ bool unioned_events(THD* thd);
+ bool unioned_events_trans(THD* thd);
+ bool do_union(THD* thd);
int flush_binary_log(THD* thd);
int show_binary_logs(THD* thd);
int show_binlog_events(THD* thd);
=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc 2011-01-31 07:32:53 +0000
+++ b/sql/rpl_master.cc 2011-03-03 07:45:12 +0000
@@ -723,7 +723,7 @@ void mysql_binlog_send(THD* thd, char* l
}
mysql_mutex_lock(&LOCK_thread_count);
- thd->current_linfo = &linfo;
+ BINLOG(thd)->current_linfo = &linfo;
mysql_mutex_unlock(&LOCK_thread_count);
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0)
@@ -1231,7 +1231,7 @@ end:
my_eof(thd);
thd_proc_info(thd, "Waiting to finalize termination");
mysql_mutex_lock(&LOCK_thread_count);
- thd->current_linfo = 0;
+ BINLOG(thd)->current_linfo = 0;
mysql_mutex_unlock(&LOCK_thread_count);
thd->variables.max_allowed_packet= old_max_allowed_packet;
DBUG_VOID_RETURN;
@@ -1248,7 +1248,7 @@ err:
after we return from this stack frame
*/
mysql_mutex_lock(&LOCK_thread_count);
- thd->current_linfo = 0;
+ BINLOG(thd)->current_linfo = 0;
mysql_mutex_unlock(&LOCK_thread_count);
if (file >= 0)
mysql_file_close(file, MYF(MY_WME));
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-03-01 06:23:58 +0000
+++ b/sql/sp_head.cc 2011-03-03 07:45:12 +0000
@@ -26,6 +26,7 @@
#include "sql_acl.h" // *_ACL
#include "sql_array.h" // Dynamic_array
#include "log_event.h" // append_query_string, Query_log_event
+#include "binlog.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
@@ -1945,13 +1946,13 @@ sp_head::execute_function(THD *thd, Item
{
binlog.stop_union_events(thd);
thd->variables.option_bits= binlog_save_options;
- if (thd->binlog_evt_union.unioned_events)
+ if (binlog.unioned_events(thd))
{
int errcode = query_error_code(thd, thd->killed == THD::NOT_KILLED);
Query_log_event qinfo(thd, binlog_buf.ptr(), binlog_buf.length(),
- thd->binlog_evt_union.unioned_events_trans, FALSE, FALSE, errcode);
+ binlog.unioned_events_trans(thd), FALSE, FALSE, errcode);
if (binlog.write(&qinfo) &&
- thd->binlog_evt_union.unioned_events_trans)
+ binlog.unioned_events_trans(thd))
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Invoked ROUTINE modified a transactional table but MySQL "
@@ -1991,7 +1992,7 @@ err_with_cleanup:
messsages.
*/
if (need_binlog_call &&
- thd->spcont == NULL && !thd->binlog_evt_union.do_union)
+ thd->spcont == NULL && !binlog.do_union(thd))
binlog.issue_unsafe_warnings(thd);
DBUG_RETURN(err_status);
@@ -2248,7 +2249,7 @@ sp_head::execute_procedure(THD *thd, Lis
bool need_binlog_call= binlog.enabled(thd) &&
!binlog.is_current_stmt_binlog_format_row(thd);
if (need_binlog_call && thd->spcont == NULL &&
- !thd->binlog_evt_union.do_union)
+ !binlog.do_union(thd))
binlog.issue_unsafe_warnings(thd);
DBUG_RETURN(err_status);
=== modified file 'sql/sql_binlog.cc'
--- a/sql/sql_binlog.cc 2011-01-31 07:32:53 +0000
+++ b/sql/sql_binlog.cc 2011-03-03 07:45:12 +0000
@@ -155,12 +155,12 @@ void mysql_client_binlog_statement(THD*
Allocation
*/
int err= 0;
- Relay_log_info *rli= thd->rli_fake;
+ Relay_log_info *rli= BINLOG(thd)->rli_fake;
if (!rli)
{
if ((rli= Rpl_info_factory::create_rli(RLI_REPOSITORY_FILE, FALSE)))
{
- thd->rli_fake= rli;
+ BINLOG(thd)->rli_fake= rli;
rli->info_thd= thd;
}
}
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-03-01 06:23:58 +0000
+++ b/sql/sql_class.cc 2011-03-03 07:45:12 +0000
@@ -499,10 +499,7 @@ bool Drop_table_error_handler::handle_co
THD::THD()
:Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
/* statement id */ 0),
- rli_fake(0),
user_time(0), in_sub_stmt(0),
- binlog_unsafe_warning_flags(0),
- binlog_table_maps(0),
table_map_for_update(0),
arg_of_last_insert_id_function(FALSE),
first_successful_insert_id_in_prev_stmt(0),
@@ -525,7 +522,8 @@ THD::THD()
#if defined(ENABLED_DEBUG_SYNC)
debug_sync_control(0),
#endif /* defined(ENABLED_DEBUG_SYNC) */
- main_warning_info(0)
+ main_warning_info(0),
+ binlog_data(0)
{
ulong tmp;
@@ -561,7 +559,6 @@ THD::THD()
start_time=(time_t) 0;
start_utime= prior_thr_create_utime= 0L;
utime_after_lock= 0L;
- current_linfo = 0;
slave_thread = 0;
bzero(&variables, sizeof(variables));
thread_id= 0;
@@ -572,7 +569,6 @@ THD::THD()
db_charset= global_system_variables.collation_database;
bzero(ha_data, sizeof(ha_data));
mysys_var=0;
- binlog_evt_union.do_union= FALSE;
enable_slow_log= 0;
#ifndef DBUG_OFF
dbug_sentry=THD_SENTRY_MAGIC;
@@ -586,7 +582,6 @@ THD::THD()
system_thread= NON_SYSTEM_THREAD;
cleanup_done= abort_on_warning= no_warnings_for_error= 0;
peer_port= 0; // For SHOW PROCESSLIST
- transaction.m_pending_rows_event= 0;
transaction.on= 1;
#ifdef SIGNAL_WITH_VIO_CLOSE
active_vio = 0;
@@ -597,13 +592,13 @@ THD::THD()
proc_info="login";
where= THD::DEFAULT_WHERE;
server_id = ::server_id;
- slave_net = 0;
set_command(COM_CONNECT);
*scramble= '\0';
/* Call to init() below requires fully initialized Open_tables_state. */
reset_open_tables_state(this);
+ binlog_data= binlog.get_thd_data();
init();
#if defined(ENABLED_PROFILING)
profiling.set_thd(this);
@@ -621,7 +616,8 @@ THD::THD()
my_init_dynamic_array(&user_var_events,
sizeof(BINLOG_USER_VAR_EVENT *), 16, 16);
else
- bzero((char*) &user_var_events, sizeof(user_var_events));
+ bzero((char*) &user_var_events,
+ sizeof(user_var_events));
/* Protocol */
protocol= &protocol_text; // Default protocol
@@ -1110,14 +1106,11 @@ THD::~THD()
mysql_mutex_destroy(&LOCK_thd_data);
#ifndef DBUG_OFF
dbug_sentry= THD_SENTRY_GONE;
-#endif
+#endif
+
+ binlog.free_thd_data(binlog_data);
+
#ifndef EMBEDDED_LIBRARY
- if (rli_fake)
- {
- delete rli_fake;
- rli_fake= NULL;
- }
-
mysql_audit_free_thd(this);
#endif
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-03-01 06:23:58 +0000
+++ b/sql/sql_class.h 2011-03-03 07:45:12 +0000
@@ -1479,9 +1479,6 @@ class THD :public Statement,
public:
MDL_context mdl_context;
- /* Used to execute base64 coded binlog events in MySQL server */
- Relay_log_info* rli_fake;
-
void reset_for_next_command();
/*
Constant for THD::where initialization in the beginning of every query.
@@ -1642,34 +1639,6 @@ public:
{
return (variables.optimizer_switch & flag);
}
-
-public:
- /**
- Indicates the format in which the current statement will be
- logged. This can only be set from @c decide_logging_format().
- */
- enum_binlog_format current_stmt_binlog_format;
-
- /**
- Bit field for the state of binlog warnings.
-
- The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of
- unsafeness that the current statement has.
-
- This must be a member of THD and not of LEX, because warnings are
- detected and issued in different places (@c
- decide_logging_format() and @c binlog_query(), respectively).
- Between these calls, the THD->lex object may change; e.g., if a
- stored routine is invoked. Only THD persists between the calls.
- */
- uint32 binlog_unsafe_warning_flags;
-
-public:
- /*
- Number of outstanding table maps, i.e., table maps in the
- transaction cache.
- */
- uint binlog_table_maps;
#endif /* MYSQL_CLIENT */
public:
@@ -1680,7 +1649,6 @@ public:
THD_TRANS stmt; // Trans for current statement
bool on; // see ha_enable_transaction()
XID_STATE xid_state;
- Rows_log_event *m_pending_rows_event;
/*
Tables changed in transaction (that must be invalidated in query cache).
@@ -2102,12 +2070,6 @@ public:
/** number of name_const() substitutions, see sp_head.cc:subst_spvars() */
uint query_name_consts;
- /*
- If we do a purge of binary logs, log index info of the threads
- that are currently reading it needs to be adjusted. To do that
- each thread that is using LOG_INFO needs to adjust the pointer to it
- */
- LOG_INFO* current_linfo;
NET* slave_net; // network connection from slave -> m.
/* Used by the sys_var class to store temporary values */
union
@@ -2118,32 +2080,6 @@ public:
ulonglong ulonglong_value;
} sys_var_tmp;
- struct {
- /*
- If true, mysql_bin_log::write(Log_event) call will not write events to
- binlog, and maintain 2 below variables instead (use
- mysql_bin_log.start_union_events to turn this on)
- */
- bool do_union;
- /*
- If TRUE, at least one mysql_bin_log::write(Log_event) call has been
- made after last mysql_bin_log.start_union_events() call.
- */
- bool unioned_events;
- /*
- If TRUE, at least one mysql_bin_log::write(Log_event e), where
- e.cache_stmt == TRUE call has been made after last
- mysql_bin_log.start_union_events() call.
- */
- bool unioned_events_trans;
-
- /*
- 'queries' (actually SP statements) that run under inside this binlog
- union have thd->query_id >= first_query_id.
- */
- query_id_t first_query_id;
- } binlog_evt_union;
-
/**
Internal parser state.
Note that since the parser is not re-entrant, we keep only one parser
@@ -2783,6 +2719,8 @@ public:
*/
LEX_STRING invoker_user;
LEX_STRING invoker_host;
+
+ void* binlog_data;
};
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-03-01 06:23:58 +0000
+++ b/sql/sql_parse.cc 2011-03-03 07:45:12 +0000
@@ -5288,9 +5288,7 @@ void THD::reset_for_next_command()
thd->sent_row_count= thd->examined_row_count= 0;
thd->thd_marker.emb_on_expr_nest= NULL;
- binlog.reset_current_stmt_binlog_format_row(thd);
- thd->binlog_unsafe_warning_flags= 0;
-
+ binlog.reset_for_next_command(thd);
DBUG_PRINT("debug",
("is_current_stmt_binlog_format_row(): %d",
binlog.is_current_stmt_binlog_format_row(thd)));
Attachment: [text/bzr-bundle] bzr/hezx@greatopensource.com-20110303074512-71zrxrq22wxg33v2.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (hezx:3520) WL#5778 | He Zhenxing | 3 Mar |