#At file:///home/msvensson/mysql/bug11885602/7.0/ based on revid:magnus.blaudd@stripped
4403 magnus.blaudd@stripped 2011-05-23
Bug#12581954 - ndbinfo need to reload its cache of ndbinfo tables during online upgrade
- When upgrading the MySQL Servers in a cluster before the datanodes, the
ndbinfo API does not flush it's cache of ndbinfo tables and columns. Only
full disconnect of the cluster is currently detected. And of course
restarting the MySQL Server
- Make ndbinfo api detect when the "min db version" of cluster has changed.
modified:
storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
storage/ndb/src/ndbapi/NdbInfo.cpp
storage/ndb/src/ndbapi/NdbInfo.hpp
storage/ndb/src/ndbapi/TransporterFacade.hpp
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
=== modified file 'storage/ndb/include/ndbapi/ndb_cluster_connection.hpp'
--- a/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp 2011-02-04 17:52:38 +0000
+++ b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp 2011-05-23 14:05:08 +0000
@@ -192,6 +192,7 @@ public:
unsigned max_nodegroup();
unsigned node_id();
unsigned get_connect_count() const;
+ unsigned get_min_db_version() const;
void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
unsigned int get_next_node(Ndb_cluster_connection_node_iter &iter);
=== modified file 'storage/ndb/src/ndbapi/NdbInfo.cpp'
--- a/storage/ndb/src/ndbapi/NdbInfo.cpp 2011-02-02 00:40:07 +0000
+++ b/storage/ndb/src/ndbapi/NdbInfo.cpp 2011-05-23 14:05:08 +0000
@@ -23,6 +23,7 @@ NdbInfo::NdbInfo(class Ndb_cluster_conne
const char* prefix, const char* dbname,
const char* table_prefix) :
m_connect_count(connection->get_connect_count()),
+ m_min_db_version(0),
m_connection(connection),
m_tables_table(NULL), m_columns_table(NULL),
m_prefix(prefix),
@@ -270,7 +271,9 @@ bool NdbInfo::load_tables()
}
// After sucessfull load of the tables, set connect count
+ // and the min db version of cluster
m_connect_count = m_connection->get_connect_count();
+ m_min_db_version = m_connection->get_min_db_version();
return true;
}
@@ -328,12 +331,14 @@ void NdbInfo::flush_tables()
bool
NdbInfo::check_tables()
{
- if (m_connection->get_connect_count() != m_connect_count)
+ if (unlikely(m_connection->get_connect_count() != m_connect_count ||
+ m_connection->get_min_db_version() != m_min_db_version))
{
- // Connect count has changed -> flush the cached table definitions
+ // Connect count or min db version of cluster has changed
+ // -> flush the cached table definitions
flush_tables();
}
- if (m_tables.entries() <= NUM_HARDCODED_TABLES)
+ if (unlikely(m_tables.entries() <= NUM_HARDCODED_TABLES))
{
// Global table cache is not loaded yet or has been
// flushed, try to load it
=== modified file 'storage/ndb/src/ndbapi/NdbInfo.hpp'
--- a/storage/ndb/src/ndbapi/NdbInfo.hpp 2011-02-02 00:40:07 +0000
+++ b/storage/ndb/src/ndbapi/NdbInfo.hpp 2011-05-23 14:05:08 +0000
@@ -89,8 +89,6 @@ public:
bool init(void);
~NdbInfo();
- void flush_tables();
-
int openTable(const char* table_name, const Table**);
int openTable(Uint32 tableId, const Table**);
void closeTable(const Table* table);
@@ -103,6 +101,7 @@ public:
private:
static const size_t NUM_HARDCODED_TABLES = 2;
unsigned m_connect_count;
+ unsigned m_min_db_version;
class Ndb_cluster_connection* m_connection;
pthread_mutex_t m_mutex;
HashMap<BaseString, Table, BaseString_get_key> m_tables;
@@ -119,6 +118,7 @@ private:
bool load_hardcoded_tables(void);
bool load_tables();
bool check_tables();
+ void flush_tables();
BaseString mysql_table_name(const char* table_name) const;
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp 2011-02-24 07:47:22 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp 2011-05-23 14:05:08 +0000
@@ -303,6 +303,12 @@ unsigned Ndb_cluster_connection_impl::ge
}
inline
+unsigned Ndb_cluster_connection_impl::get_min_db_version() const
+{
+ return m_transporter_facade->getMinDbNodeVersion();
+}
+
+inline
bool
TransporterFacade::get_node_alive(NodeId n) const {
if (theClusterMgr)
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2011-04-15 06:29:59 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2011-05-23 14:05:08 +0000
@@ -332,6 +332,11 @@ unsigned Ndb_cluster_connection::get_con
return m_impl.get_connect_count();
}
+unsigned Ndb_cluster_connection::get_min_db_version() const
+{
+ return m_impl.get_min_db_version();
+}
+
int Ndb_cluster_connection::get_latest_error() const
{
return m_impl.m_latest_error;
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2011-02-04 17:52:38 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2011-05-23 14:05:08 +0000
@@ -67,6 +67,7 @@ class Ndb_cluster_connection_impl : publ
Uint32 get_next_alive_node(Ndb_cluster_connection_node_iter &iter);
inline unsigned get_connect_count() const;
+ inline unsigned get_min_db_version() const;
public:
inline Uint64 *get_latest_trans_gci() { return &m_latest_trans_gci; }
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@oracle.com-20110523140508-n138x9hzgspgadzs.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:4403) Bug#12581954 | magnus.blaudd | 23 May |