diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-09-27 20:09:46 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-09-27 20:09:46 +0200 |
commit | 474fe6d9d9e0b4d8803bdf439dd017ba0c729729 (patch) | |
tree | 6b088655217934bf0cbb6cdf85df0a217ef1d939 /plugin/semisync | |
parent | cd9f773020c6ddfc1ea39e9037e4258b8bc32a08 (diff) | |
download | mariadb-git-474fe6d9d9e0b4d8803bdf439dd017ba0c729729.tar.gz |
fixes for test failures
and small collateral changes
mysql-test/lib/My/Test.pm:
somehow with "print" we get truncated writes sometimes
mysql-test/suite/perfschema/r/digest_table_full.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/dml_handler.result:
host table is not ported over yet
mysql-test/suite/perfschema/r/information_schema.result:
host table is not ported over yet
mysql-test/suite/perfschema/r/nesting.result:
this differs, because we don't rewrite general log queries, and multi-statement
packets are logged as a one entry. this result file is identical to what mysql-5.6.5
produces with the --log-raw option.
mysql-test/suite/perfschema/r/relaylog.result:
MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB.
mysql-test/suite/perfschema/r/server_init.result:
MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup.
mysql-test/suite/perfschema/r/stage_mdl_global.result:
this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not
do that, and this causes useless mutex locks and waits.
mysql-test/suite/perfschema/r/statement_digest.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_consumers.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_long_query.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result:
will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
Diffstat (limited to 'plugin/semisync')
-rw-r--r-- | plugin/semisync/semisync.h | 1 | ||||
-rw-r--r-- | plugin/semisync/semisync_master.cc | 26 | ||||
-rw-r--r-- | plugin/semisync/semisync_master.h | 2 | ||||
-rw-r--r-- | plugin/semisync/semisync_master_plugin.cc | 20 |
4 files changed, 35 insertions, 14 deletions
diff --git a/plugin/semisync/semisync.h b/plugin/semisync/semisync.h index 57353f3c156..80d7624f73a 100644 --- a/plugin/semisync/semisync.h +++ b/plugin/semisync/semisync.h @@ -21,6 +21,7 @@ #define MYSQL_SERVER #define HAVE_REPLICATION #include <sql_priv.h> +#include <sql_class.h> #include "unireg.h" #include <my_global.h> #include <my_pthread.h> diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 3fef4b67aac..cc770ff39a1 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -48,7 +48,11 @@ static int getWaitTime(const struct timespec& start_ts); static unsigned long long timespec_to_usec(const struct timespec *ts) { +#ifndef __WIN__ return (unsigned long long) ts->tv_sec * TIME_MILLION + ts->tv_nsec / TIME_THOUSAND; +#else + return ts->tv.i64 / 10; +#endif /* __WIN__ */ } /******************************************************************************* @@ -604,7 +608,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, struct timespec start_ts; struct timespec abstime; int wait_result; - const char *old_msg= 0; + PSI_stage_info old_stage; set_timespec(start_ts, 0); @@ -613,8 +617,9 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, lock(); /* This must be called after acquired the lock */ - old_msg= thd_enter_cond(NULL, &COND_binlog_send_, &LOCK_binlog_, - "Waiting for semi-sync ACK from slave"); + THD_ENTER_COND(NULL, &COND_binlog_send_, &LOCK_binlog_, + & stage_waiting_for_semi_sync_ack_from_slave, + & old_stage); /* This is the real check inside the mutex. */ if (!getMasterEnabled() || !is_on()) @@ -627,7 +632,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, (int)is_on()); } - while (is_on() && !thd_killed(NULL)) + while (is_on()) { if (reply_file_name_inited_) { @@ -676,6 +681,10 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, } /* Calcuate the waiting period. */ +#ifdef __WIN__ + abstime.tv.i64 = start_ts.tv.i64 + (__int64)wait_timeout_ * TIME_THOUSAND * 10; + abstime.max_timeout_msec= (long)wait_timeout_; +#else unsigned long long diff_nsecs = start_ts.tv_nsec + (unsigned long long)wait_timeout_ * TIME_MILLION; abstime.tv_sec = start_ts.tv_sec; @@ -684,7 +693,8 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, abstime.tv_sec++; diff_nsecs -= TIME_BILLION; } - abstime.tv_nsec = (long)diff_nsecs; + abstime.tv_nsec = diff_nsecs; +#endif /* __WIN__ */ /* In semi-synchronous replication, we wait until the binlog-dump * thread has received the reply on the relevant binlog segment from the @@ -743,9 +753,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, At this point, the binlog file and position of this transaction must have been removed from ActiveTranx. */ - assert(thd_killed(NULL) || - !getMasterEnabled() || - !active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, + assert(!active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, trx_wait_binlog_pos)); l_end: @@ -757,7 +765,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, /* The lock held will be released by thd_exit_cond, so no need to call unlock() here */ - thd_exit_cond(NULL, old_msg); + THD_EXIT_COND(NULL, & old_stage); } return function_exit(kWho, 0); diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index 841c24197fc..18143241e7c 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -26,6 +26,8 @@ extern PSI_mutex_key key_ss_mutex_LOCK_binlog_; extern PSI_cond_key key_ss_cond_COND_binlog_send_; #endif +extern PSI_stage_info stage_waiting_for_semi_sync_ack_from_slave; + struct TranxNode { char log_name_[FN_REFLEN]; my_off_t log_pos_; diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc index 9a325018242..20c9911e92a 100644 --- a/plugin/semisync/semisync_master_plugin.cc +++ b/plugin/semisync/semisync_master_plugin.cc @@ -354,20 +354,30 @@ static PSI_cond_info all_semisync_conds[]= { { &key_ss_cond_COND_binlog_send_, "COND_binlog_send_", 0} }; +#endif /* HAVE_PSI_INTERFACE */ + +PSI_stage_info stage_waiting_for_semi_sync_ack_from_slave= +{ 0, "Waiting for semi-sync ACK from slave", 0}; + +#ifdef HAVE_PSI_INTERFACE +PSI_stage_info *all_semisync_stages[]= +{ + & stage_waiting_for_semi_sync_ack_from_slave +}; static void init_semisync_psi_keys(void) { const char* category= "semisync"; int count; - if (PSI_server == NULL) - return; - count= array_elements(all_semisync_mutexes); - PSI_server->register_mutex(category, all_semisync_mutexes, count); + mysql_mutex_register(category, all_semisync_mutexes, count); count= array_elements(all_semisync_conds); - PSI_server->register_cond(category, all_semisync_conds, count); + mysql_cond_register(category, all_semisync_conds, count); + + count= array_elements(all_semisync_stages); + mysql_stage_register(category, all_semisync_stages, count); } #endif /* HAVE_PSI_INTERFACE */ |