mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
NDBAPI cleanup
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3861,6 +3865,7 @@ err:
|
||||
/* don't mess with the injector_ndb anymore from other threads */
|
||||
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
|
||||
@@ -3960,7 +3965,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));
|
||||
|
||||
Reference in New Issue
Block a user