1 /*
2 Copyright (c) 2017, 2020, 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 NDB_DUMMY_TS_H
26 #define NDB_DUMMY_TS_H
27
28 // Implementing the callbacks for working with SDI
29 // in tablespaces as defined in handler.h
30 #include "sql/handler.h"
31
32 // These are dummy callback implementations as there is no
33 // point in keeping .SDI files for each table stored in
34 // the data directory of MySQL Server. The tables and
35 // their metadata is safely stored in the transactional
36 // dictionary of NDB
37
38 namespace ndb_dummy_ts {
39
40 /**
41 Create SDI in a tablespace. This API should be used when
42 upgrading a tablespace with no SDI.
43 @param[in,out] tablespace tablespace object
44 @retval false success
45 @retval true failure
46 */
sdi_create(dd::Tablespace * tablespace MY_ATTRIBUTE ((unused)))47 static bool sdi_create(dd::Tablespace *tablespace MY_ATTRIBUTE((unused))) {
48 DBUG_ASSERT(false); // Never called
49 return false; // Success
50 }
51
52 /**
53 Drop SDI in a tablespace. This API should be used only
54 when SDI is corrupted.
55 @param[in,out] tablespace tablespace object
56 @retval false success
57 @retval true failure
58 */
sdi_drop(dd::Tablespace * tablespace MY_ATTRIBUTE ((unused)))59 static bool sdi_drop(dd::Tablespace *tablespace MY_ATTRIBUTE((unused))) {
60 DBUG_ASSERT(false); // Never called
61 return false; // Success
62 }
63
64 /**
65 Get the SDI keys in a tablespace into the vector provided.
66 @param[in] tablespace tablespace object
67 @param[in,out] vector vector to hold SDI keys
68 @retval false success
69 @retval true failure
70 */
sdi_get_keys(const dd::Tablespace & tablespace MY_ATTRIBUTE ((unused)),sdi_vector_t & vector MY_ATTRIBUTE ((unused)))71 static bool sdi_get_keys(const dd::Tablespace &tablespace
72 MY_ATTRIBUTE((unused)),
73 sdi_vector_t &vector MY_ATTRIBUTE((unused))) {
74 DBUG_ASSERT(false); // Never called
75 return false; // Success
76 }
77
78 /** Retrieve SDI from tablespace
79 @param[in] tablespace tablespace object
80 @param[in] sdi_key SDI key
81 @param[in,out] sdi SDI retrieved from tablespace
82 @param[in,out] sdi_len in: size of memory allocated
83 out: actual length of SDI
84 @retval false success
85 @retval true failure
86 */
sdi_get(const dd::Tablespace & tablespace MY_ATTRIBUTE ((unused)),const sdi_key_t * sdi_key MY_ATTRIBUTE ((unused)),void * sdi MY_ATTRIBUTE ((unused)),uint64 * sdi_len MY_ATTRIBUTE ((unused)))87 static bool sdi_get(const dd::Tablespace &tablespace MY_ATTRIBUTE((unused)),
88 const sdi_key_t *sdi_key MY_ATTRIBUTE((unused)),
89 void *sdi MY_ATTRIBUTE((unused)),
90 uint64 *sdi_len MY_ATTRIBUTE((unused))) {
91 DBUG_ASSERT(false); // Never called
92 return false; // Success
93 }
94
95 /** Insert/Update SDI in tablespace
96 @param[in] hton handlerton object
97 @param[in] tablespace tablespace object
98 @param[in] table table object
99 @param[in] sdi_key SDI key to uniquely identify the tablespace
100 object
101 @param[in] sdi SDI to be stored in tablespace
102 @param[in] sdi_len SDI length
103 @retval false success
104 @retval true failure
105 */
sdi_set(handlerton * hton MY_ATTRIBUTE ((unused)),const dd::Tablespace & tablespace MY_ATTRIBUTE ((unused)),const dd::Table * table MY_ATTRIBUTE ((unused)),const sdi_key_t * sdi_key MY_ATTRIBUTE ((unused)),const void * sdi MY_ATTRIBUTE ((unused)),uint64 sdi_len MY_ATTRIBUTE ((unused)))106 static bool sdi_set(handlerton *hton MY_ATTRIBUTE((unused)),
107 const dd::Tablespace &tablespace MY_ATTRIBUTE((unused)),
108 const dd::Table *table MY_ATTRIBUTE((unused)),
109 const sdi_key_t *sdi_key MY_ATTRIBUTE((unused)),
110 const void *sdi MY_ATTRIBUTE((unused)),
111 uint64 sdi_len MY_ATTRIBUTE((unused))) {
112 return false; // Success
113 }
114
115 /**
116 Delete SDI from tablespace
117 @param[in] tablespace tablespace object
118 @param[in] table table object
119 @param[in] sdi_key SDI key to uniquely identify the tablespace
120 object
121 @retval false success
122 @retval true failure
123 */
sdi_delete(const dd::Tablespace & tablespace MY_ATTRIBUTE ((unused)),const dd::Table * table MY_ATTRIBUTE ((unused)),const sdi_key_t * sdi_key MY_ATTRIBUTE ((unused)))124 static bool sdi_delete(const dd::Tablespace &tablespace MY_ATTRIBUTE((unused)),
125 const dd::Table *table MY_ATTRIBUTE((unused)),
126 const sdi_key_t *sdi_key MY_ATTRIBUTE((unused))) {
127 return false; // Success
128 }
129 } // namespace ndb_dummy_ts
130
131 #endif
132