2
Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
#ifndef CLUSTER_CONNECTION_IMPL_HPP
20
#define CLUSTER_CONNECTION_IMPL_HPP
22
#include <ndb_cluster_connection.hpp>
25
#include "DictCache.hpp"
27
extern NdbMutex *g_ndb_connection_mutex;
29
class TransporterFacade;
30
class ConfigRetriever;
32
struct ndb_mgm_configuration;
36
void* run_ndb_cluster_connection_connect_thread(void*);
42
m_scan_batch_size(MAX_SCAN_BATCH_SIZE),
43
m_batch_byte_size(SCAN_BATCH_SIZE),
44
m_batch_size(DEF_BATCH_SIZE),
45
m_waitfor_timeout(120000),
46
m_default_queue_option(0)
49
Uint32 m_scan_batch_size;
50
Uint32 m_batch_byte_size;
52
Uint32 m_waitfor_timeout; // in milli seconds...
53
Uint32 m_default_queue_option;
56
class Ndb_cluster_connection_impl : public Ndb_cluster_connection
58
Ndb_cluster_connection_impl(const char *connectstring,
59
Ndb_cluster_connection *main_connection,
60
int force_api_nodeid);
61
~Ndb_cluster_connection_impl();
65
void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
66
Uint32 get_next_node(Ndb_cluster_connection_node_iter &iter);
67
Uint32 get_next_alive_node(Ndb_cluster_connection_node_iter &iter);
69
inline unsigned get_connect_count() const;
70
inline unsigned get_min_db_version() const;
72
inline Uint64 *get_latest_trans_gci() { return &m_latest_trans_gci; }
77
friend void* run_ndb_cluster_connection_connect_thread(void*);
78
friend class Ndb_cluster_connection;
79
friend class NdbEventBuffer;
80
friend class SignalSender;
84
Node(Uint32 _g= 0, Uint32 _id= 0) : this_group(0),
94
Vector<Node> m_all_nodes;
95
int init_nodes_vector(Uint32 nodeid, const ndb_mgm_configuration &config);
96
int configure(Uint32 nodeid, const ndb_mgm_configuration &config);
97
void connect_thread();
98
void set_name(const char *name);
99
Uint32 get_db_nodes(Uint8 nodesarray[MAX_NDB_NODES]) const;
101
int connect(int no_retries,
102
int retry_delay_in_seconds,
105
Ndb_cluster_connection *m_main_connection;
106
GlobalDictCache *m_globalDictCache;
107
TransporterFacade *m_transporter_facade;
108
ConfigRetriever *m_config_retriever;
109
NdbThread *m_connect_thread;
110
int (*m_connect_callback)(void);
112
int m_optimized_node_selection;
113
int m_run_connect_thread;
114
NdbMutex *m_event_add_drop_mutex;
115
Uint64 m_latest_trans_gci;
117
NdbMutex* m_new_delete_ndb_mutex;
118
Ndb* m_first_ndb_object;
119
void link_ndb_object(Ndb*);
120
void unlink_ndb_object(Ndb*);
122
BaseString m_latest_error_msg;
123
unsigned m_latest_error;
125
// Scan batch configuration parameters
126
NdbApiConfig m_config;
128
// keep initial transId's increasing...
129
Uint32 m_max_trans_id;
131
// Base offset for stats, from Ndb objects that are no
133
Uint64 globalApiStatsBaseline[ Ndb::NumClientStatistics ];