1 /*
2    Copyright (c) 2011, 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 #include "ndb_mi.h"
26 #include "ha_ndbcluster_glue.h"
27 #include "my_sys.h"
28 #include "hash.h"
29 #include "rpl_mi.h"
30 
31 #ifdef HAVE_NDB_BINLOG
32 
33 extern Master_info *active_mi;
34 
35 
ndb_mi_get_master_server_id()36 uint32 ndb_mi_get_master_server_id()
37 {
38   return (uint32) active_mi->master_id;
39 }
40 
ndb_mi_get_group_master_log_name()41 const char* ndb_mi_get_group_master_log_name()
42 {
43 #if MYSQL_VERSION_ID < 50600
44   return active_mi->rli.group_master_log_name;
45 #else
46   return active_mi->rli->get_group_master_log_name();
47 #endif
48 }
49 
ndb_mi_get_group_master_log_pos()50 uint64 ndb_mi_get_group_master_log_pos()
51 {
52 #if MYSQL_VERSION_ID < 50600
53   return (uint64) active_mi->rli.group_master_log_pos;
54 #else
55   return (uint64) active_mi->rli->get_group_master_log_pos();
56 #endif
57 }
58 
ndb_mi_get_future_event_relay_log_pos()59 uint64 ndb_mi_get_future_event_relay_log_pos()
60 {
61 #if MYSQL_VERSION_ID < 50600
62   return (uint64) active_mi->rli.future_event_relay_log_pos;
63 #else
64   return (uint64) active_mi->rli->get_future_event_relay_log_pos();
65 #endif
66 }
67 
ndb_mi_get_group_relay_log_pos()68 uint64 ndb_mi_get_group_relay_log_pos()
69 {
70 #if MYSQL_VERSION_ID < 50600
71   return (uint64) active_mi->rli.group_relay_log_pos;
72 #else
73   return (uint64) active_mi->rli->get_group_relay_log_pos();
74 #endif
75 }
76 
ndb_mi_get_ignore_server_id(uint32 server_id)77 bool ndb_mi_get_ignore_server_id(uint32 server_id)
78 {
79   return (active_mi->shall_ignore_server_id(server_id) != 0);
80 }
81 
ndb_mi_get_slave_run_id()82 uint32 ndb_mi_get_slave_run_id()
83 {
84   return active_mi->rli->slave_run_id;
85 }
86 
ndb_mi_get_in_relay_log_statement(Relay_log_info * rli)87 bool ndb_mi_get_in_relay_log_statement(Relay_log_info* rli)
88 {
89   return (rli->get_flag(Relay_log_info::IN_STMT) != 0);
90 }
91 
92 /* #ifdef HAVE_NDB_BINLOG */
93 
94 #endif
95