#At file:///home/tomas/mysql_src/cge-6.2-global-schema-lock/
2683 Tomas Ulin 2008-10-02
add check for server shutdown/thread kill in all retry loops, and have
ndb-extra-logging on by default
modified:
mysql-test/mysql-test-run.pl
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
sql/ha_ndbcluster_connection.cc
sql/ha_ndbcluster_connection.h
sql/mysqld.cc
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2008-09-01 14:32:22 +0000
+++ b/mysql-test/mysql-test-run.pl 2008-10-02 15:52:29 +0000
@@ -3970,7 +3970,6 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--slave-allow-batching", $prefix);
if ( $mysql_version_id >= 50100 )
{
- mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
mtr_add_arg($args, "%s--ndb-log-orig", $prefix);
}
}
@@ -4047,7 +4046,6 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--slave-allow-batching", $prefix);
if ( $mysql_version_id >= 50100 )
{
- mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
mtr_add_arg($args, "%s--ndb-log-orig", $prefix);
}
}
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2008-10-02 09:26:18 +0000
+++ b/sql/ha_ndbcluster.cc 2008-10-02 15:52:29 +0000
@@ -157,9 +157,9 @@ static uchar *ndbcluster_get_key(NDB_SHA
static
NdbRecord *
ndb_get_table_statistics_ndbrecord(NDBDICT *, const NDBTAB *);
-static int ndb_get_table_statistics(ha_ndbcluster*, bool, Ndb*, const NDBTAB *,
+static int ndb_get_table_statistics(THD *thd, ha_ndbcluster*, bool, Ndb*, const NDBTAB *,
struct Ndb_statistics *);
-static int ndb_get_table_statistics(ha_ndbcluster*, bool, Ndb*,
+static int ndb_get_table_statistics(THD *thd, ha_ndbcluster*, bool, Ndb*,
const NdbRecord *, struct Ndb_statistics *);
THD *injector_thd= 0;
@@ -2887,7 +2887,7 @@ int ha_ndbcluster::ndb_write_row(uchar *
Ndb_tuple_id_range_guard g(m_share);
if (ndb->getAutoIncrementValue(m_table, g.range, auto_value, 1) == -1)
{
- if (--retries &&
+ if (--retries && !thd->killed &&
ndb->getNdbError().status == NdbError::TemporaryError)
{
do_retry_sleep(retry_sleep);
@@ -6464,7 +6464,7 @@ void ha_ndbcluster::get_auto_increment(u
ndb->readAutoIncrementValue(m_table, g.range, auto_value) ||
ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size,
increment, offset))
{
- if (--retries &&
+ if (--retries && !thd->killed &&
ndb->getNdbError().status == NdbError::TemporaryError)
{
do_retry_sleep(retry_sleep);
@@ -8068,7 +8068,7 @@ uint ndb_get_commitcount(THD *thd, char
{
Ndb_table_guard ndbtab_g(ndb->getDictionary(), tabname);
if (ndbtab_g.get_table() == 0
- || ndb_get_table_statistics(NULL, FALSE, ndb, ndbtab_g.get_table(), &stat))
+ || ndb_get_table_statistics(thd, NULL, FALSE, ndb, ndbtab_g.get_table(),
&stat))
{
/* ndb_share reference temporary free */
DBUG_PRINT("NDB_SHARE", ("%s temporary free use_count: %u",
@@ -8754,7 +8754,7 @@ int ha_ndbcluster::update_stats(THD *thd
{
DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM);
}
- if (int err= ndb_get_table_statistics(this, TRUE, ndb,
+ if (int err= ndb_get_table_statistics(thd, this, TRUE, ndb,
m_ndb_statistics_record, &stat))
{
DBUG_RETURN(err);
@@ -8822,7 +8822,7 @@ ndb_get_table_statistics_ndbrecord(NDBDI
static
int
-ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb,
+ndb_get_table_statistics(THD *thd, ha_ndbcluster* file, bool report_error, Ndb* ndb,
const NdbRecord *record,
struct Ndb_statistics * ndbstat)
{
@@ -8954,7 +8954,8 @@ retry:
ndb->closeTransaction(pTrans);
pTrans= NULL;
}
- if (error.status == NdbError::TemporaryError && retries--)
+ if (error.status == NdbError::TemporaryError &&
+ retries-- && !thd->killed)
{
do_retry_sleep(retry_sleep);
continue;
@@ -8971,7 +8972,7 @@ retry:
*/
static
int
-ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb,
+ndb_get_table_statistics(THD *thd, ha_ndbcluster* file, bool report_error, Ndb* ndb,
const NDBTAB *ndbtab,
struct Ndb_statistics *ndbstat)
{
@@ -8982,7 +8983,7 @@ ndb_get_table_statistics(ha_ndbcluster*
DBUG_ENTER("ndb_get_table_statistics");
ERR_RETURN(dict->getNdbError());
}
- int res= ndb_get_table_statistics(file, report_error, ndb, rec, ndbstat);
+ int res= ndb_get_table_statistics(thd, file, report_error, ndb, rec, ndbstat);
dict->releaseRecord(rec);
return res;
}
@@ -9798,7 +9799,7 @@ pthread_handler_t ndb_util_thread_func(v
}
Ndb_table_guard ndbtab_g(ndb->getDictionary(), share->table_name);
if (ndbtab_g.get_table() &&
- ndb_get_table_statistics(NULL, FALSE, ndb,
+ ndb_get_table_statistics(thd, NULL, FALSE, ndb,
ndbtab_g.get_table(), &stat) == 0)
{
#ifndef DBUG_OFF
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2008-10-02 06:39:01 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2008-10-02 15:52:29 +0000
@@ -1268,7 +1268,7 @@ static int ndbcluster_find_all_databases
ndb->closeTransaction(trans);
trans= NULL;
}
- if (ndb_error.status == NdbError::TemporaryError)
+ if (ndb_error.status == NdbError::TemporaryError && !thd->killed)
{
if (retries--)
{
@@ -1590,7 +1590,7 @@ ndbcluster_update_slock(THD *thd,
err:
const NdbError *this_error= trans ?
&trans->getNdbError() : &ndb->getNdbError();
- if (this_error->status == NdbError::TemporaryError)
+ if (this_error->status == NdbError::TemporaryError && !thd->killed)
{
if (retries--)
{
@@ -1939,7 +1939,7 @@ int ndbcluster_log_schema_op(THD *thd,
err:
const NdbError *this_error= trans ?
&trans->getNdbError() : &ndb->getNdbError();
- if (this_error->status == NdbError::TemporaryError)
+ if (this_error->status == NdbError::TemporaryError && !thd->killed)
{
if (retries--)
{
@@ -3747,7 +3747,7 @@ ndbcluster_create_event_ops(THD *thd, ND
op->setCustomData(NULL);
ndb->dropEventOperation(op);
pthread_mutex_unlock(&injector_mutex);
- if (retries)
+ if (retries && !thd->killed)
{
do_retry_sleep(retry_sleep);
continue;
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2008-10-02 06:39:01 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2008-10-02 15:52:29 +0000
@@ -266,12 +266,6 @@ set_thd_ndb(THD *thd, Thd_ndb *thd_ndb)
Ndb* check_ndb_in_thd(THD* thd);
-/* perform random sleep in the range milli_sleep to 2*milli_sleep */
-inline void do_retry_sleep(unsigned milli_sleep)
-{
- my_sleep(1000*(milli_sleep + 5*(rand()%(milli_sleep/5))));
-}
-
int ndbcluster_has_global_schema_lock(Thd_ndb *thd_ndb);
int ndbcluster_no_global_schema_lock_abort(THD *thd, const char *msg);
=== modified file 'sql/ha_ndbcluster_connection.cc'
--- a/sql/ha_ndbcluster_connection.cc 2008-04-09 13:52:09 +0000
+++ b/sql/ha_ndbcluster_connection.cc 2008-10-02 15:52:29 +0000
@@ -91,7 +91,9 @@ int ndbcluster_connect(int (*connect_cal
(now_time.tv_sec == end_time.tv_sec &&
now_time.tv_usec >= end_time.tv_usec))
break;
- sleep(1);
+ do_retry_sleep(100);
+ if (abort_loop)
+ goto ndbcluster_connect_error;
}
{
=== modified file 'sql/ha_ndbcluster_connection.h'
--- a/sql/ha_ndbcluster_connection.h 2008-04-09 13:52:09 +0000
+++ b/sql/ha_ndbcluster_connection.h 2008-10-02 15:52:29 +0000
@@ -23,3 +23,9 @@ int ndb_has_node_id(uint id);
/* options from from mysqld.cc */
extern ulong opt_ndb_cluster_connection_pool;
+
+/* perform random sleep in the range milli_sleep to 2*milli_sleep */
+inline void do_retry_sleep(unsigned milli_sleep)
+{
+ my_sleep(1000*(milli_sleep + 5*(rand()%(milli_sleep/5))));
+}
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2008-10-01 10:04:10 +0000
+++ b/sql/mysqld.cc 2008-10-02 15:52:29 +0000
@@ -5984,7 +5984,7 @@ master-ssl",
"Turn on more logging in the error log.",
(uchar**) &ndb_extra_logging,
(uchar**) &ndb_extra_logging,
- 0, GET_ULONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ 0, GET_ULONG, OPT_ARG, 1, 0, 0, 0, 0, 0},
#ifdef HAVE_NDB_BINLOG
{"ndb-report-thresh-binlog-epoch-slip", OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
"Threshold on number of epochs to be behind before reporting binlog status. "
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (tomas.ulin:2683) | Tomas Ulin | 3 Oct |