21 #include <ndb_limits.h>
23 #define DEBUG(x) { ndbout << "DIH::" << x << endl; }
25 void Dbdih::initData()
27 cpageFileSize = ZPAGEREC;
30 createReplicaRecord = (CreateReplicaRecord*)
31 allocRecord(
"CreateReplicaRecord",
sizeof(CreateReplicaRecord),
32 ZCREATE_REPLICA_FILE_SIZE);
34 nodeGroupRecord = (NodeGroupRecord*)
35 allocRecord(
"NodeGroupRecord",
sizeof(NodeGroupRecord), MAX_NDB_NODES);
37 nodeRecord = (NodeRecord*)
38 allocRecord(
"NodeRecord",
sizeof(NodeRecord), MAX_NDB_NODES);
41 for(i = 0; i<MAX_NDB_NODES; i++){
42 new (&nodeRecord[
i]) NodeRecord();
45 c_takeOverPool.
setSize(MAX_NDB_NODES);
48 while (c_activeTakeOverList.
seize(ptr))
50 new (ptr.p) TakeOverRecord;
52 while (c_activeTakeOverList.
first(ptr))
58 waitGCPProxyPool.
setSize(ZPROXY_FILE_SIZE);
59 waitGCPMasterPool.
setSize(ZPROXY_MASTER_FILE_SIZE);
62 c_dictLockSlavePtrI_nodeRestart = RNIL;
65 c_lcpState.ctcCounter = 0;
66 c_lcpState.m_lcp_trylock_timeout = 0;
68 c_blockCommit =
false;
71 c_set_initial_start_flag = FALSE;
76 void Dbdih::initRecords()
79 for (Uint32 i = 0; i < c_diverify_queue_cnt; i++)
81 c_diverify_queue[
i].apiConnectRecord = (ApiConnectRecord*)
83 sizeof(ApiConnectRecord),
87 connectRecord = (ConnectRecord*)
allocRecord(
"ConnectRecord",
88 sizeof(ConnectRecord),
95 fragmentstore = (Fragmentstore*)
allocRecord(
"Fragmentstore",
96 sizeof(Fragmentstore),
103 replicaRecord = (ReplicaRecord*)
allocRecord(
"ReplicaRecord",
104 sizeof(ReplicaRecord),
113 bat[1].WA = &pageRecord->word[0];
114 bat[1].nrr = cpageFileSize;
115 bat[1].ClusterSize =
sizeof(PageRecord);
118 bat[20].WA = &sysfileData[0];
120 bat[20].ClusterSize =
sizeof(sysfileData);
123 bat[21].WA = &sysfileDataToFile[0];
125 bat[21].ClusterSize =
sizeof(sysfileDataToFile);
132 c_activeTakeOverList(c_takeOverPool),
133 c_waitGCPProxyList(waitGCPProxyPool),
134 c_waitGCPMasterList(waitGCPMasterPool),
135 c_waitEpochMasterList(waitGCPMasterPool)
137 BLOCK_CONSTRUCTOR(
Dbdih);
139 addRecSignal(GSN_DUMP_STATE_ORD, &Dbdih::execDUMP_STATE_ORD);
140 addRecSignal(GSN_NDB_TAMPER, &Dbdih::execNDB_TAMPER,
true);
141 addRecSignal(GSN_DEBUG_SIG, &Dbdih::execDEBUG_SIG);
142 addRecSignal(GSN_MASTER_GCPREQ, &Dbdih::execMASTER_GCPREQ);
143 addRecSignal(GSN_MASTER_GCPREF, &Dbdih::execMASTER_GCPREF);
144 addRecSignal(GSN_MASTER_GCPCONF, &Dbdih::execMASTER_GCPCONF);
145 addRecSignal(GSN_EMPTY_LCP_CONF, &Dbdih::execEMPTY_LCP_CONF);
146 addRecSignal(GSN_EMPTY_LCP_REP, &Dbdih::execEMPTY_LCP_REP);
148 addRecSignal(GSN_MASTER_LCPREQ, &Dbdih::execMASTER_LCPREQ);
149 addRecSignal(GSN_MASTER_LCPREF, &Dbdih::execMASTER_LCPREF);
150 addRecSignal(GSN_MASTER_LCPCONF, &Dbdih::execMASTER_LCPCONF);
151 addRecSignal(GSN_NF_COMPLETEREP, &Dbdih::execNF_COMPLETEREP);
152 addRecSignal(GSN_START_PERMREQ, &Dbdih::execSTART_PERMREQ);
153 addRecSignal(GSN_START_PERMCONF, &Dbdih::execSTART_PERMCONF);
154 addRecSignal(GSN_START_PERMREF, &Dbdih::execSTART_PERMREF);
155 addRecSignal(GSN_INCL_NODEREQ, &Dbdih::execINCL_NODEREQ);
156 addRecSignal(GSN_INCL_NODECONF, &Dbdih::execINCL_NODECONF);
158 addRecSignal(GSN_START_TOREQ, &Dbdih::execSTART_TOREQ);
159 addRecSignal(GSN_START_TOREF, &Dbdih::execSTART_TOREQ);
160 addRecSignal(GSN_START_TOCONF, &Dbdih::execSTART_TOCONF);
162 addRecSignal(GSN_UPDATE_TOREQ, &Dbdih::execUPDATE_TOREQ);
163 addRecSignal(GSN_UPDATE_TOREF, &Dbdih::execUPDATE_TOREF);
164 addRecSignal(GSN_UPDATE_TOCONF, &Dbdih::execUPDATE_TOCONF);
166 addRecSignal(GSN_END_TOREQ, &Dbdih::execEND_TOREQ);
167 addRecSignal(GSN_END_TOREF, &Dbdih::execEND_TOREF);
168 addRecSignal(GSN_END_TOCONF, &Dbdih::execEND_TOCONF);
170 addRecSignal(GSN_START_MEREQ, &Dbdih::execSTART_MEREQ);
171 addRecSignal(GSN_START_MECONF, &Dbdih::execSTART_MECONF);
172 addRecSignal(GSN_START_MEREF, &Dbdih::execSTART_MEREF);
173 addRecSignal(GSN_START_COPYREQ, &Dbdih::execSTART_COPYREQ);
174 addRecSignal(GSN_START_COPYCONF, &Dbdih::execSTART_COPYCONF);
175 addRecSignal(GSN_START_COPYREF, &Dbdih::execSTART_COPYREF);
176 addRecSignal(GSN_CREATE_FRAGREQ, &Dbdih::execCREATE_FRAGREQ);
177 addRecSignal(GSN_CREATE_FRAGCONF, &Dbdih::execCREATE_FRAGCONF);
178 addRecSignal(GSN_DIVERIFYREQ, &Dbdih::execDIVERIFYREQ);
179 addRecSignal(GSN_GCP_SAVEREQ, &Dbdih::execGCP_SAVEREQ);
180 addRecSignal(GSN_GCP_SAVEREF, &Dbdih::execGCP_SAVEREF);
181 addRecSignal(GSN_GCP_SAVECONF, &Dbdih::execGCP_SAVECONF);
182 addRecSignal(GSN_GCP_PREPARECONF, &Dbdih::execGCP_PREPARECONF);
183 addRecSignal(GSN_GCP_PREPARE, &Dbdih::execGCP_PREPARE);
184 addRecSignal(GSN_GCP_NODEFINISH, &Dbdih::execGCP_NODEFINISH);
185 addRecSignal(GSN_GCP_COMMIT, &Dbdih::execGCP_COMMIT);
186 addRecSignal(GSN_SUB_GCP_COMPLETE_REP, &Dbdih::execSUB_GCP_COMPLETE_REP);
187 addRecSignal(GSN_SUB_GCP_COMPLETE_ACK, &Dbdih::execSUB_GCP_COMPLETE_ACK);
188 addRecSignal(GSN_DIHNDBTAMPER, &Dbdih::execDIHNDBTAMPER);
189 addRecSignal(GSN_CONTINUEB, &Dbdih::execCONTINUEB);
190 addRecSignal(GSN_COPY_GCIREQ, &Dbdih::execCOPY_GCIREQ);
191 addRecSignal(GSN_COPY_GCICONF, &Dbdih::execCOPY_GCICONF);
192 addRecSignal(GSN_COPY_TABREQ, &Dbdih::execCOPY_TABREQ);
193 addRecSignal(GSN_COPY_TABCONF, &Dbdih::execCOPY_TABCONF);
194 addRecSignal(GSN_TCGETOPSIZECONF, &Dbdih::execTCGETOPSIZECONF);
195 addRecSignal(GSN_TC_CLOPSIZECONF, &Dbdih::execTC_CLOPSIZECONF);
197 addRecSignal(GSN_LCP_COMPLETE_REP, &Dbdih::execLCP_COMPLETE_REP);
198 addRecSignal(GSN_LCP_FRAG_REP, &Dbdih::execLCP_FRAG_REP);
199 addRecSignal(GSN_START_LCP_REQ, &Dbdih::execSTART_LCP_REQ);
200 addRecSignal(GSN_START_LCP_CONF, &Dbdih::execSTART_LCP_CONF);
202 addRecSignal(GSN_READ_CONFIG_REQ, &Dbdih::execREAD_CONFIG_REQ,
true);
203 addRecSignal(GSN_UNBLO_DICTCONF, &Dbdih::execUNBLO_DICTCONF);
204 addRecSignal(GSN_COPY_ACTIVECONF, &Dbdih::execCOPY_ACTIVECONF);
205 addRecSignal(GSN_TAB_COMMITREQ, &Dbdih::execTAB_COMMITREQ);
206 addRecSignal(GSN_NODE_FAILREP, &Dbdih::execNODE_FAILREP);
207 addRecSignal(GSN_COPY_FRAGCONF, &Dbdih::execCOPY_FRAGCONF);
208 addRecSignal(GSN_COPY_FRAGREF, &Dbdih::execCOPY_FRAGREF);
209 addRecSignal(GSN_DIADDTABREQ, &Dbdih::execDIADDTABREQ);
210 addRecSignal(GSN_DIGETNODESREQ, &Dbdih::execDIGETNODESREQ);
211 addRecSignal(GSN_STTOR, &Dbdih::execSTTOR);
212 addRecSignal(GSN_DIH_SCAN_TAB_REQ, &Dbdih::execDIH_SCAN_TAB_REQ);
213 addRecSignal(GSN_DIH_SCAN_GET_NODES_REQ, &Dbdih::execDIH_SCAN_GET_NODES_REQ);
214 addRecSignal(GSN_DIH_SCAN_TAB_COMPLETE_REP,
215 &Dbdih::execDIH_SCAN_TAB_COMPLETE_REP);
216 addRecSignal(GSN_GCP_TCFINISHED, &Dbdih::execGCP_TCFINISHED);
217 addRecSignal(GSN_READ_NODESCONF, &Dbdih::execREAD_NODESCONF);
218 addRecSignal(GSN_NDB_STTOR, &Dbdih::execNDB_STTOR);
219 addRecSignal(GSN_DICTSTARTCONF, &Dbdih::execDICTSTARTCONF);
220 addRecSignal(GSN_NDB_STARTREQ, &Dbdih::execNDB_STARTREQ);
221 addRecSignal(GSN_GETGCIREQ, &Dbdih::execGETGCIREQ);
222 addRecSignal(GSN_DIH_RESTARTREQ, &Dbdih::execDIH_RESTARTREQ);
223 addRecSignal(GSN_START_RECCONF, &Dbdih::execSTART_RECCONF);
224 addRecSignal(GSN_START_FRAGCONF, &Dbdih::execSTART_FRAGCONF);
225 addRecSignal(GSN_ADD_FRAGCONF, &Dbdih::execADD_FRAGCONF);
226 addRecSignal(GSN_ADD_FRAGREF, &Dbdih::execADD_FRAGREF);
227 addRecSignal(GSN_DROP_FRAG_REF, &Dbdih::execDROP_FRAG_REF);
228 addRecSignal(GSN_DROP_FRAG_CONF, &Dbdih::execDROP_FRAG_CONF);
229 addRecSignal(GSN_FSOPENCONF, &Dbdih::execFSOPENCONF);
230 addRecSignal(GSN_FSOPENREF, &Dbdih::execFSOPENREF,
true);
231 addRecSignal(GSN_FSCLOSECONF, &Dbdih::execFSCLOSECONF);
232 addRecSignal(GSN_FSCLOSEREF, &Dbdih::execFSCLOSEREF,
true);
233 addRecSignal(GSN_FSREADCONF, &Dbdih::execFSREADCONF);
234 addRecSignal(GSN_FSREADREF, &Dbdih::execFSREADREF,
true);
235 addRecSignal(GSN_FSWRITECONF, &Dbdih::execFSWRITECONF);
236 addRecSignal(GSN_FSWRITEREF, &Dbdih::execFSWRITEREF,
true);
238 addRecSignal(GSN_START_INFOREQ,
239 &Dbdih::execSTART_INFOREQ);
240 addRecSignal(GSN_START_INFOREF,
241 &Dbdih::execSTART_INFOREF);
242 addRecSignal(GSN_START_INFOCONF,
243 &Dbdih::execSTART_INFOCONF);
245 addRecSignal(GSN_CHECKNODEGROUPSREQ, &Dbdih::execCHECKNODEGROUPSREQ);
247 addRecSignal(GSN_BLOCK_COMMIT_ORD,
248 &Dbdih::execBLOCK_COMMIT_ORD);
249 addRecSignal(GSN_UNBLOCK_COMMIT_ORD,
250 &Dbdih::execUNBLOCK_COMMIT_ORD);
252 addRecSignal(GSN_DIH_SWITCH_REPLICA_REQ,
253 &Dbdih::execDIH_SWITCH_REPLICA_REQ);
255 addRecSignal(GSN_DIH_SWITCH_REPLICA_REF,
256 &Dbdih::execDIH_SWITCH_REPLICA_REF);
258 addRecSignal(GSN_DIH_SWITCH_REPLICA_CONF,
259 &Dbdih::execDIH_SWITCH_REPLICA_CONF);
261 addRecSignal(GSN_STOP_PERM_REQ, &Dbdih::execSTOP_PERM_REQ);
262 addRecSignal(GSN_STOP_PERM_REF, &Dbdih::execSTOP_PERM_REF);
263 addRecSignal(GSN_STOP_PERM_CONF, &Dbdih::execSTOP_PERM_CONF);
265 addRecSignal(GSN_STOP_ME_REQ, &Dbdih::execSTOP_ME_REQ);
266 addRecSignal(GSN_STOP_ME_REF, &Dbdih::execSTOP_ME_REF);
267 addRecSignal(GSN_STOP_ME_CONF, &Dbdih::execSTOP_ME_CONF);
269 addRecSignal(GSN_WAIT_GCP_REQ, &Dbdih::execWAIT_GCP_REQ);
270 addRecSignal(GSN_WAIT_GCP_REF, &Dbdih::execWAIT_GCP_REF);
271 addRecSignal(GSN_WAIT_GCP_CONF, &Dbdih::execWAIT_GCP_CONF);
273 addRecSignal(GSN_PREP_DROP_TAB_REQ, &Dbdih::execPREP_DROP_TAB_REQ);
274 addRecSignal(GSN_DROP_TAB_REQ, &Dbdih::execDROP_TAB_REQ);
276 addRecSignal(GSN_ALTER_TAB_REQ, &Dbdih::execALTER_TAB_REQ);
278 addRecSignal(GSN_CREATE_FRAGMENTATION_REQ,
279 &Dbdih::execCREATE_FRAGMENTATION_REQ);
281 addRecSignal(GSN_DICT_LOCK_CONF, &Dbdih::execDICT_LOCK_CONF);
282 addRecSignal(GSN_DICT_LOCK_REF, &Dbdih::execDICT_LOCK_REF);
283 addRecSignal(GSN_NODE_START_REP, &Dbdih::execNODE_START_REP,
true);
285 addRecSignal(GSN_START_FRAGREF,
286 &Dbdih::execSTART_FRAGREF);
288 addRecSignal(GSN_PREPARE_COPY_FRAG_REF,
289 &Dbdih::execPREPARE_COPY_FRAG_REF);
290 addRecSignal(GSN_PREPARE_COPY_FRAG_CONF,
291 &Dbdih::execPREPARE_COPY_FRAG_CONF);
293 addRecSignal(GSN_UPGRADE_PROTOCOL_ORD,
294 &Dbdih::execUPGRADE_PROTOCOL_ORD);
296 addRecSignal(GSN_CREATE_NODEGROUP_IMPL_REQ,
297 &Dbdih::execCREATE_NODEGROUP_IMPL_REQ);
299 addRecSignal(GSN_DROP_NODEGROUP_IMPL_REQ,
300 &Dbdih::execDROP_NODEGROUP_IMPL_REQ);
303 addRecSignal(GSN_DIH_GET_TABINFO_REQ,
304 &Dbdih::execDIH_GET_TABINFO_REQ);
306 addRecSignal(GSN_DIH_GET_TABINFO_REF,
307 &Dbdih::execDIH_GET_TABINFO_REF);
308 addRecSignal(GSN_DIH_GET_TABINFO_CONF,
309 &Dbdih::execDIH_GET_TABINFO_CONF);
318 createReplicaRecord = 0;
322 c_fragments_per_node = 1;
323 bzero(c_node_groups,
sizeof(c_node_groups));
324 c_diverify_queue_cnt = 1;
330 for (Uint32 i = 0; i<c_diverify_queue_cnt; i++)
332 deallocRecord((
void **)&c_diverify_queue[i].apiConnectRecord,
334 sizeof(ApiConnectRecord),
335 capiConnectFileSize);
339 sizeof(ConnectRecord),
347 sizeof(Fragmentstore),
355 sizeof(ReplicaRecord),
364 "CreateReplicaRecord",
sizeof(CreateReplicaRecord),
365 ZCREATE_REPLICA_FILE_SIZE);
368 sizeof(NodeGroupRecord), MAX_NDB_NODES);
371 sizeof(NodeRecord), MAX_NDB_NODES);
374 BLOCK_FUNCTIONS(
Dbdih)