26 #define IS_TMP_PREFIX(A) (is_prefix(A, tmp_file_prefix))
28 #define INJECTOR_EVENT_LEN 200
30 #define NDB_INVALID_SCHEMA_OBJECT 241
47 closefrm(shadow_table, 1);
49 free_root(&mem_root, MYF(0));
55 my_free(ndb_value[0], MYF(MY_WME|MY_ALLOW_ZERO_PTR));
73 SOT_RENAME_TABLE_NEW= 2,
74 SOT_ALTER_TABLE_COMMIT= 3,
82 SOT_TRUNCATE_TABLE= 11,
83 SOT_RENAME_TABLE_PREPARE= 12,
84 SOT_ONLINE_ALTER_TABLE_PREPARE= 13,
85 SOT_ONLINE_ALTER_TABLE_COMMIT= 14,
93 const uint max_ndb_nodes= 256;
95 static const char *ha_ndb_ext=
".ndb";
97 #ifdef HAVE_NDB_BINLOG
98 #define NDB_EXCEPTIONS_TABLE_SUFFIX "$EX"
99 #define NDB_EXCEPTIONS_TABLE_SUFFIX_LOWER "$ex"
101 const uint error_conflict_fn_violation= 9999;
108 Mutex_guard(pthread_mutex_t &mutex) : m_mutex(mutex)
110 pthread_mutex_lock(&m_mutex);
114 pthread_mutex_unlock(&m_mutex);
117 pthread_mutex_t &m_mutex;
123 extern unsigned char g_node_id_map[max_ndb_nodes];
124 extern pthread_mutex_t LOCK_ndb_util_thread;
125 extern pthread_cond_t COND_ndb_util_thread;
126 extern pthread_mutex_t LOCK_ndb_index_stat_thread;
127 extern pthread_cond_t COND_ndb_index_stat_thread;
128 extern pthread_mutex_t ndbcluster_mutex;
129 extern HASH ndbcluster_open_tables;
134 void ndbcluster_binlog_init_handlerton();
139 int ndbcluster_create_binlog_setup(THD *thd,
Ndb *ndb,
const char *key,
144 int ndbcluster_create_event(THD *thd,
Ndb *ndb,
const NDBTAB *
table,
145 const char *event_name,
NDB_SHARE *share,
146 int push_warning= 0);
147 int ndbcluster_create_event_ops(THD *thd,
150 const char *event_name);
151 int ndbcluster_log_schema_op(THD *thd,
152 const char *
query,
int query_length,
155 uint32 ndb_table_version,
156 enum SCHEMA_OP_TYPE
type,
158 const char *new_table_name);
159 int ndbcluster_drop_event(THD *thd,
Ndb *ndb,
NDB_SHARE *share,
160 const char *type_str,
161 const char * dbname,
const char * tabname);
162 int ndbcluster_handle_drop_table(THD *thd,
Ndb *ndb,
NDB_SHARE *share,
163 const char *type_str,
164 const char * db,
const char * tabname);
165 void ndb_rep_event_name(
String *event_name,
166 const char *db,
const char *tbl, my_bool full);
167 #ifdef HAVE_NDB_BINLOG
169 ndbcluster_get_binlog_replication_info(THD *thd,
Ndb *ndb,
174 Uint32* binlog_flags,
175 const st_conflict_fn_def** conflict_fn,
176 st_conflict_fn_arg* args,
179 ndbcluster_apply_binlog_replication_info(THD *thd,
183 const st_conflict_fn_def* conflict_fn,
184 const st_conflict_fn_arg* args,
186 bool do_set_binlog_flags,
187 Uint32 binlog_flags);
189 ndbcluster_read_binlog_replication(THD *thd,
Ndb *ndb,
194 bool do_set_binlog_flags);
196 int ndb_create_table_from_engine(THD *thd,
const char *db,
198 int ndbcluster_binlog_start();
207 bool ndb_binlog_setup(THD *thd);
215 bool ndb_binlog_is_read_only(
void);
217 extern NDB_SHARE *ndb_apply_status_share;
220 extern my_bool ndb_binlog_running;
223 ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print,
224 enum ha_stat_type stat_type);
230 int cmp_frm(
const NDBTAB *ndbtab,
const void *pack_data,
232 int ndbcluster_find_all_files(THD *thd);
234 char *ndb_pack_varchar(
const NDBCOL *col,
char *
buf,
235 const char *str,
int sz);
237 NDB_SHARE *ndbcluster_get_share(
const char *key,
239 bool create_if_not_exists,
242 void ndbcluster_free_share(
NDB_SHARE **share,
bool have_lock);
243 void ndbcluster_real_free_share(
NDB_SHARE **share);
244 int handle_trailing_share(THD *thd,
NDB_SHARE *share);
245 int ndbcluster_prepare_rename_share(
NDB_SHARE *share,
const char *new_key);
246 int ndbcluster_rename_share(THD *thd,
NDB_SHARE *share);
247 int ndbcluster_undo_rename_share(THD *thd,
NDB_SHARE *share);
248 inline NDB_SHARE *get_share(
const char *key,
250 bool create_if_not_exists= TRUE,
251 bool have_lock= FALSE)
253 return ndbcluster_get_share(key, table, create_if_not_exists, have_lock);
258 return ndbcluster_get_share(share);
261 inline void free_share(
NDB_SHARE **share,
bool have_lock= FALSE)
263 ndbcluster_free_share(share, have_lock);
272 ndbcluster_check_if_local_table(
const char *dbname,
const char *tabname);
274 ndbcluster_check_if_local_tables_in_db(THD *thd,
const char *dbname);
276 bool ndbcluster_anyvalue_is_reserved(Uint32 anyValue);
277 bool ndbcluster_anyvalue_is_nologging(Uint32 anyValue);
278 void ndbcluster_anyvalue_set_nologging(Uint32& anyValue);
279 bool ndbcluster_anyvalue_is_serverid_in_range(Uint32 serverId);
280 void ndbcluster_anyvalue_set_normal(Uint32& anyValue);
281 Uint32 ndbcluster_anyvalue_get_serverid(Uint32 anyValue);
282 void ndbcluster_anyvalue_set_serverid(Uint32& anyValue, Uint32 serverId);
285 void dbug_ndbcluster_anyvalue_set_userbits(Uint32& anyValue);