1 /*
2    Copyright (c) 2011, 2021, Oracle and/or its affiliates.
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 #include "my_global.h"
26 #include "ndb_schema_dist.h"
27 
28 
29 const char*
get_schema_type_name(uint type)30 get_schema_type_name(uint type)
31 {
32   switch(type){
33   case SOT_DROP_TABLE:
34     return "DROP_TABLE";
35   case SOT_CREATE_TABLE:
36     return "CREATE_TABLE";
37   case SOT_ALTER_TABLE_COMMIT:
38     return "ALTER_TABLE_COMMIT";
39   case SOT_DROP_DB:
40     return "DROP_DB";
41   case SOT_CREATE_DB:
42     return "CREATE_DB";
43   case SOT_ALTER_DB:
44     return "ALTER_DB";
45   case SOT_CLEAR_SLOCK:
46     return "CLEAR_SLOCK";
47   case SOT_TABLESPACE:
48     return "TABLESPACE";
49   case SOT_LOGFILE_GROUP:
50     return "LOGFILE_GROUP";
51   case SOT_RENAME_TABLE:
52     return "RENAME_TABLE";
53   case SOT_TRUNCATE_TABLE:
54     return "TRUNCATE_TABLE";
55   case SOT_RENAME_TABLE_PREPARE:
56     return "RENAME_TABLE_PREPARE";
57   case SOT_ONLINE_ALTER_TABLE_PREPARE:
58     return "ONLINE_ALTER_TABLE_PREPARE";
59   case SOT_ONLINE_ALTER_TABLE_COMMIT:
60     return "ONLINE_ALTER_TABLE_COMMIT";
61   case SOT_CREATE_USER:
62     return "CREATE_USER";
63   case SOT_DROP_USER:
64     return "DROP_USER";
65   case SOT_RENAME_USER:
66     return "RENAME_USER";
67   case SOT_GRANT:
68     return "GRANT";
69   case SOT_REVOKE:
70     return "REVOKE";
71   }
72   return "<unknown>";
73 }
74 
75 extern struct NDB_SHARE* ndb_schema_share;
76 
ndb_schema_dist_is_ready(void)77 bool ndb_schema_dist_is_ready(void)
78 {
79   if (ndb_schema_share)
80     return true;
81 
82   DBUG_PRINT("info", ("ndb schema dist not ready"));
83   return false;
84 }
85