MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BackupProxy.cpp
1 /* Copyright (C) 2008 MySQL AB
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
15 
16 #include "BackupProxy.hpp"
17 #include "Backup.hpp"
18 
19 BackupProxy::BackupProxy(Block_context& ctx) :
20  LocalProxy(BACKUP, ctx)
21 {
22  // GSN_STTOR
23  addRecSignal(GSN_UTIL_SEQUENCE_CONF, &BackupProxy::execUTIL_SEQUENCE_CONF);
24  addRecSignal(GSN_UTIL_SEQUENCE_REF, &BackupProxy::execUTIL_SEQUENCE_REF);
25 }
26 
27 BackupProxy::~BackupProxy()
28 {
29 }
30 
32 BackupProxy::newWorker(Uint32 instanceNo)
33 {
34  return new Backup(m_ctx, instanceNo);
35 }
36 
37 // GSN_STTOR
38 
39 void
40 BackupProxy::callSTTOR(Signal* signal)
41 {
42  Ss_READ_NODES_REQ& ss = c_ss_READ_NODESREQ;
43  ndbrequire(ss.m_gsn == 0);
44 
45  const Uint32 startPhase = signal->theData[1];
46  switch (startPhase) {
47  case 3:
48  ss.m_gsn = GSN_STTOR;
49  sendREAD_NODESREQ(signal);
50  break;
51  case 7:
52  if (c_typeOfStart == NodeState::ST_INITIAL_START &&
53  c_masterNodeId == getOwnNodeId()) {
54  jam();
55  sendUTIL_SEQUENCE_REQ(signal);
56  return;
57  }
58  backSTTOR(signal);
59  break;
60  default:
61  backSTTOR(signal);
62  break;
63  }
64 }
65 
66 static const Uint32 BACKUP_SEQUENCE = 0x1F000000;
67 
68 void
69 BackupProxy::sendUTIL_SEQUENCE_REQ(Signal* signal)
70 {
71  UtilSequenceReq* req = (UtilSequenceReq*)signal->getDataPtrSend();
72 
73  req->senderData = RNIL;
74  req->sequenceId = BACKUP_SEQUENCE;
75  req->requestType = UtilSequenceReq::Create;
76 
77  sendSignal(DBUTIL_REF, GSN_UTIL_SEQUENCE_REQ,
78  signal, UtilSequenceReq::SignalLength, JBB);
79 }
80 
81 void
82 BackupProxy::execUTIL_SEQUENCE_CONF(Signal* signal)
83 {
84  backSTTOR(signal);
85 }
86 
87 void
88 BackupProxy::execUTIL_SEQUENCE_REF(Signal* signal)
89 {
90  ndbrequire(false);
91 }
92 
93 BLOCK_FUNCTIONS(BackupProxy)