22 #include <ndb_limits.h>
23 #include <Properties.hpp>
24 #include <Configuration.hpp>
26 #define DEBUG(x) { ndbout << "TC::" << x << endl; }
31 capiConnectFilesize = ZAPI_CONNECT_FILESIZE;
32 ccacheFilesize = ZAPI_CONNECT_FILESIZE;
33 chostFilesize = MAX_NODES;
34 cgcpFilesize = ZGCP_FILESIZE;
35 cscanrecFileSize = ZSCANREC_FILE_SIZE;
36 cscanFragrecFileSize = ZSCAN_FRAGREC_FILE_SIZE;
37 ctabrecFilesize = ZTABREC_FILESIZE;
38 ctcConnectFilesize = ZTC_CONNECT_FILESIZE;
39 cdihblockref = DBDIH_REF;
40 cdictblockref = DBDICT_REF;
41 clqhblockref = DBLQH_REF;
42 cerrorBlockref = NDBCNTR_REF;
45 tcFailRecord = (TcFailRecord*)
allocRecord(
"TcFailRecord",
46 sizeof(TcFailRecord), 1);
56 c_theAttributeBufferPool.
setSize(c_transactionBufferSpace);
57 c_firedTriggerHash.
setSize((c_maxNumberOfFiredTriggers+10)/10);
60 void Dbtc::initRecords()
64 cacheRecord = (CacheRecord*)
allocRecord(
"CacheRecord",
68 apiConnectRecord = (ApiConnectRecord*)
allocRecord(
"ApiConnectRecord",
69 sizeof(ApiConnectRecord),
72 for(
unsigned i = 0;
i<capiConnectFilesize;
i++) {
73 p = &apiConnectRecord[
i];
80 while(triggers.seize(tptr) ==
true) {
82 new (p) TcFiredTriggerData();
98 TcIndexOperationPtr ioptr;
99 while(indexOps.seize(ioptr) ==
true) {
101 new (p) TcIndexOperation();
107 capiConnectFilesize);
109 c_apiConTimer_line = (UintR*)
allocRecord(
"ApiConTimer_line",
111 capiConnectFilesize);
113 tcConnectRecord = (TcConnectRecord*)
allocRecord(
"TcConnectRecord",
114 sizeof(TcConnectRecord),
117 m_commitAckMarkerPool.
setSize(2 * capiConnectFilesize);
118 m_commitAckMarkerHash.
setSize(1024);
120 hostRecord = (HostRecord*)
allocRecord(
"HostRecord",
124 tableRecord = (TableRecord*)
allocRecord(
"TableRecord",
128 scanRecord = (ScanRecord*)
allocRecord(
"ScanRecord",
133 c_scan_frag_pool.
setSize(cscanFragrecFileSize);
137 while(tmp.seize(ptr)) {
138 new (ptr.p) ScanFragRec();
152 Dbtc::getParam(
const char*
name, Uint32* count)
154 if (name != NULL && count != NULL)
161 if (strcmp(name,
"FragmentInfoPool") == 0)
169 *count= MAX_NODES + 10;
178 c_theDefinedTriggers(c_theDefinedTriggerPool),
179 c_firedTriggerHash(c_theFiredTriggerPool),
180 c_maxNumberOfDefinedTriggers(0),
181 c_maxNumberOfFiredTriggers(0),
182 c_theIndexes(c_theIndexPool),
183 c_maxNumberOfIndexes(0),
184 c_maxNumberOfIndexOperations(0),
185 m_commitAckMarkerHash(m_commitAckMarkerPool)
187 BLOCK_CONSTRUCTOR(
Dbtc);
190 ctx.m_config.getOwnConfigIterator();
193 Uint32 transactionBufferMemory = 0;
194 Uint32 maxNoOfIndexes = 0, maxNoOfConcurrentIndexOperations = 0;
195 Uint32 maxNoOfTriggers = 0, maxNoOfFiredTriggers = 0;
197 ndb_mgm_get_int_parameter(p, CFG_DB_TRANS_BUFFER_MEM,
198 &transactionBufferMemory);
199 ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE,
201 ndb_mgm_get_int_parameter(p, CFG_DB_NO_INDEX_OPS,
202 &maxNoOfConcurrentIndexOperations);
203 ndb_mgm_get_int_parameter(p, CFG_DB_NO_TRIGGERS,
205 ndb_mgm_get_int_parameter(p, CFG_DB_NO_TRIGGER_OPS,
206 &maxNoOfFiredTriggers);
208 c_transactionBufferSpace =
210 c_maxNumberOfIndexes = maxNoOfIndexes;
211 c_maxNumberOfIndexOperations = maxNoOfConcurrentIndexOperations;
212 c_maxNumberOfDefinedTriggers = maxNoOfTriggers;
213 c_maxNumberOfFiredTriggers = maxNoOfFiredTriggers;
216 addRecSignal(GSN_PACKED_SIGNAL, &Dbtc::execPACKED_SIGNAL);
217 addRecSignal(GSN_ABORTED, &Dbtc::execABORTED);
218 addRecSignal(GSN_ATTRINFO, &Dbtc::execATTRINFO);
219 addRecSignal(GSN_CONTINUEB, &Dbtc::execCONTINUEB);
220 addRecSignal(GSN_KEYINFO, &Dbtc::execKEYINFO);
221 addRecSignal(GSN_SCAN_NEXTREQ, &Dbtc::execSCAN_NEXTREQ);
222 addRecSignal(GSN_TAKE_OVERTCREQ, &Dbtc::execTAKE_OVERTCREQ);
223 addRecSignal(GSN_TAKE_OVERTCCONF, &Dbtc::execTAKE_OVERTCCONF);
224 addRecSignal(GSN_LQHKEYREF, &Dbtc::execLQHKEYREF);
228 addRecSignal(GSN_DUMP_STATE_ORD, &Dbtc::execDUMP_STATE_ORD);
229 addRecSignal(GSN_DBINFO_SCANREQ, &Dbtc::execDBINFO_SCANREQ);
230 addRecSignal(GSN_SEND_PACKED, &Dbtc::execSEND_PACKED,
true);
231 addRecSignal(GSN_SCAN_HBREP, &Dbtc::execSCAN_HBREP);
232 addRecSignal(GSN_COMPLETED, &Dbtc::execCOMPLETED);
233 addRecSignal(GSN_COMMITTED, &Dbtc::execCOMMITTED);
234 addRecSignal(GSN_DIH_SCAN_GET_NODES_CONF, &Dbtc::execDIH_SCAN_GET_NODES_CONF);
235 addRecSignal(GSN_DIH_SCAN_GET_NODES_REF, &Dbtc::execDIH_SCAN_GET_NODES_REF);
236 addRecSignal(GSN_DIVERIFYCONF, &Dbtc::execDIVERIFYCONF);
237 addRecSignal(GSN_DIH_SCAN_TAB_CONF, &Dbtc::execDIH_SCAN_TAB_CONF);
238 addRecSignal(GSN_DIH_SCAN_TAB_REF, &Dbtc::execDIH_SCAN_TAB_REF);
239 addRecSignal(GSN_GCP_NOMORETRANS, &Dbtc::execGCP_NOMORETRANS);
240 addRecSignal(GSN_LQHKEYCONF, &Dbtc::execLQHKEYCONF);
241 addRecSignal(GSN_NDB_STTOR, &Dbtc::execNDB_STTOR);
242 addRecSignal(GSN_READ_NODESCONF, &Dbtc::execREAD_NODESCONF);
243 addRecSignal(GSN_READ_NODESREF, &Dbtc::execREAD_NODESREF);
244 addRecSignal(GSN_STTOR, &Dbtc::execSTTOR);
245 addRecSignal(GSN_TC_COMMITREQ, &Dbtc::execTC_COMMITREQ);
246 addRecSignal(GSN_TC_CLOPSIZEREQ, &Dbtc::execTC_CLOPSIZEREQ);
247 addRecSignal(GSN_TCGETOPSIZEREQ, &Dbtc::execTCGETOPSIZEREQ);
248 addRecSignal(GSN_TCKEYREQ, &Dbtc::execTCKEYREQ);
249 addRecSignal(GSN_TCRELEASEREQ, &Dbtc::execTCRELEASEREQ);
250 addRecSignal(GSN_TCSEIZEREQ, &Dbtc::execTCSEIZEREQ);
251 addRecSignal(GSN_TCROLLBACKREQ, &Dbtc::execTCROLLBACKREQ);
252 addRecSignal(GSN_TC_HBREP, &Dbtc::execTC_HBREP);
253 addRecSignal(GSN_TC_SCHVERREQ, &Dbtc::execTC_SCHVERREQ);
254 addRecSignal(GSN_TAB_COMMITREQ, &Dbtc::execTAB_COMMITREQ);
255 addRecSignal(GSN_SCAN_TABREQ, &Dbtc::execSCAN_TABREQ);
256 addRecSignal(GSN_SCAN_FRAGCONF, &Dbtc::execSCAN_FRAGCONF);
257 addRecSignal(GSN_SCAN_FRAGREF, &Dbtc::execSCAN_FRAGREF);
258 addRecSignal(GSN_READ_CONFIG_REQ, &Dbtc::execREAD_CONFIG_REQ,
true);
259 addRecSignal(GSN_LQH_TRANSCONF, &Dbtc::execLQH_TRANSCONF);
260 addRecSignal(GSN_COMPLETECONF, &Dbtc::execCOMPLETECONF);
261 addRecSignal(GSN_COMMITCONF, &Dbtc::execCOMMITCONF);
262 addRecSignal(GSN_ABORTCONF, &Dbtc::execABORTCONF);
263 addRecSignal(GSN_NODE_FAILREP, &Dbtc::execNODE_FAILREP);
264 addRecSignal(GSN_INCL_NODEREQ, &Dbtc::execINCL_NODEREQ);
265 addRecSignal(GSN_TIME_SIGNAL, &Dbtc::execTIME_SIGNAL);
266 addRecSignal(GSN_API_FAILREQ, &Dbtc::execAPI_FAILREQ);
268 addRecSignal(GSN_TC_COMMIT_ACK, &Dbtc::execTC_COMMIT_ACK);
269 addRecSignal(GSN_ABORT_ALL_REQ, &Dbtc::execABORT_ALL_REQ);
271 addRecSignal(GSN_CREATE_TRIG_IMPL_REQ, &Dbtc::execCREATE_TRIG_IMPL_REQ);
272 addRecSignal(GSN_DROP_TRIG_IMPL_REQ, &Dbtc::execDROP_TRIG_IMPL_REQ);
273 addRecSignal(GSN_FIRE_TRIG_ORD, &Dbtc::execFIRE_TRIG_ORD);
274 addRecSignal(GSN_TRIG_ATTRINFO, &Dbtc::execTRIG_ATTRINFO);
276 addRecSignal(GSN_CREATE_INDX_IMPL_REQ, &Dbtc::execCREATE_INDX_IMPL_REQ);
277 addRecSignal(GSN_DROP_INDX_IMPL_REQ, &Dbtc::execDROP_INDX_IMPL_REQ);
278 addRecSignal(GSN_TCINDXREQ, &Dbtc::execTCINDXREQ);
279 addRecSignal(GSN_INDXKEYINFO, &Dbtc::execINDXKEYINFO);
280 addRecSignal(GSN_INDXATTRINFO, &Dbtc::execINDXATTRINFO);
281 addRecSignal(GSN_ALTER_INDX_IMPL_REQ, &Dbtc::execALTER_INDX_IMPL_REQ);
283 addRecSignal(GSN_TRANSID_AI_R, &Dbtc::execTRANSID_AI_R);
284 addRecSignal(GSN_KEYINFO20_R, &Dbtc::execKEYINFO20_R);
285 addRecSignal(GSN_SIGNAL_DROPPED_REP, &Dbtc::execSIGNAL_DROPPED_REP,
true);
288 addRecSignal(GSN_TCKEYCONF, &Dbtc::execTCKEYCONF);
289 addRecSignal(GSN_TCKEYREF, &Dbtc::execTCKEYREF);
290 addRecSignal(GSN_TRANSID_AI, &Dbtc::execTRANSID_AI);
291 addRecSignal(GSN_TCROLLBACKREP, &Dbtc::execTCROLLBACKREP);
294 addRecSignal(GSN_DROP_TAB_REQ, &Dbtc::execDROP_TAB_REQ);
295 addRecSignal(GSN_PREP_DROP_TAB_REQ, &Dbtc::execPREP_DROP_TAB_REQ);
297 addRecSignal(GSN_ALTER_TAB_REQ, &Dbtc::execALTER_TAB_REQ);
298 addRecSignal(GSN_ROUTE_ORD, &Dbtc::execROUTE_ORD);
299 addRecSignal(GSN_TCKEY_FAILREFCONF_R, &Dbtc::execTCKEY_FAILREFCONF_R);
301 addRecSignal(GSN_FIRE_TRIG_REF, &Dbtc::execFIRE_TRIG_REF);
302 addRecSignal(GSN_FIRE_TRIG_CONF, &Dbtc::execFIRE_TRIG_CONF);
305 apiConnectRecord = 0;
313 c_apiConTimer_line = 0;
314 cpackedListIndex = 0;
315 c_ongoing_take_over_cnt = 0;
319 void* tmp[] = { &apiConnectptr,
326 init_globals_list(tmp,
sizeof(tmp)/
sizeof(tmp[0]));
330 apiConnectRecord = 0;
338 c_apiConTimer_line = 0;
339 csystemStart = SSS_FALSE;
340 m_deferred_enabled = ~Uint32(0);
341 m_max_writes_per_trans = ~Uint32(0);
351 deallocRecord((
void **)&apiConnectRecord,
"ApiConnectRecord",
352 sizeof(ApiConnectRecord),
353 capiConnectFilesize);
356 sizeof(TcConnectRecord),
376 sizeof(TcFailRecord), 1);
380 capiConnectFilesize);
384 capiConnectFilesize);
387 BLOCK_FUNCTIONS(
Dbtc)