1 /*
2    Copyright (c) 2011, 2015, 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_SCHEMA_DIST_H
26 #define NDB_SCHEMA_DIST_H
27 
28 #include <mysql/plugin.h>
29 #include <my_global.h>
30 
31 
32 /**
33   Check if schema distribution has been initialized and is
34   ready. Will return true when the component is properly setup
35   to receive schema op events from the cluster.
36 */
37 bool ndb_schema_dist_is_ready(void);
38 
39 
40 /*
41   The numbers below must not change as they
42   are passed between mysql servers, and if changed
43   would break compatablility.  Add new numbers to
44   the end.
45 */
46 enum SCHEMA_OP_TYPE
47 {
48   SOT_DROP_TABLE= 0,
49   SOT_CREATE_TABLE= 1,
50   SOT_RENAME_TABLE_NEW= 2, // Unused, but still reserved
51   SOT_ALTER_TABLE_COMMIT= 3,
52   SOT_DROP_DB= 4,
53   SOT_CREATE_DB= 5,
54   SOT_ALTER_DB= 6,
55   SOT_CLEAR_SLOCK= 7,
56   SOT_TABLESPACE= 8,
57   SOT_LOGFILE_GROUP= 9,
58   SOT_RENAME_TABLE= 10,
59   SOT_TRUNCATE_TABLE= 11,
60   SOT_RENAME_TABLE_PREPARE= 12,
61   SOT_ONLINE_ALTER_TABLE_PREPARE= 13,
62   SOT_ONLINE_ALTER_TABLE_COMMIT= 14,
63   SOT_CREATE_USER= 15,
64   SOT_DROP_USER= 16,
65   SOT_RENAME_USER= 17,
66   SOT_GRANT= 18,
67   SOT_REVOKE= 19
68 };
69 
70 
71 int ndbcluster_log_schema_op(THD* thd,
72                              const char *query, int query_length,
73                              const char *db, const char *table_name,
74                              uint32 ndb_table_id,
75                              uint32 ndb_table_version,
76                              SCHEMA_OP_TYPE type,
77                              const char *new_db,
78                              const char *new_table_name,
79                              bool log_query_on_participant = true);
80 
81 const char* get_schema_type_name(uint type);
82 
83 
84 #endif
85