4200 Magnus Blåudd 2011-02-16
ndb
- fix faulty DBUG_ENTER
modified:
sql/ha_ndbcluster.cc
4199 Magnus Blåudd 2011-02-16
ndb - fix fauulty DBUG_PRINT
modified:
sql/ha_ndbcluster.cc
4198 Magnus Blåudd 2011-02-16
ndb
- cherrypick from 5.5-telco-7.0
- Straigthen up the interface of ndb_binlog allowing to hide its internals
-- Rename ndbcluster_setup_binlog_table_shares to ndb_binlog_setup and
make it return true or false for sucess/fail
-- Make "ndb_binlog_tables_inited" variable local to ha_ndbcluster_binlog
-- Add function ndb_binlog_is_read_only() which return false as long as the
binlog is not ready and we only allow to open tables in read only mode.
-- Make "ndb_binlog_is_ready" variable local to ha_ndbcluster_binlog
-- Remove the first call to ndb_binlog_setup, calling it once
every second until it succeeds and regularly thereafter should be enough.
modified:
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
4197 Magnus Blåudd 2011-02-16
ndb
- remove unimplemented declaration, ha_ndbcluster::alter_tablespace
modified:
sql/ha_ndbcluster.h
4196 jonas oreland 2011-02-15
ndb - fix embarrasing bug with uninitialized startFragReq->requestInfo during sr
modified:
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-02-09 11:25:52 +0000
+++ b/sql/ha_ndbcluster.cc 2011-02-16 08:33:08 +0000
@@ -7955,7 +7955,7 @@ static int create_ndb_column(THD *thd,
void ha_ndbcluster::update_create_info(HA_CREATE_INFO *create_info)
{
- DBUG_ENTER("update_create_info");
+ DBUG_ENTER("ha_ndbcluster::update_create_info");
THD *thd= current_thd;
const NDBTAB *ndbtab= m_table;
Ndb *ndb= check_ndb_in_thd(thd);
@@ -9696,8 +9696,7 @@ int ha_ndbcluster::open(const char *name
local_close(thd, TRUE);
DBUG_RETURN(res);
}
- if (!ndb_binlog_tables_inited ||
- (ndb_binlog_running && !ndb_binlog_is_ready))
+ if (ndb_binlog_is_read_only())
{
table->db_stat|= HA_READ_ONLY;
sql_print_information("table '%s' opened read only", name);
@@ -13133,8 +13132,6 @@ pthread_handler_t ndb_util_thread_func(v
if (opt_ndb_extra_logging && ndb_binlog_running)
sql_print_information("NDB Binlog: Ndb tables initially read only.");
- /* create tables needed by the replication */
- ndbcluster_setup_binlog_table_shares(thd);
set_timespec(abstime, 0);
for (;;)
@@ -13153,23 +13150,28 @@ pthread_handler_t ndb_util_thread_func(v
#endif
/*
- Check that the ndb_apply_status_share and ndb_schema_share
- have been created.
- If not try to create it
+ Check if the Ndb object in thd_ndb is still valid(it will be
+ invalid if connection to cluster has been lost) and recycle
+ it if necessary.
*/
if (!check_ndb_in_thd(thd, false))
{
set_timespec(abstime, 1);
continue;
}
- if (!ndb_binlog_tables_inited)
+
+ /*
+ Regularly give the ndb_binlog component chance to set it self up
+ i.e at first start it needs to create the ndb_* system tables
+ and setup event operations on those. In case of lost connection
+ to cluster, the ndb_* system tables are hopefully still there
+ but the event operations need to be recreated.
+ */
+ if (!ndb_binlog_setup(thd))
{
- ndbcluster_setup_binlog_table_shares(thd);
- if (!ndb_binlog_tables_inited)
- {
- set_timespec(abstime, 1);
- continue;
- }
+ /* Failed to setup binlog, try again in 1 second */
+ set_timespec(abstime, 1);
+ continue;
}
if (opt_ndb_cache_check_time == 0)
@@ -14567,7 +14569,7 @@ int ndbcluster_alter_tablespace(handlert
int error;
const char *errmsg;
Ndb *ndb;
- DBUG_ENTER("ha_ndbcluster::alter_tablespace");
+ DBUG_ENTER("ndbcluster_alter_tablespace");
LINT_INIT(errmsg);
ndb= check_ndb_in_thd(thd);
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2011-01-27 17:57:43 +0000
+++ b/sql/ha_ndbcluster.h 2011-02-16 06:02:34 +0000
@@ -416,7 +416,6 @@ class ha_ndbcluster: public handler
bool eq_range, bool sorted,
uchar* buf);
int read_range_next();
- int alter_tablespace(st_alter_tablespace *info);
#ifndef NDB_WITH_NEW_MRR_INTERFACE
/**
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-02-08 10:07:46 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-02-16 06:10:50 +0000
@@ -76,8 +76,29 @@ static int ndb_binlog_thread_running= 0;
FALSE if not
*/
my_bool ndb_binlog_running= FALSE;
-my_bool ndb_binlog_tables_inited= FALSE;
-my_bool ndb_binlog_is_ready= FALSE;
+static my_bool ndb_binlog_tables_inited= FALSE;
+static my_bool ndb_binlog_is_ready= FALSE;
+
+bool
+ndb_binlog_is_read_only(void)
+{
+ if(!ndb_binlog_tables_inited)
+ {
+ /* the ndb_* system tables not setup yet */
+ return true;
+ }
+
+ if (ndb_binlog_running && !ndb_binlog_is_ready)
+ {
+ /*
+ The binlog thread is supposed to write to binlog
+ but not ready (still initializing or has lost connection)
+ */
+ return true;
+ }
+ return false;
+}
+
/*
Global reference to the ndb injector thread THD oject
@@ -1554,11 +1575,15 @@ static int ndbcluster_find_all_databases
}
}
-int ndbcluster_setup_binlog_table_shares(THD *thd)
+bool
+ndb_binlog_setup(THD *thd)
{
+ if (ndb_binlog_tables_inited)
+ return true; // Already setup -> OK
+
Ndbcluster_global_schema_lock_guard global_schema_lock_guard(thd);
if (global_schema_lock_guard.lock())
- return 1;
+ return false;
if (!ndb_schema_share &&
ndbcluster_check_ndb_schema_share() == 0)
{
@@ -1570,7 +1595,7 @@ int ndbcluster_setup_binlog_table_shares
ndbcluster_create_schema_table(thd);
// always make sure we create the 'schema' first
if (!ndb_schema_share)
- return 1;
+ return false;
}
}
if (!ndb_apply_status_share &&
@@ -1583,13 +1608,13 @@ int ndbcluster_setup_binlog_table_shares
{
ndbcluster_create_ndb_apply_status_table(thd);
if (!ndb_apply_status_share)
- return 1;
+ return false;
}
}
if (ndbcluster_find_all_databases(thd))
{
- return 1;
+ return false;
}
if (!ndbcluster_find_all_files(thd))
@@ -1612,8 +1637,10 @@ int ndbcluster_setup_binlog_table_shares
mysql_mutex_unlock(&LOCK_open);
/* Signal injector thread that all is setup */
pthread_cond_signal(&injector_cond);
+
+ return true; // Setup completed -> OK
}
- return 0;
+ return false;
}
/*
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2011-02-08 10:09:53 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2011-02-16 06:10:50 +0000
@@ -250,13 +250,27 @@ int ndb_create_table_from_engine(THD *th
const char *table_name);
int ndbcluster_binlog_start();
-int ndbcluster_setup_binlog_table_shares(THD *thd);
+
+/*
+ Setup function for the ndb binlog component. The function should be
+ called on startup until it succeeds(to allow initial setup) and with
+ regular intervals afterwards to reconnect after a lost cluster
+ connection
+*/
+bool ndb_binlog_setup(THD *thd);
+
+/*
+ Will return true when the ndb binlog component is properly setup
+ and ready to receive events from the cluster. As long as function
+ returns false, all tables in this MySQL Server are opened in read only
+ mode to avoid writes before the binlog is ready to record them.
+ */
+bool ndb_binlog_is_read_only(void);
+
extern NDB_SHARE *ndb_apply_status_share;
extern NDB_SHARE *ndb_schema_share;
extern my_bool ndb_binlog_running;
-extern my_bool ndb_binlog_tables_inited;
-extern my_bool ndb_binlog_is_ready;
bool
ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print,
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:4196 to 4200) | Magnus Blåudd | 16 Feb |