19 #include <ndb_global.h>
22 #include "NdbApiSignal.hpp"
23 #include "NdbImpl.hpp"
24 #include <ConfigRetriever.hpp>
25 #include <ndb_limits.h>
28 #include "ObjectMap.hpp"
29 #include "NdbUtil.hpp"
31 #include <EventLogger.hpp>
35 const char* aDataBase ,
const char* aSchema)
38 DBUG_ENTER(
"Ndb::Ndb()");
39 DBUG_PRINT(
"enter",(
"Ndb::Ndb this: 0x%lx", (
long)
this));
40 setup(ndb_cluster_connection, aDataBase, aSchema);
45 const char* aDataBase ,
const char* aSchema)
47 DBUG_ENTER(
"Ndb::setup");
49 assert(theImpl == NULL);
50 theImpl=
new NdbImpl(ndb_cluster_connection,*
this);
51 theDictionary= &(theImpl->m_dictionary);
53 thePreparedTransactionsArray= NULL;
54 theSentTransactionsArray= NULL;
55 theCompletedTransactionsArray= NULL;
56 theNoOfPreparedTransactions= 0;
57 theNoOfSentTransactions= 0;
58 theNoOfCompletedTransactions= 0;
59 theRemainingStartTransactions= 0;
60 theMaxNoOfTransactions= 0;
61 theMinNoOfEventsToWakeUp= 0;
62 theTransactionList= NULL;
63 theConnectionArray= NULL;
64 the_last_check_time= 0;
67 theNdbBlockNumber= -1;
68 theInitState= NotConstructed;
74 fullyQualifiedNames =
true;
86 theCommitAckSignal = NULL;
87 theCachedMinDbNodeVersion = 0;
90 for (i = 0; i < MAX_NDB_NODES ; i++) {
91 theConnectionArray[
i] = NULL;
95 theImpl->m_dbname.
assign(aDataBase);
96 theImpl->m_schemaname.
assign(aSchema);
97 theImpl->update_prefix();
100 if (theInitState == NotConstructed)
101 theInitState = NotInitialised;
106 if (theEventBuffer == NULL) {
107 ndbout_c(
"Failed NdbEventBuffer()");
112 theImpl->m_ndb_cluster_connection.link_ndb_object(
this);
125 DBUG_ENTER(
"Ndb::~Ndb()");
126 DBUG_PRINT(
"enter",(
"this: 0x%lx", (
long)
this));
131 if (theImpl->m_ev_op != 0)
133 g_eventLogger->
warning(
"Deleting Ndb-object with NdbEventOperation still"
135 printf(
"this: %p NdbEventOperation(s): ",
this);
144 assert(theImpl->m_ev_op == 0);
148 g_eventLogger->
error(
"stopping NdbEventOperation failed in Ndb destructor");
149 op->m_magic_number= 0;
156 delete theEventBuffer;
158 releaseTransactionArrays();
160 delete []theConnectionArray;
161 if(theCommitAckSignal != NULL){
162 delete theCommitAckSignal;
163 theCommitAckSignal = NULL;
166 theImpl->m_ndb_cluster_connection.unlink_ndb_object(
this);
170 #ifdef POORMANSPURIFY
172 ndbout <<
"cnewSignals=" << cnewSignals << endl;
173 ndbout <<
"cfreeSignals=" << cfreeSignals << endl;
174 ndbout <<
"cgetSignals=" << cgetSignals << endl;
175 ndbout <<
"creleaseSignals=" << creleaseSignals << endl;
178 assert(cnewSignals == cfreeSignals);
179 assert(cgetSignals == creleaseSignals);
191 NdbWaiter::~NdbWaiter()
198 m_next_ndb_object(0),
199 m_prev_ndb_object(0),
200 m_ndb_cluster_connection(ndb_cluster_connection->m_impl),
201 m_transporter_facade(ndb_cluster_connection->m_impl.m_transporter_facade),
203 theCurrentConnectIndex(0),
204 theNdbObjectIdMap(1024,1024),
211 for (i = 0; i < MAX_NDB_NODES; i++) {
212 the_release_ind[
i] = 0;
214 m_optimized_node_selection=
215 m_ndb_cluster_connection.m_optimized_node_selection;
217 m_systemPrefix.assfmt(
"%s%c%s%c", NDB_SYSTEM_DATABASE, table_name_separator,
218 NDB_SYSTEM_SCHEMA, table_name_separator);
220 forceShortRequests =
false;
221 const char* f= getenv(
"NDB_FORCE_SHORT_REQUESTS");
222 if (f != 0 && *f != 0 && *f !=
'0' && *f !=
'n' && *f !=
'N')
223 forceShortRequests =
true;
225 for (i = 0; i < Ndb::NumClientStatistics; i++)