Commit 18e6090c authored by unknown's avatar unknown

Bug#25818 No return of NDB share object in failures in open method

- make sure resources are release properly on error

parent 28d9a827
...@@ -5011,27 +5011,36 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) ...@@ -5011,27 +5011,36 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked)
set_dbname(name); set_dbname(name);
set_tabname(name); set_tabname(name);
if (check_ndb_connection()) { if ((res= check_ndb_connection()) ||
free_share(m_share); m_share= 0; (res= get_metadata(name)))
DBUG_RETURN(HA_ERR_NO_CONNECTION); {
free_share(m_share);
m_share= 0;
DBUG_RETURN(res);
} }
while (1)
res= get_metadata(name);
if (!res)
{ {
Ndb *ndb= get_ndb(); Ndb *ndb= get_ndb();
if (ndb->setDatabaseName(m_dbname)) if (ndb->setDatabaseName(m_dbname))
{ {
ERR_RETURN(ndb->getNdbError()); res= ndb_to_mysql_error(&ndb->getNdbError());
break;
} }
struct Ndb_statistics stat; struct Ndb_statistics stat;
res= ndb_get_table_statistics(NULL, false, ndb, m_tabname, &stat); res= ndb_get_table_statistics(NULL, false, ndb, m_tabname, &stat);
records= stat.row_count; records= stat.row_count;
if(!res) if(!res)
res= info(HA_STATUS_CONST); res= info(HA_STATUS_CONST);
break;
} }
if (res)
DBUG_RETURN(res); {
free_share(m_share);
m_share= 0;
release_metadata();
DBUG_RETURN(res);
}
DBUG_RETURN(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment