2693 Martin Skold 2008-10-14
Fix for crash in ha_ndbcluster::open->update_stats->ndb_get_table_statistics->ndb_err, close_cached_tables should not take LOCK_open (ndb_autodicovery3.test)
modified:
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
2692 Tomas Ulin 2008-10-09
add -debug to cluster binaries when applicable, fix out file name in mtr
modified:
mysql-test/mysql-test-run.pl
storage/ndb/include/util/ndb_opts.h
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2008-10-06 11:01:04 +0000
+++ b/sql/ha_ndbcluster.cc 2008-10-14 14:06:02 +0000
@@ -158,9 +158,11 @@ static
NdbRecord *
ndb_get_table_statistics_ndbrecord(NDBDICT *, const NDBTAB *);
static int ndb_get_table_statistics(THD *thd, ha_ndbcluster*, bool, Ndb*, const NDBTAB *,
- struct Ndb_statistics *);
+ struct Ndb_statistics *,
+ bool have_lock= FALSE);
static int ndb_get_table_statistics(THD *thd, ha_ndbcluster*, bool, Ndb*,
- const NdbRecord *, struct Ndb_statistics *);
+ const NdbRecord *, struct Ndb_statistics *,
+ bool have_lock= FALSE);
THD *injector_thd= 0;
@@ -490,7 +492,8 @@ static void set_ndb_err(THD *thd, const
DBUG_VOID_RETURN;
}
-int ha_ndbcluster::ndb_err(NdbTransaction *trans)
+int ha_ndbcluster::ndb_err(NdbTransaction *trans,
+ bool have_lock)
{
THD *thd= current_thd;
int res;
@@ -509,7 +512,7 @@ int ha_ndbcluster::ndb_err(NdbTransactio
bzero((char*) &table_list,sizeof(table_list));
table_list.db= m_dbname;
table_list.alias= table_list.table_name= m_tabname;
- close_cached_tables(thd, &table_list, FALSE, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, have_lock, FALSE, FALSE);
break;
}
default:
@@ -6698,7 +6701,7 @@ int ha_ndbcluster::open(const char *name
m_share= 0;
DBUG_RETURN(res);
}
- if ((res= update_stats(thd, 1)) ||
+ if ((res= update_stats(thd, 1, true)) ||
(res= info(HA_STATUS_CONST)))
{
free_share(&m_share);
@@ -8750,7 +8753,9 @@ struct ndb_table_statistics_row {
Uint64 var_mem;
};
-int ha_ndbcluster::update_stats(THD *thd, bool do_read_stat)
+int ha_ndbcluster::update_stats(THD *thd,
+ bool do_read_stat,
+ bool have_lock)
{
struct Ndb_statistics stat;
Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -8832,7 +8837,8 @@ static
int
ndb_get_table_statistics(THD *thd, ha_ndbcluster* file, bool report_error, Ndb* ndb,
const NdbRecord *record,
- struct Ndb_statistics * ndbstat)
+ struct Ndb_statistics * ndbstat,
+ bool have_lock)
{
NdbTransaction* pTrans;
NdbError error;
@@ -8945,7 +8951,7 @@ retry:
{
if (file && pTrans)
{
- reterr= file->ndb_err(pTrans);
+ reterr= file->ndb_err(pTrans, have_lock);
}
else
{
@@ -8982,7 +8988,8 @@ static
int
ndb_get_table_statistics(THD *thd, ha_ndbcluster* file, bool report_error, Ndb* ndb,
const NDBTAB *ndbtab,
- struct Ndb_statistics *ndbstat)
+ struct Ndb_statistics *ndbstat,
+ bool have_lock)
{
NDBDICT *dict= ndb->getDictionary();
NdbRecord *rec= ndb_get_table_statistics_ndbrecord(dict, ndbtab);
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2008-10-02 06:39:01 +0000
+++ b/sql/ha_ndbcluster.h 2008-10-14 14:06:02 +0000
@@ -454,7 +454,7 @@ static void set_tabname(const char *path
/*
* Internal to ha_ndbcluster, used by C functions
*/
- int ndb_err(NdbTransaction*);
+ int ndb_err(NdbTransaction*, bool have_lock= FALSE);
my_bool register_query_cache_table(THD *thd, char *table_key,
uint key_length,
@@ -722,7 +722,7 @@ private:
NdbIndexScanOperation *m_multi_cursor;
Ndb *get_ndb(THD *thd);
- int update_stats(THD *thd, bool do_read_stat);
+ int update_stats(THD *thd, bool do_read_stat, bool have_lock= FALSE);
};
extern SHOW_VAR ndb_status_variables[];
Thread |
---|
• bzr push into mysql-5.1 branch (Martin.Skold:2692 to 2693) | Martin Skold | 14 Oct |