1 /*
2    Copyright (c) 2005, 2013, 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 #ifndef CREATE_FILEGROUP_IMPL_HPP
26 #define CREATE_FILEGROUP_IMPL_HPP
27 
28 #include "SignalData.hpp"
29 
30 #define JAM_FILE_ID 53
31 
32 
33 struct CreateFilegroupImplReq {
34   /**
35    * Sender(s) / Reciver(s)
36    */
37   friend class Dbdict;
38   friend class Tsman;
39   friend class Lgman;
40 
41   /**
42    * For printing
43    */
44   friend bool printCREATE_FILEGROUP_IMPL_REQ(FILE*, const Uint32*, Uint32, Uint16);
45 
46   STATIC_CONST( SignalLength = 5 ); // DICT2DICT
47   STATIC_CONST( TablespaceLength = 7 );
48   STATIC_CONST( LogfileGroupLength = 6 );
49 
50   Uint32 senderData;
51   Uint32 senderRef;
52   Uint32 filegroup_id;
53   Uint32 filegroup_version;
54   Uint32 requestType;
55 
56   union {
57     struct {
58       Uint32 extent_size;
59       Uint32 logfile_group_id;
60     } tablespace;
61     struct {
62       Uint32 buffer_size; // In pages
63     } logfile_group;
64   };
65 };
66 
67 struct CreateFilegroupImplRef {
68   /**
69    * Sender(s)
70    */
71   friend class Dbdict;
72   friend class Tsman;
73   friend class Lgman;
74 
75   /**
76    * For printing
77    */
78   friend bool printCREATE_FILEGROUP_IMPL_REF(FILE*, const Uint32*, Uint32, Uint16);
79 
80   STATIC_CONST( SignalLength = 3 );
81 
82   enum ErrorCode {
83     NoError = 0,
84     FilegroupAlreadyExists = 1502,
85     OutOfFilegroupRecords = 1503,
86     OutOfLogBufferMemory = 1504,
87     OneLogfileGroupLimit = 1514
88   };
89 
90   Uint32 senderData;
91   Uint32 senderRef;
92   Uint32 errorCode;
93 };
94 
95 struct CreateFilegroupImplConf {
96   /**
97    * Sender(s)
98    */
99   friend class Dbdict;
100   friend class Tsman;
101   friend class Lgman;
102 
103   /**
104    * For printing
105    */
106   friend bool printCREATE_FILEGROUP_IMPL_CONF(FILE*, const Uint32*, Uint32, Uint16);
107 
108   STATIC_CONST( SignalLength = 2 );
109 
110   Uint32 senderData;
111   Uint32 senderRef;
112 };
113 
114 struct CreateFileImplReq {
115   /**
116    * Sender(s) / Reciver(s)
117    */
118   friend class Dbdict;
119   friend class Tsman;
120   friend class Lgman;
121 
122   /**
123    * For printing
124    */
125   friend bool printCREATE_FILE_IMPL_REQ(FILE*, const Uint32*, Uint32, Uint16);
126 
127   STATIC_CONST( SignalLength = 11 ); // DICT2DICT
128   STATIC_CONST( DatafileLength = 10 );
129   STATIC_CONST( UndofileLength = 9 );
130   STATIC_CONST( CommitLength = 7 );
131   STATIC_CONST( AbortLength = 7 );
132   SECTION( FILENAME = 0 );
133 
134   enum RequestInfo {
135     Create = 0x1,
136     CreateForce = 0x2,
137     Open = 0x4,
138     Commit = 0x8,
139     Abort = 0x10
140   };
141 
142   Uint32 senderData;
143   Uint32 senderRef;
144   Uint32 requestInfo;
145   Uint32 file_id;
146   Uint32 file_version;
147   Uint32 filegroup_id;
148   Uint32 filegroup_version;
149   Uint32 file_size_hi;
150   Uint32 file_size_lo;
151 
152   union {
153     struct {
154       Uint32 extent_size;
155     } tablespace;
156   };
157   Uint32 requestType;
158 };
159 
160 struct CreateFileImplRef {
161   friend class Dbdict;
162   friend class Tsman;
163   friend class Lgman;
164 
165   /**
166    * For printing
167    */
168   friend bool printCREATE_FILE_IMPL_REF(FILE*, const Uint32*, Uint32, Uint16);
169 
170   STATIC_CONST( SignalLength = 5 );
171 
172   enum ErrorCode {
173     NoError = 0,
174     InvalidFilegroup = 1505,
175     InvalidFilegroupVersion = 1506,
176     FileNoAlreadyExists = 1507,
177     OutOfFileRecords = 1508,
178     FileError = 1509,
179     InvalidFileMetadata = 1510,
180     OutOfMemory = 1511,
181     FileReadError = 1512,
182     FilegroupNotOnline = 1513,
183     FileSizeTooLarge = 1515,
184     FileSizeTooSmall = 1516
185   };
186 
187   Uint32 senderData;
188   Uint32 senderRef;
189   Uint32 errorCode;
190   Uint32 fsErrCode;
191   Uint32 osErrCode;
192 };
193 
194 struct CreateFileImplConf {
195   friend class Dbdict;
196   friend class Tsman;
197   friend class Lgman;
198 
199 
200   /**
201    * For printing
202    */
203   friend bool printCREATE_FILE_IMPL_CONF(FILE*, const Uint32*, Uint32, Uint16);
204 
205   STATIC_CONST( SignalLength = 4 );
206 
207   Uint32 senderData;
208   Uint32 senderRef;
209 };
210 
211 
212 #undef JAM_FILE_ID
213 
214 #endif
215