summaryrefslogtreecommitdiff
path: root/ndb/src/ndbapi
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2006-05-15 18:44:17 +0200
committerunknown <tomas@poseidon.ndb.mysql.com>2006-05-15 18:44:17 +0200
commit84b8f11141cd3b316ef20cc9dd48cbf628c5f0a0 (patch)
tree2c9defe480c37bc589de7951ad0c1c1cfe25cd2c /ndb/src/ndbapi
parent9ffa09be96e39a753d70176b9b25cc1a298a9159 (diff)
parente399658517f7d9efbc133870aace09b7bfc6f1b0 (diff)
downloadmariadb-git-84b8f11141cd3b316ef20cc9dd48cbf628c5f0a0.tar.gz
Merge poseidon.ndb.mysql.com:/home/tomas/mysql-4.1
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0 ndb/src/ndbapi/DictCache.cpp: Auto merged ndb/src/ndbapi/DictCache.hpp: Auto merged ndb/src/ndbapi/TransporterFacade.hpp: Auto merged ndb/src/ndbapi/ndb_cluster_connection.cpp: Auto merged ndb/src/ndbapi/ndb_cluster_connection_impl.hpp: Auto merged sql/ha_ndbcluster.cc: Auto merged ndb/include/ndbapi/ndb_cluster_connection.hpp: manual merge ndb/src/ndbapi/ClusterMgr.cpp: manual merge ndb/src/ndbapi/ClusterMgr.hpp: manual merge
Diffstat (limited to 'ndb/src/ndbapi')
-rw-r--r--ndb/src/ndbapi/ClusterMgr.cpp5
-rw-r--r--ndb/src/ndbapi/ClusterMgr.hpp1
-rw-r--r--ndb/src/ndbapi/DictCache.cpp36
-rw-r--r--ndb/src/ndbapi/DictCache.hpp3
-rw-r--r--ndb/src/ndbapi/TransporterFacade.hpp6
-rw-r--r--ndb/src/ndbapi/ndb_cluster_connection.cpp6
-rw-r--r--ndb/src/ndbapi/ndb_cluster_connection_impl.hpp1
7 files changed, 58 insertions, 0 deletions
diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp
index 42b7c5b115d..fbff57d3168 100644
--- a/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/ndb/src/ndbapi/ClusterMgr.cpp
@@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
noOfAliveNodes= 0;
noOfConnectedNodes= 0;
theClusterMgrThread= 0;
+ m_connect_count = 0;
DBUG_VOID_RETURN;
}
@@ -469,6 +470,10 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
theNode.nfCompleteRep = false;
if(noOfAliveNodes == 0)
{
+ theFacade.m_globalDictCache.lock();
+ theFacade.m_globalDictCache.invalidate_all();
+ theFacade.m_globalDictCache.unlock();
+ m_connect_count ++;
NFCompleteRep rep;
for(Uint32 i = 1; i<MAX_NODES; i++){
if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){
diff --git a/ndb/src/ndbapi/ClusterMgr.hpp b/ndb/src/ndbapi/ClusterMgr.hpp
index da8f16d6789..1a1e622a889 100644
--- a/ndb/src/ndbapi/ClusterMgr.hpp
+++ b/ndb/src/ndbapi/ClusterMgr.hpp
@@ -79,6 +79,7 @@ public:
Uint32 getNoOfConnectedNodes() const;
void hb_received(NodeId);
+ Uint32 m_connect_count;
private:
Uint32 noOfAliveNodes;
Uint32 noOfConnectedNodes;
diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp
index 57d9b361522..740f67da2df 100644
--- a/ndb/src/ndbapi/DictCache.cpp
+++ b/ndb/src/ndbapi/DictCache.cpp
@@ -300,6 +300,42 @@ GlobalDictCache::drop(NdbTableImpl * tab)
abort();
}
+
+unsigned
+GlobalDictCache::get_size()
+{
+ NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
+ int sz = 0;
+ while(curr != 0){
+ sz += curr->theData->size();
+ curr = m_tableHash.getNext(curr);
+ }
+ return sz;
+}
+
+void
+GlobalDictCache::invalidate_all()
+{
+ DBUG_ENTER("GlobalDictCache::invalidate_all");
+ NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
+ while(curr != 0){
+ Vector<TableVersion> * vers = curr->theData;
+ if (vers->size())
+ {
+ TableVersion * ver = & vers->back();
+ ver->m_impl->m_status = NdbDictionary::Object::Invalid;
+ ver->m_status = DROPPED;
+ if (ver->m_refCount == 0)
+ {
+ delete ver->m_impl;
+ vers->erase(vers->size() - 1);
+ }
+ }
+ curr = m_tableHash.getNext(curr);
+ }
+ DBUG_VOID_RETURN;
+}
+
void
GlobalDictCache::release(NdbTableImpl * tab)
{
diff --git a/ndb/src/ndbapi/DictCache.hpp b/ndb/src/ndbapi/DictCache.hpp
index 2df6a139542..6afa7946a8e 100644
--- a/ndb/src/ndbapi/DictCache.hpp
+++ b/ndb/src/ndbapi/DictCache.hpp
@@ -71,6 +71,9 @@ public:
void alter_table_rep(const char * name,
Uint32 tableId, Uint32 tableVersion, bool altered);
+
+ unsigned get_size();
+ void invalidate_all();
public:
enum Status {
OK = 0,
diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp
index bdd6fb3d05c..48e1c8ed25f 100644
--- a/ndb/src/ndbapi/TransporterFacade.hpp
+++ b/ndb/src/ndbapi/TransporterFacade.hpp
@@ -271,6 +271,12 @@ TransporterFacade::unlock_mutex()
#include "ClusterMgr.hpp"
inline
+unsigned Ndb_cluster_connection_impl::get_connect_count() const
+{
+ return TransporterFacade::instance()->theClusterMgr->m_connect_count;
+}
+
+inline
bool
TransporterFacade::check_send_size(Uint32 node_id, Uint32 send_size)
{
diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp
index 6c3d08d981d..1e53558f179 100644
--- a/ndb/src/ndbapi/ndb_cluster_connection.cpp
+++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp
@@ -243,6 +243,12 @@ Ndb_cluster_connection::wait_until_ready(int timeout,
} while (1);
}
+unsigned Ndb_cluster_connection::get_connect_count() const
+{
+ return m_impl.get_connect_count();
+}
+
+
/*
diff --git a/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp b/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
index b305b93fec1..a50d3004364 100644
--- a/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
+++ b/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
@@ -49,6 +49,7 @@ class Ndb_cluster_connection_impl : public Ndb_cluster_connection
void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
Uint32 get_next_node(Ndb_cluster_connection_node_iter &iter);
+ inline unsigned get_connect_count() const;
private:
friend class Ndb;
friend class NdbImpl;