summaryrefslogtreecommitdiff
path: root/sql/ha_ndbcluster.cc
diff options
context:
space:
mode:
authormagnus@neptunus.(none) <>2004-09-20 17:34:32 +0200
committermagnus@neptunus.(none) <>2004-09-20 17:34:32 +0200
commit08312bfb3267547c5fe58ca88b7f8d40be5e590a (patch)
treeb97499b516d00cf08e3248b9318bc154c11f474b /sql/ha_ndbcluster.cc
parent2a344c0bc1135091e535c41a5c274685b34b0018 (diff)
downloadmariadb-git-08312bfb3267547c5fe58ca88b7f8d40be5e590a.tar.gz
Merge changes
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r--sql/ha_ndbcluster.cc41
1 files changed, 11 insertions, 30 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index e657c76c12c..730aab8a928 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -32,8 +32,6 @@
#include <ndbapi/NdbApi.hpp>
#include <ndbapi/NdbScanFilter.hpp>
-//#define USE_NDB_POOL
-
// Default value for parallelism
static const int parallelism= 240;
@@ -125,6 +123,8 @@ static const err_code_mapping err_map[]=
{ 827, HA_ERR_RECORD_FILE_FULL },
{ 832, HA_ERR_RECORD_FILE_FULL },
+ { 0, 1 },
+
{ -1, -1 }
};
@@ -3536,13 +3536,7 @@ Thd_ndb* ha_ndbcluster::seize_thd_ndb()
Thd_ndb *thd_ndb;
DBUG_ENTER("seize_thd_ndb");
-#ifdef USE_NDB_POOL
- // Seize from pool
- ndb= Ndb::seize();
- xxxxxxxxxxxxxx error
-#else
thd_ndb= new Thd_ndb();
-#endif
thd_ndb->ndb->getDictionary()->set_local_table_data_size(sizeof(Ndb_table_local_info));
if (thd_ndb->ndb->init(max_transactions) != 0)
{
@@ -3563,56 +3557,45 @@ Thd_ndb* ha_ndbcluster::seize_thd_ndb()
void ha_ndbcluster::release_thd_ndb(Thd_ndb* thd_ndb)
{
DBUG_ENTER("release_thd_ndb");
-#ifdef USE_NDB_POOL
- // Release to pool
- Ndb::release(ndb);
- xxxxxxxxxxxx error
-#else
delete thd_ndb;
-#endif
DBUG_VOID_RETURN;
}
/*
- If this thread already has a Ndb object allocated
+ If this thread already has a Thd_ndb object allocated
in current THD, reuse it. Otherwise
- seize a Ndb object, assign it to current THD and use it.
-
- Having a Ndb object also means that a connection to
- NDB cluster has been opened.
+ seize a Thd_ndb object, assign it to current THD and use it.
*/
Ndb* check_ndb_in_thd(THD* thd)
{
DBUG_ENTER("check_ndb_in_thd");
- THD *thd= current_thd;
Thd_ndb *thd_ndb= (Thd_ndb*)thd->transaction.thd_ndb;
if (!thd_ndb)
{
- thd_ndb= seize_thd_ndb();
- if (!thd_ndb)
+ if (!(thd_ndb= ha_ndbcluster::seize_thd_ndb()))
DBUG_RETURN(NULL);
thd->transaction.thd_ndb= thd_ndb;
}
- DBUG_RETURN(ndb);
+ DBUG_RETURN(thd_ndb->ndb);
}
+
int ha_ndbcluster::check_ndb_connection()
{
THD* thd= current_thd;
- Ndb* ndb;
DBUG_ENTER("check_ndb_connection");
- if (!(ndb= check_ndb_in_thd(thd)))
+ if (!(m_ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(HA_ERR_NO_CONNECTION);
- m_ndb= thd_ndb->ndb;
m_ndb->setDatabaseName(m_dbname);
DBUG_RETURN(0);
}
+
void ndbcluster_close_connection(THD *thd)
{
Thd_ndb *thd_ndb= (Thd_ndb*)thd->transaction.thd_ndb;
@@ -3638,7 +3621,6 @@ int ndbcluster_discover(THD* thd, const char *db, const char *name,
const NDBTAB* tab;
Ndb* ndb;
DBUG_ENTER("ndbcluster_discover");
- ndb.getDictionary()->set_local_table_data_size(sizeof(Ndb_table_local_info));
DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
if (!(ndb= check_ndb_in_thd(thd)))
@@ -3646,6 +3628,7 @@ int ndbcluster_discover(THD* thd, const char *db, const char *name,
ndb->setDatabaseName(db);
NDBDICT* dict= ndb->getDictionary();
+ dict->set_local_table_data_size(sizeof(Ndb_table_local_info));
dict->invalidateTable(name);
if (!(tab= dict->getTable(name)))
{
@@ -3701,6 +3684,7 @@ int ndbcluster_table_exists(THD* thd, const char *db, const char *name)
ndb->setDatabaseName(db);
NDBDICT* dict= ndb->getDictionary();
+ dict->set_local_table_data_size(sizeof(Ndb_table_local_info));
dict->invalidateTable(name);
if (!(tab= dict->getTable(name)))
{
@@ -3821,9 +3805,6 @@ bool ndbcluster_end()
if (!ndbcluster_inited)
DBUG_RETURN(0);
hash_free(&ndbcluster_open_tables);
-#ifdef USE_NDB_POOL
- ndb_pool_release();
-#endif
pthread_mutex_destroy(&ndbcluster_mutex);
ndbcluster_inited= 0;
DBUG_RETURN(0);