1 /*
2 Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 #include "Suma.hpp"
26
27 #include <Properties.hpp>
28 #include <Configuration.hpp>
29
Suma(Block_context & ctx)30 Suma::Suma(Block_context& ctx) :
31 SimulatedBlock(SUMA, ctx),
32 c_tables(c_tablePool),
33 c_subscriptions(c_subscriptionPool),
34 c_gcp_list(c_gcp_pool),
35 m_current_gci(~(Uint64)0)
36 {
37 BLOCK_CONSTRUCTOR(Suma);
38
39 // Add received signals
40 addRecSignal(GSN_READ_CONFIG_REQ, &Suma::execREAD_CONFIG_REQ);
41 addRecSignal(GSN_STTOR, &Suma::execSTTOR);
42 addRecSignal(GSN_NDB_STTOR, &Suma::execNDB_STTOR);
43 addRecSignal(GSN_DUMP_STATE_ORD, &Suma::execDUMP_STATE_ORD);
44 addRecSignal(GSN_DBINFO_SCANREQ, &Suma::execDBINFO_SCANREQ);
45 addRecSignal(GSN_READ_NODESCONF, &Suma::execREAD_NODESCONF);
46 addRecSignal(GSN_API_START_REP, &Suma::execAPI_START_REP, true);
47 addRecSignal(GSN_API_FAILREQ, &Suma::execAPI_FAILREQ);
48 addRecSignal(GSN_NODE_FAILREP, &Suma::execNODE_FAILREP);
49 addRecSignal(GSN_INCL_NODEREQ, &Suma::execINCL_NODEREQ);
50 addRecSignal(GSN_CONTINUEB, &Suma::execCONTINUEB);
51 addRecSignal(GSN_SIGNAL_DROPPED_REP, &Suma::execSIGNAL_DROPPED_REP, true);
52 addRecSignal(GSN_UTIL_SEQUENCE_CONF, &Suma::execUTIL_SEQUENCE_CONF);
53 addRecSignal(GSN_UTIL_SEQUENCE_REF, &Suma::execUTIL_SEQUENCE_REF);
54 addRecSignal(GSN_CREATE_SUBID_REQ,
55 &Suma::execCREATE_SUBID_REQ);
56
57 addRecSignal(GSN_SUB_CREATE_CONF, &Suma::execSUB_CREATE_CONF);
58 addRecSignal(GSN_SUB_CREATE_REF, &Suma::execSUB_CREATE_REF);
59
60 addRecSignal(GSN_SUB_START_CONF, &Suma::execSUB_START_CONF);
61 addRecSignal(GSN_SUB_START_REF, &Suma::execSUB_START_REF);
62
63 addRecSignal(GSN_SUMA_START_ME_REQ, &Suma::execSUMA_START_ME_REQ);
64 addRecSignal(GSN_SUMA_START_ME_REF, &Suma::execSUMA_START_ME_REF);
65 addRecSignal(GSN_SUMA_START_ME_CONF, &Suma::execSUMA_START_ME_CONF);
66 addRecSignal(GSN_SUMA_HANDOVER_REQ, &Suma::execSUMA_HANDOVER_REQ);
67 addRecSignal(GSN_SUMA_HANDOVER_REF, &Suma::execSUMA_HANDOVER_REF);
68 addRecSignal(GSN_SUMA_HANDOVER_CONF, &Suma::execSUMA_HANDOVER_CONF);
69
70 addRecSignal(GSN_SUB_GCP_COMPLETE_ACK,
71 &Suma::execSUB_GCP_COMPLETE_ACK);
72
73 addRecSignal(GSN_STOP_ME_REQ,
74 &Suma::execSTOP_ME_REQ);
75
76 /**
77 * SUMA participant if
78 */
79 addRecSignal(GSN_SUB_CREATE_REQ, &Suma::execSUB_CREATE_REQ);
80 addRecSignal(GSN_SUB_REMOVE_REQ, &Suma::execSUB_REMOVE_REQ);
81 addRecSignal(GSN_SUB_START_REQ, &Suma::execSUB_START_REQ);
82 addRecSignal(GSN_SUB_STOP_REQ, &Suma::execSUB_STOP_REQ);
83 addRecSignal(GSN_SUB_SYNC_REQ, &Suma::execSUB_SYNC_REQ);
84
85 /**
86 * Dict interface
87 */
88 addRecSignal(GSN_DROP_TAB_CONF, &Suma::execDROP_TAB_CONF);
89 addRecSignal(GSN_ALTER_TAB_REQ, &Suma::execALTER_TAB_REQ);
90 addRecSignal(GSN_CREATE_TAB_CONF, &Suma::execCREATE_TAB_CONF);
91
92 addRecSignal(GSN_GET_TABINFO_CONF, &Suma::execGET_TABINFO_CONF);
93 addRecSignal(GSN_GET_TABINFOREF, &Suma::execGET_TABINFOREF);
94
95 addRecSignal(GSN_DICT_LOCK_REF, &Suma::execDICT_LOCK_REF);
96 addRecSignal(GSN_DICT_LOCK_CONF, &Suma::execDICT_LOCK_CONF);
97
98 /**
99 * Dih interface
100 */
101 addRecSignal(GSN_DIH_SCAN_TAB_REF, &Suma::execDIH_SCAN_TAB_REF);
102 addRecSignal(GSN_DIH_SCAN_TAB_CONF, &Suma::execDIH_SCAN_TAB_CONF);
103 addRecSignal(GSN_DIH_SCAN_GET_NODES_CONF, &Suma::execDIH_SCAN_GET_NODES_CONF);
104 addRecSignal(GSN_CHECKNODEGROUPSCONF, &Suma::execCHECKNODEGROUPSCONF);
105 addRecSignal(GSN_GCP_PREPARE, &Suma::execGCP_PREPARE);
106
107 /**
108 * Scan interface
109 */
110 addRecSignal(GSN_SCAN_HBREP, &Suma::execSCAN_HBREP);
111 addRecSignal(GSN_TRANSID_AI, &Suma::execTRANSID_AI);
112 addRecSignal(GSN_KEYINFO20, &Suma::execKEYINFO20);
113 addRecSignal(GSN_SCAN_FRAGREF, &Suma::execSCAN_FRAGREF);
114 addRecSignal(GSN_SCAN_FRAGCONF, &Suma::execSCAN_FRAGCONF);
115 #if 0
116 addRecSignal(GSN_SUB_SYNC_CONTINUE_REF,
117 &Suma::execSUB_SYNC_CONTINUE_REF);
118 #endif
119 addRecSignal(GSN_SUB_SYNC_CONTINUE_CONF,
120 &Suma::execSUB_SYNC_CONTINUE_CONF);
121
122 /**
123 * Trigger stuff
124 */
125 addRecSignal(GSN_TRIG_ATTRINFO, &Suma::execTRIG_ATTRINFO);
126 addRecSignal(GSN_FIRE_TRIG_ORD, &Suma::execFIRE_TRIG_ORD);
127 addRecSignal(GSN_FIRE_TRIG_ORD_L, &Suma::execFIRE_TRIG_ORD_L);
128
129 addRecSignal(GSN_CREATE_TRIG_IMPL_REF, &Suma::execCREATE_TRIG_IMPL_REF);
130 addRecSignal(GSN_CREATE_TRIG_IMPL_CONF, &Suma::execCREATE_TRIG_IMPL_CONF);
131 addRecSignal(GSN_DROP_TRIG_IMPL_REF, &Suma::execDROP_TRIG_IMPL_REF);
132 addRecSignal(GSN_DROP_TRIG_IMPL_CONF, &Suma::execDROP_TRIG_IMPL_CONF);
133
134 addRecSignal(GSN_SUB_GCP_COMPLETE_REP,
135 &Suma::execSUB_GCP_COMPLETE_REP);
136
137 addRecSignal(GSN_CREATE_NODEGROUP_IMPL_REQ,
138 &Suma::execCREATE_NODEGROUP_IMPL_REQ);
139
140 addRecSignal(GSN_DROP_NODEGROUP_IMPL_REQ,
141 &Suma::execDROP_NODEGROUP_IMPL_REQ);
142
143 c_current_seq = 0;
144 c_outstanding_drop_trig_req = 0;
145 c_restart.m_ref = 0;
146 c_startup.m_restart_server_node_id = RNIL; // Server for my NR
147 c_shutdown.m_wait_handover = false;
148
149 #ifdef VM_TRACE
150 m_gcp_monitor = 0;
151 #endif
152 m_missing_data = false;
153 bzero(c_subscriber_per_node, sizeof(c_subscriber_per_node));
154
155 m_gcp_rep_cnt = getLqhWorkers();
156 m_min_gcp_rep_counter_index = 0;
157 m_max_gcp_rep_counter_index = 0;
158 bzero(m_gcp_rep_counter, sizeof(m_gcp_rep_counter));
159 }
160
~Suma()161 Suma::~Suma()
162 {
163 c_page_pool.clear();
164 }
165
166 BLOCK_FUNCTIONS(Suma)
167
168