MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PgmanProxy.hpp
1 /* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
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 #ifndef NDB_PGMAN_PROXY_HPP
17 #define NDB_PGMAN_PROXY_HPP
18 
19 #include <LocalProxy.hpp>
20 #include <signaldata/LCP.hpp>
21 #include <signaldata/ReleasePages.hpp>
22 #include "pgman.hpp"
23 
24 class PgmanProxy : public LocalProxy {
25 public:
27  virtual ~PgmanProxy();
28  BLOCK_DEFINES(PgmanProxy);
29 
30 protected:
31  virtual SimulatedBlock* newWorker(Uint32 instanceNo);
32 
33  // GSN_LCP_FRAG_ORD
35  /*
36  * Sent once from LQH proxy (at LCP) and LGMAN (at SR).
37  * The pgman instances only set a flag and do not reply.
38  */
39  static const char* name() { return "LCP_FRAG_ORD"; }
40  LcpFragOrd m_req;
41  Ss_LCP_FRAG_ORD() {
42  m_sendREQ = (SsFUNCREQ)&PgmanProxy::sendLCP_FRAG_ORD;
43  m_sendCONF = (SsFUNCREP)0;
44  }
45  enum { poolSize = 1 };
46  static SsPool<Ss_LCP_FRAG_ORD>& pool(LocalProxy* proxy) {
47  return ((PgmanProxy*)proxy)->c_ss_LCP_FRAG_ORD;
48  }
49  };
50  SsPool<Ss_LCP_FRAG_ORD> c_ss_LCP_FRAG_ORD;
51  static Uint32 getSsId(const LcpFragOrd* req) {
52  return SsIdBase | (req->lcpId & 0xFFFF);
53  }
54  void execLCP_FRAG_ORD(Signal*);
55  void sendLCP_FRAG_ORD(Signal*, Uint32 ssId, SectionHandle*);
56 
57  // GSN_END_LCP_REQ
59  /*
60  * Sent once from LQH proxy (at LCP) and LGMAN (at SR).
61  * Each pgman instance runs LCP before we send a CONF.
62  */
63  static const char* name() { return "END_LCP_REQ"; }
64  EndLcpReq m_req;
65  Ss_END_LCP_REQ() {
66  m_sendREQ = (SsFUNCREQ)&PgmanProxy::sendEND_LCP_REQ;
67  m_sendCONF = (SsFUNCREP)&PgmanProxy::sendEND_LCP_CONF;
68  // extra worker (for extent pages) must run after others
69  m_extraLast = true;
70  }
71  enum { poolSize = 1 };
72  static SsPool<Ss_END_LCP_REQ>& pool(LocalProxy* proxy) {
73  return ((PgmanProxy*)proxy)->c_ss_END_LCP_REQ;
74  }
75  };
76  SsPool<Ss_END_LCP_REQ> c_ss_END_LCP_REQ;
77  static Uint32 getSsId(const EndLcpReq* req) {
78  return SsIdBase | (req->backupId & 0xFFFF);
79  }
80  static Uint32 getSsId(const EndLcpConf* conf) {
81  return conf->senderData;
82  }
83  static Uint32 getSsId(const ReleasePagesConf* conf) {
84  return conf->senderData;
85  }
86  void execEND_LCP_REQ(Signal*);
87  void sendEND_LCP_REQ(Signal*, Uint32 ssId, SectionHandle*);
88  void execEND_LCP_CONF(Signal*);
89  void sendEND_LCP_CONF(Signal*, Uint32 ssId);
90  void execRELEASE_PAGES_CONF(Signal*);
91 
92  // client methods
93  friend class Page_cache_client;
94 
95  int get_page(Page_cache_client& caller,
96  Signal*, Page_cache_client::Request& req, Uint32 flags);
97 
98  void update_lsn(Page_cache_client& caller,
99  Local_key key, Uint64 lsn);
100 
101  int drop_page(Page_cache_client& caller,
102  Local_key key, Uint32 page_id);
103 
104  Uint32 create_data_file(Signal*);
105 
106  Uint32 alloc_data_file(Signal*, Uint32 file_no);
107 
108  void map_file_no(Signal*, Uint32 file_no, Uint32 fd);
109 
110  void free_data_file(Signal*, Uint32 file_no, Uint32 fd);
111 
112  void send_data_file_ord(Signal*, Uint32 i, Uint32 ret,
113  Uint32 cmd, Uint32 file_no = RNIL, Uint32 fd = RNIL);
114 };
115 
116 #endif