summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 9b48e0d4f38..0e9dfcef5fb 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -5011,27 +5011,36 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked)
set_dbname(name);
set_tabname(name);
- if (check_ndb_connection()) {
- free_share(m_share); m_share= 0;
- DBUG_RETURN(HA_ERR_NO_CONNECTION);
+ if ((res= check_ndb_connection()) ||
+ (res= get_metadata(name)))
+ {
+ free_share(m_share);
+ m_share= 0;
+ DBUG_RETURN(res);
}
-
- res= get_metadata(name);
- if (!res)
+ while (1)
{
Ndb *ndb= get_ndb();
if (ndb->setDatabaseName(m_dbname))
{
- ERR_RETURN(ndb->getNdbError());
+ res= ndb_to_mysql_error(&ndb->getNdbError());
+ break;
}
struct Ndb_statistics stat;
res= ndb_get_table_statistics(NULL, false, ndb, m_tabname, &stat);
records= stat.row_count;
if(!res)
res= info(HA_STATUS_CONST);
+ break;
}
-
- DBUG_RETURN(res);
+ if (res)
+ {
+ free_share(m_share);
+ m_share= 0;
+ release_metadata();
+ DBUG_RETURN(res);
+ }
+ DBUG_RETURN(0);
}