diff options
author | unknown <mskold/marty@linux.site> | 2006-09-01 15:26:03 +0200 |
---|---|---|
committer | unknown <mskold/marty@linux.site> | 2006-09-01 15:26:03 +0200 |
commit | d225ffd750928471cd8101669778ebb3e2662da3 (patch) | |
tree | f38a702387b93f32f4ee18de42b1a50e717b9123 /sql/ha_ndbcluster_binlog.cc | |
parent | 72df0b3e303c457ce02ec1d6c839786c4cd53f22 (diff) | |
parent | 6138410cf08728e607e7bc80d8744953eeeef79a (diff) | |
download | mariadb-git-d225ffd750928471cd8101669778ebb3e2662da3.tar.gz |
Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
into mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb
sql/ha_ndbcluster.cc:
Auto merged
sql/ha_ndbcluster_binlog.cc:
Auto merged
storage/ndb/include/ndbapi/NdbTransaction.hpp:
Auto merged
storage/ndb/src/mgmapi/mgmapi.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
Auto merged
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp:
Auto merged
mysql-test/mysql-test-run.pl:
Merge
storage/ndb/include/ndbapi/ndb_cluster_connection.hpp:
Merge
Diffstat (limited to 'sql/ha_ndbcluster_binlog.cc')
-rw-r--r-- | sql/ha_ndbcluster_binlog.cc | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 594dca31567..4e59e0ef22a 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -25,6 +25,7 @@ #include "slave.h" #include "ha_ndbcluster_binlog.h" #include "NdbDictionary.hpp" +#include "ndb_cluster_connection.hpp" #include <util/NdbAutoPtr.hpp> #ifdef ndb_dynamite @@ -111,8 +112,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key, static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object, bool have_lock); -/* instantiated in storage/ndb/src/ndbapi/Ndbif.cpp */ -extern Uint64 g_latest_trans_gci; +static Uint64 *p_latest_trans_gci= 0; /* Global variables for holding the binlog_index table reference @@ -439,7 +439,7 @@ static void ndbcluster_binlog_wait(THD *thd) { DBUG_ENTER("ndbcluster_binlog_wait"); const char *save_info= thd ? thd->proc_info : 0; - ulonglong wait_epoch= g_latest_trans_gci; + ulonglong wait_epoch= *p_latest_trans_gci; int count= 30; if (thd) thd->proc_info= "Waiting for ndbcluster binlog update to " @@ -3284,6 +3284,7 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object, DBUG_VOID_RETURN; } + pthread_handler_t ndb_binlog_thread_func(void *arg) { THD *thd; /* needs to be first for thread_stack */ @@ -3292,6 +3293,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) Thd_ndb *thd_ndb=0; int ndb_update_binlog_index= 1; injector *inj= injector::instance(); + #ifdef RUN_NDB_BINLOG_TIMER Timer main_timer; #endif @@ -3380,6 +3382,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) */ injector_thd= thd; injector_ndb= i_ndb; + p_latest_trans_gci= + injector_ndb->get_ndb_cluster_connection().get_latest_trans_gci(); schema_ndb= s_ndb; ndb_binlog_thread_running= 1; if (opt_bin_log) @@ -3476,7 +3480,7 @@ restart: "ndb_latest_handled_binlog_epoch: %u, while current epoch: %u. " "RESET MASTER should be issued. Resetting ndb_latest_handled_binlog_epoch.", (unsigned) ndb_latest_handled_binlog_epoch, (unsigned) schema_gci); - g_latest_trans_gci= 0; + *p_latest_trans_gci= 0; ndb_latest_handled_binlog_epoch= 0; ndb_latest_applied_binlog_epoch= 0; ndb_latest_received_binlog_epoch= 0; @@ -3503,7 +3507,7 @@ restart: } do_ndbcluster_binlog_close_connection= BCCC_running; for ( ; !((abort_loop || do_ndbcluster_binlog_close_connection) && - ndb_latest_handled_binlog_epoch >= g_latest_trans_gci) && + ndb_latest_handled_binlog_epoch >= *p_latest_trans_gci) && do_ndbcluster_binlog_close_connection != BCCC_restart; ) { #ifndef DBUG_OFF @@ -3511,8 +3515,8 @@ restart: { DBUG_PRINT("info", ("do_ndbcluster_binlog_close_connection: %d, " "ndb_latest_handled_binlog_epoch: %llu, " - "g_latest_trans_gci: %llu", do_ndbcluster_binlog_close_connection, - ndb_latest_handled_binlog_epoch, g_latest_trans_gci)); + "*p_latest_trans_gci: %llu", do_ndbcluster_binlog_close_connection, + ndb_latest_handled_binlog_epoch, *p_latest_trans_gci)); } #endif #ifdef RUN_NDB_BINLOG_TIMER @@ -3548,7 +3552,7 @@ restart: } if ((abort_loop || do_ndbcluster_binlog_close_connection) && - (ndb_latest_handled_binlog_epoch >= g_latest_trans_gci || + (ndb_latest_handled_binlog_epoch >= *p_latest_trans_gci || !ndb_binlog_running)) break; /* Shutting down server */ @@ -3598,11 +3602,11 @@ restart: { DBUG_PRINT("info", ("do_ndbcluster_binlog_close_connection= BCCC_restart")); do_ndbcluster_binlog_close_connection= BCCC_restart; - if (ndb_latest_received_binlog_epoch < g_latest_trans_gci && ndb_binlog_running) + if (ndb_latest_received_binlog_epoch < *p_latest_trans_gci && ndb_binlog_running) { sql_print_error("NDB Binlog: latest transaction in epoch %lld not in binlog " "as latest received epoch is %lld", - g_latest_trans_gci, ndb_latest_received_binlog_epoch); + *p_latest_trans_gci, ndb_latest_received_binlog_epoch); } } } @@ -3784,11 +3788,11 @@ restart: { DBUG_PRINT("info", ("do_ndbcluster_binlog_close_connection= BCCC_restart")); do_ndbcluster_binlog_close_connection= BCCC_restart; - if (ndb_latest_received_binlog_epoch < g_latest_trans_gci && ndb_binlog_running) + if (ndb_latest_received_binlog_epoch < *p_latest_trans_gci && ndb_binlog_running) { sql_print_error("NDB Binlog: latest transaction in epoch %lld not in binlog " "as latest received epoch is %lld", - g_latest_trans_gci, ndb_latest_received_binlog_epoch); + *p_latest_trans_gci, ndb_latest_received_binlog_epoch); } } } @@ -3865,6 +3869,7 @@ err: ndb_obj_cnt+= ndbcluster_util_inited ? 1 : 0; injector_thd= 0; injector_ndb= 0; + p_latest_trans_gci= 0; schema_ndb= 0; pthread_mutex_unlock(&injector_mutex); thd->db= 0; // as not to try to free memory @@ -3985,7 +3990,7 @@ ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print, "latest_handled_binlog_epoch=%s, " "latest_applied_binlog_epoch=%s", llstr(ndb_latest_epoch, buff1), - llstr(g_latest_trans_gci, buff2), + llstr(*p_latest_trans_gci, buff2), llstr(ndb_latest_received_binlog_epoch, buff3), llstr(ndb_latest_handled_binlog_epoch, buff4), llstr(ndb_latest_applied_binlog_epoch, buff5)); |