|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|