1 /* Copyright 2011 Codership Oy <http://www.codership.com>
2    Copyright 2014 SkySQL Ab.
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 as published by
6    the Free Software Foundation; version 2 of the License.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
16 
17 #include "mariadb.h"
18 #include "mysqld.h"
19 #include "sys_vars_shared.h"
20 #include "wsrep.h"
21 #include "wsrep_sst.h"
22 
23 extern char *my_bind_addr_str;
24 
wsrep_check_opts()25 int wsrep_check_opts()
26 {
27   if (wsrep_slave_threads > 1)
28   {
29     sys_var *autoinc_lock_mode=
30       intern_find_sys_var(STRING_WITH_LEN("innodb_autoinc_lock_mode"));
31     bool is_null;
32     if (autoinc_lock_mode &&
33         autoinc_lock_mode->val_int(&is_null, 0, OPT_GLOBAL, 0) != 2)
34     {
35       WSREP_ERROR("Parallel applying (wsrep_slave_threads > 1) requires"
36                   " innodb_autoinc_lock_mode= 2.");
37       return 1;
38     }
39   }
40 
41   if (locked_in_memory)
42   {
43     WSREP_ERROR("Memory locking is not supported (locked_in_memory=ON)");
44     return 1;
45   }
46 
47   if (!strcasecmp(wsrep_sst_method, "mysqldump"))
48   {
49     if (my_bind_addr_str &&
50         (!strcasecmp(my_bind_addr_str, "127.0.0.1") ||
51          !strcasecmp(my_bind_addr_str, "localhost")))
52     {
53       WSREP_WARN("wsrep_sst_method is set to 'mysqldump' yet "
54                   "mysqld bind_address is set to '%s', which makes it "
55                   "impossible to receive state transfer from another "
56                   "node, since mysqld won't accept such connections. "
57                   "If you wish to use mysqldump state transfer method, "
58                   "set bind_address to allow mysql client connections "
59                   "from other cluster members (e.g. 0.0.0.0).",
60                   my_bind_addr_str);
61     }
62   }
63   else
64   {
65     // non-mysqldump SST requires wsrep_cluster_address on startup
66     if (!wsrep_cluster_address_exists())
67     {
68       WSREP_ERROR ("%s SST method requires wsrep_cluster_address to be "
69                    "configured on startup.", wsrep_sst_method);
70       return 1;
71     }
72   }
73 
74   if (strcasecmp(wsrep_sst_receive_address, "AUTO"))
75   {
76     if (!strncasecmp(wsrep_sst_receive_address, STRING_WITH_LEN("127.0.0.1")) ||
77         !strncasecmp(wsrep_sst_receive_address, STRING_WITH_LEN("localhost")))
78     {
79       WSREP_WARN("wsrep_sst_receive_address is set to '%s' which "
80                  "makes it impossible for another host to reach this "
81                  "one. Please set it to the address which this node "
82                  "can be connected at by other cluster members.",
83                  wsrep_sst_receive_address);
84     }
85   }
86 
87   if (strcasecmp(wsrep_provider, "NONE"))
88   {
89     if (global_system_variables.binlog_format != BINLOG_FORMAT_ROW)
90     {
91       WSREP_ERROR("Only binlog_format= 'ROW' is currently supported. "
92                   "Configured value: '%s'. Please adjust your "
93                   "configuration.",
94                   binlog_format_names[global_system_variables.binlog_format]);
95 
96       return 1;
97     }
98   }
99   return 0;
100 }
101 
102