diff --git a/Documentation/Tutorials/Notification-Service.md b/Documentation/Tutorials/Notification-Service.md
index 4cfc89cd2..fb59bd28d 100644
--- a/Documentation/Tutorials/Notification-Service.md
+++ b/Documentation/Tutorials/Notification-Service.md
@@ -37,7 +37,7 @@ This feature is not enabled by default: MaxScale must be configured in [feedback
[feedback]
feedback_enable=1
- feedback_url=https://mariadb.org/feedback_plugin/post
+ feedback_url=https://enterprise.mariadb.com/feedback/post
feedback_user_info=x-y-z-w
The activation code that will be provided by MariaDB corp upon request by the customer and it shlud be put in feedback_user_info.
diff --git a/server/core/config.c b/server/core/config.c
index 1adae44a5..dcf8d71eb 100644
--- a/server/core/config.c
+++ b/server/core/config.c
@@ -1338,6 +1338,10 @@ int i;
{
feedback.feedback_connect_timeout = atoi(value);
}
+ if (strcmp(name, "feedback_frequency") == 0)
+ {
+ feedback.feedback_frequency = atoi(value);
+ }
return 1;
}
@@ -1389,6 +1393,7 @@ feedback_defaults()
feedback.feedback_timeout = _NOTIFICATION_OPERATION_TIMEOUT;
feedback.feedback_connect_timeout = _NOTIFICATION_CONNECT_TIMEOUT;
feedback.feedback_url = NULL;
+ feedback.feedback_frequency = 1800;
feedback.release_info = gateway.release_string;
feedback.sysname = gateway.sysname;
feedback.mac_sha1 = gateway.mac_sha1;
@@ -2138,7 +2143,7 @@ config_get_release_string(char* release)
*end = 0;
to = strcpy(distribution, "lsb: ");
- memmove(to, found, end - found + 1);
+ memmove(to, found, end - found + 1 < INT_MAX ? end - found + 1 : INT_MAX);
strncpy(release, to, _RELEASE_STR_LENGTH);
@@ -2175,7 +2180,7 @@ config_get_release_string(char* release)
+5 and -8 below cut the file name part out of the
full pathname that corresponds to the mask as above.
*/
- new_to = strcpy(distribution, found.gl_pathv[0] + 5);
+ new_to = strncpy(distribution, found.gl_pathv[0] + 5,_RELEASE_STR_LENGTH - 1);
new_to += 8;
*new_to++ = ':';
*new_to++ = ' ';
@@ -2221,14 +2226,14 @@ config_enable_feedback_task(void) {
if (enable_set && url_set && user_info_set) {
/* Add the task to the tasl list */
- if (hktask_add("send_feedback", module_feedback_send, cfg, 1800)) {
+ if (hktask_add("send_feedback", module_feedback_send, cfg, cfg->feedback_frequency)) {
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"Notification service feedback task started: URL=%s, User-Info=%s, Frequency %u seconds",
cfg->feedback_url,
cfg->feedback_user_info,
- 1800)));
+ cfg->feedback_frequency)));
}
} else {
if (enable_set) {
diff --git a/server/core/dbusers.c b/server/core/dbusers.c
index 9f4528eb5..d2211ac6e 100644
--- a/server/core/dbusers.c
+++ b/server/core/dbusers.c
@@ -798,7 +798,7 @@ getUsers(SERVICE *service, USERS *users)
if (db_grants) {
/* we have dbgrants, store them */
if(row[5]){
- strcpy(dbnm,row[5]);
+ strncpy(dbnm,row[5],MYSQL_DATABASE_MAXLEN);
if(service->strip_db_esc) {
strip_escape_chars(dbnm);
}
diff --git a/server/core/load_utils.c b/server/core/load_utils.c
index d8a735ecd..6238c1255 100644
--- a/server/core/load_utils.c
+++ b/server/core/load_utils.c
@@ -65,6 +65,7 @@ static void register_module(const char *module,
MODULE_INFO *info);
static void unregister_module(const char *module);
int module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *cfg);
+int do_http_post(GWBUF *buffer, void *cfg);
struct MemoryStruct {
char *data;
@@ -568,13 +569,13 @@ module_feedback_send(void* data) {
GWBUF *buffer = NULL;
void *data_ptr=NULL;
long http_code = 0;
- struct MemoryStruct chunk;
int last_action = _NOTIFICATION_SEND_PENDING;
time_t now;
struct tm *now_tm;
int hour;
int n_mod=0;
char hex_setup_info[2 * SHA_DIGEST_LENGTH + 1]="";
+ int http_send = 0;
now = time(NULL);
now_tm = localtime(&now);
@@ -634,11 +635,6 @@ module_feedback_send(void* data) {
"module_feedback_send(): task now runs: hour is [%d], last_action [%d]",
hour, feedback_config->feedback_last_action)));
-
- /* allocate first memory chunck for httpd servr reply */
- chunk.data = malloc(1); /* will be grown as needed by the realloc above */
- chunk.size = 0; /* no data at this point */
-
if (!module_create_feedback_report(&buffer, modules_list, feedback_config)) {
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
@@ -649,118 +645,27 @@ module_feedback_send(void* data) {
return;
}
+ /* try sending data via http/https post */
+ http_send = do_http_post(buffer, feedback_config);
- /* Initializing curl library for data send via HTTP */
- curl_global_init(CURL_GLOBAL_DEFAULT);
-
- curl = curl_easy_init();
-
- if (curl) {
- char error_message[CURL_ERROR_SIZE]="";
-
- curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_message);
- curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
- curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, feedback_config->feedback_connect_timeout);
- curl_easy_setopt(curl, CURLOPT_TIMEOUT, feedback_config->feedback_timeout);
-
- /* curl API call for data send via HTTP POST using a "file" type input */
- curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "data",
- CURLFORM_BUFFER, "report.txt",
- CURLFORM_BUFFERPTR, (char *)GWBUF_DATA(buffer),
- CURLFORM_BUFFERLENGTH, strlen((char *)GWBUF_DATA(buffer)),
- CURLFORM_CONTENTTYPE, "text/plain",
- CURLFORM_END);
-
- curl_easy_setopt(curl, CURLOPT_HEADER, 1);
-
- /* some servers don't like requests that are made without a user-agent field, so we provide one */
- curl_easy_setopt(curl, CURLOPT_USERAGENT, "MaxScale-agent/http-1.0");
- /* Force HTTP/1.0 */
- curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
-
- curl_easy_setopt(curl, CURLOPT_URL, feedback_config->feedback_url);
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
-
-#ifdef SKIP_PEER_VERIFICATION
- /*
- * This makes the connection A LOT LESS SECURE.
- */
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
-#endif
-
-#ifdef SKIP_HOSTNAME_VERIFICATION
- /*
- * this will make the connection less secure.
- */
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
-#endif
-
- /* send all data to this function */
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
-
- /* we pass our 'chunk' struct to the callback function */
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
-
- /* Perform the request, res will get the return code */
- res = curl_easy_perform(curl);
-
- /* Check for errors */
- if(res != CURLE_OK) {
- last_action = _NOTIFICATION_SEND_ERROR;
-
- LOGIF(LE, (skygw_log_write_flush(
- LOGFILE_ERROR,
- "Error: module_feedback_send(), curl call for [%s] failed due: %s, %s",
- feedback_config->feedback_url,
- curl_easy_strerror(res),
- error_message)));
- } else {
- curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
- }
-
- if (http_code == 302) {
- char *from = strstr(chunk.data, "
ok
");
- if (from) {
- last_action = _NOTIFICATION_SEND_OK;
- } else {
- last_action = _NOTIFICATION_SEND_ERROR;
- }
- } else {
- last_action = _NOTIFICATION_SEND_ERROR;
- LOGIF(LE, (skygw_log_write_flush(
- LOGFILE_ERROR,
- "Error in module_feedback_send(), Bad HTTP Code from remote server: %lu",
- http_code)));
- }
+ if (http_send == 0) {
+ feedback_config->feedback_last_action = _NOTIFICATION_SEND_OK;
} else {
- LOGIF(LE, (skygw_log_write_flush(
- LOGFILE_ERROR,
- "Error in module_feedback_send(), curl object not initialized")));
- last_action = _NOTIFICATION_SEND_ERROR;
- }
+ feedback_config->feedback_last_action = _NOTIFICATION_SEND_ERROR;
- /* update last action in the config struct */
- feedback_config->feedback_last_action = last_action;
+ LOGIF(LT, (skygw_log_write_flush(
+ LOGFILE_TRACE,
+ "Error in module_create_feedback_report(): do_http_post ret_code is %d", http_send)));
+ }
LOGIF(LT, (skygw_log_write_flush(
LOGFILE_TRACE,
- "module_feedback_send(): task run result: hour is [%d], last_action [%d], HTTP code [%d]",
- hour, feedback_config->feedback_last_action, http_code)));
+ "module_feedback_send(): task completed: hour is [%d], last_action [%d]",
+ hour,
+ feedback_config->feedback_last_action)));
- if (chunk.data)
- free(chunk.data);
+ gwbuf_free(buffer);
- if (buffer)
- gwbuf_free(buffer);
-
- if (curl) {
- curl_easy_cleanup(curl);
- curl_formfree(formpost);
- }
-
- curl_global_cleanup();
}
/**
@@ -785,6 +690,8 @@ module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *c
time_t now;
struct tm *now_tm;
int report_max_bytes=0;
+ if(buffer == NULL)
+ return 0;
now = time(NULL);
@@ -809,7 +716,7 @@ module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *c
report_max_bytes = ((n_mod * 4) + 7) * (_NOTIFICATION_REPORT_ROW_LEN + 1);
*buffer = gwbuf_alloc(report_max_bytes);
- if (buffer == NULL) {
+ if (*buffer == NULL) {
return 0;
}
@@ -865,3 +772,125 @@ module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *c
return 1;
}
+/**
+ * Send data to notification service via http/https
+ *
+ * @param buffer The GWBUF with data to send
+ * @param cfg The configuration details of notification service
+ * @return 0 on success, != 0 on failure
+ */
+int
+do_http_post(GWBUF *buffer, void *cfg) {
+ CURL *curl = NULL;
+ CURLcode res;
+ struct curl_httppost *formpost=NULL;
+ struct curl_httppost *lastptr=NULL;
+ long http_code = 0;
+ struct MemoryStruct chunk;
+ int ret_code = 1;
+
+ FEEDBACK_CONF *feedback_config = (FEEDBACK_CONF *) cfg;
+
+ /* allocate first memory chunck for httpd servr reply */
+ chunk.data = malloc(1); /* will be grown as needed by the realloc above */
+ chunk.size = 0; /* no data at this point */
+
+ /* Initializing curl library for data send via HTTP */
+ curl_global_init(CURL_GLOBAL_DEFAULT);
+
+ curl = curl_easy_init();
+
+ if (curl) {
+ char error_message[CURL_ERROR_SIZE]="";
+
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_message);
+ curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, feedback_config->feedback_connect_timeout);
+ curl_easy_setopt(curl, CURLOPT_TIMEOUT, feedback_config->feedback_timeout);
+
+ /* curl API call for data send via HTTP POST using a "file" type input */
+ curl_formadd(&formpost,
+ &lastptr,
+ CURLFORM_COPYNAME, "data",
+ CURLFORM_BUFFER, "report.txt",
+ CURLFORM_BUFFERPTR, (char *)GWBUF_DATA(buffer),
+ CURLFORM_BUFFERLENGTH, strlen((char *)GWBUF_DATA(buffer)),
+ CURLFORM_CONTENTTYPE, "text/plain",
+ CURLFORM_END);
+
+ curl_easy_setopt(curl, CURLOPT_HEADER, 1);
+
+ /* some servers don't like requests that are made without a user-agent field, so we provide one */
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, "MaxScale-agent/http-1.0");
+ /* Force HTTP/1.0 */
+ curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+
+ curl_easy_setopt(curl, CURLOPT_URL, feedback_config->feedback_url);
+ curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
+
+ /* send all data to this function */
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
+
+ /* we pass our 'chunk' struct to the callback function */
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
+
+ /* Perform the request, res will get the return code */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK) {
+ ret_code = 2;
+ LOGIF(LE, (skygw_log_write_flush(
+ LOGFILE_ERROR,
+ "Error: do_http_post(), curl call for [%s] failed due: %s, %s",
+ feedback_config->feedback_url,
+ curl_easy_strerror(res),
+ error_message)));
+ goto cleanup;
+ } else {
+ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
+ }
+
+ if (http_code == 302) {
+ char *from = strstr(chunk.data, "ok
");
+ if (from) {
+ ret_code = 0;
+ } else {
+ ret_code = 3;
+ goto cleanup;
+ }
+ } else {
+ LOGIF(LE, (skygw_log_write_flush(
+ LOGFILE_ERROR,
+ "Error: do_http_post(), Bad HTTP Code from remote server: %lu",
+ http_code)));
+ ret_code = 4;
+ goto cleanup;
+ }
+ } else {
+ LOGIF(LE, (skygw_log_write_flush(
+ LOGFILE_ERROR,
+ "Error: do_http_post(), curl object not initialized")));
+ ret_code = 1;
+ goto cleanup;
+ }
+
+ LOGIF(LT, (skygw_log_write_flush(
+ LOGFILE_TRACE,
+ "do_http_post() ret_code [%d], HTTP code [%d]",
+ ret_code, http_code)));
+ cleanup:
+
+ if (chunk.data)
+ free(chunk.data);
+
+ if (curl) {
+ curl_easy_cleanup(curl);
+ curl_formfree(formpost);
+ }
+
+ curl_global_cleanup();
+
+ return ret_code;
+}
+
diff --git a/server/core/test/testfeedback.c b/server/core/test/testfeedback.c
index 9e84b5cb2..90c7c4a6d 100644
--- a/server/core/test/testfeedback.c
+++ b/server/core/test/testfeedback.c
@@ -21,14 +21,16 @@
* @verbatim
* Revision History
*
- * Date Who Description
- * 09-03-2015 Markus Mäkelä Initial implementation
+ * Date Who Description
+ * 09-03-2015 Markus Mäkelä Initial implementation
+ * 10-03-2015 Massimiliano Pinto Added http_check
*
* @endverbatim
*/
-#define FAILTEST(s) printf("TEST FAILED: " s "\n");return 1;
-
+#define FAILTEST(s) printf("TEST FAILED: " s "\n");return 1;
+#include
+#include
#include
#include
#include
@@ -39,13 +41,36 @@
#include
#include
+static char* server_options[] = {
+ "MariaDB Corporation MaxScale",
+ "--no-defaults",
+ "--datadir=",
+ "--language=",
+ "--skip-innodb",
+ "--default-storage-engine=myisam",
+ NULL
+};
+
+const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
+
+static char* server_groups[] = {
+ "embedded",
+ "server",
+ "server",
+ "embedded",
+ "server",
+ "server",
+ NULL
+};
+
+
int main(int argc, char** argv)
{
FEEDBACK_CONF* fc;
- char* home;
- char* cnf;
GWBUF* buf;
regex_t re;
+ char* home;
+ char* cnf;
hkinit();
home = getenv("MAXSCALE_HOME");
@@ -62,23 +87,30 @@ int main(int argc, char** argv)
printf("Config: %s\n",cnf);
+
+ mysql_library_init(num_elements, server_options, server_groups);
+
config_load(cnf);
- if((fc = config_get_feedback_data()) == NULL ||
- fc->feedback_user_info == NULL)
+ if ((fc = config_get_feedback_data()) == NULL)
{
- FAILTEST("Configuration was NULL.");
+ FAILTEST("Configuration for Feedback was NULL.");
}
+
regcomp(&re,fc->feedback_user_info,0);
module_create_feedback_report(&buf,NULL,fc);
- printf("%s",(char*)buf->start);
if(regexec(&re,(char*)buf->start,0,NULL,0))
{
FAILTEST("Regex match of 'user_info' failed.");
}
+ if (do_http_post(buf, fc) != 0)
+ {
+ FAILTEST("Http send failed\n");
+ }
+
return 0;
-}
+}
\ No newline at end of file
diff --git a/server/core/test/testservice.c b/server/core/test/testservice.c
index ef2560481..ca6fe6618 100644
--- a/server/core/test/testservice.c
+++ b/server/core/test/testservice.c
@@ -31,11 +31,9 @@
#include
#include
#include
+#include
#include
-#include
-#include
-#include "housekeeper.h"
static bool success = false;
@@ -58,17 +56,18 @@ DCB *dcb;
int result;
int argc = 3;
-char* argv[] =
-{
- "log_manager",
- "-j",
- TEST_LOG_DIR,
- NULL
-};
+init_test_env();
+/* char* argv[] = */
+/* { */
+/* "log_manager", */
+/* "-j", */
+/* TEST_LOG_DIR, */
+/* NULL */
+/* }; */
-skygw_logmanager_init(argc,argv);
-poll_init();
-hkinit();
+/* skygw_logmanager_init(argc,argv); */
+/* poll_init(); */
+/* hkinit(); */
/* Service tests */
ss_dfprintf(stderr,
diff --git a/server/include/config.h b/server/include/config.h
index ce27a3598..12b1b98fa 100644
--- a/server/include/config.h
+++ b/server/include/config.h
@@ -18,6 +18,7 @@
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include
+#include
#include
/**
* @file config.h The configuration handling elements
diff --git a/server/include/notification.h b/server/include/notification.h
index 6a7f07bac..6e40f5aee 100644
--- a/server/include/notification.h
+++ b/server/include/notification.h
@@ -52,6 +52,7 @@ typedef struct {
int feedback_timeout; /**< An attempt to write/read the data times out and fails after this many seconds */
int feedback_connect_timeout; /**< An attempt to send the data times out and fails after this many seconds */
int feedback_last_action; /**< Holds the feedback last send action status */
+ int feedback_frequency; /*< Frequency of the housekeeper task */
char *release_info; /**< Operating system Release name */
char *sysname; /**< Operating system name */
uint8_t *mac_sha1; /**< First available MAC address*/
diff --git a/server/include/test_utils.h b/server/include/test_utils.h
new file mode 100644
index 000000000..538c5d101
--- /dev/null
+++ b/server/include/test_utils.h
@@ -0,0 +1,26 @@
+#ifndef TEST_UTILS_H
+#define TEST_UTILS_H
+#include
+#include
+#include
+#include
+#include
+
+void init_test_env()
+{
+ int argc = 3;
+
+ char* argv[] =
+ {
+ "log_manager",
+ "-j",
+ TEST_LOG_DIR,
+ NULL
+ };
+
+ skygw_logmanager_init(argc,argv);
+ poll_init();
+ hkinit();
+}
+
+#endif
diff --git a/server/modules/routing/maxinfo/maxinfo_parse.c b/server/modules/routing/maxinfo/maxinfo_parse.c
index d7035dcc2..9eb445a22 100644
--- a/server/modules/routing/maxinfo/maxinfo_parse.c
+++ b/server/modules/routing/maxinfo/maxinfo_parse.c
@@ -126,7 +126,7 @@ MAXINFO_TREE *col, *table;
/**
* Parse a column list, may be a * or a valid list of string name
- * seperated by a comma
+ * separated by a comma
*
* @param sql Pointer to pointer to column list updated to point to the table name
* @return A tree of column names
@@ -148,9 +148,11 @@ MAXINFO_TREE * rval = NULL;
case LT_COMMA:
rval = make_tree_node(MAXOP_COLUMNS, text, NULL,
parse_column_list(ptr));
+ break;
case LT_FROM:
rval = make_tree_node(MAXOP_COLUMNS, text, NULL,
NULL);
+ break;
default:
break;
}
diff --git a/server/modules/routing/schemarouter/schemarouter.c b/server/modules/routing/schemarouter/schemarouter.c
index d2e7de4e8..4baa795b3 100644
--- a/server/modules/routing/schemarouter/schemarouter.c
+++ b/server/modules/routing/schemarouter/schemarouter.c
@@ -1632,7 +1632,7 @@ gen_show_dbs_response(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client)
rval = gwbuf_append(rval, last_packet);
rval = gwbuf_make_contiguous(rval);
-
+ hashtable_iterator_free(iter);
return rval;
}
@@ -2224,19 +2224,20 @@ static void clientReply (
goto lock_failed;
}
bref = get_bref_from_dcb(router_cli_ses, backend_dcb);
- skygw_log_write(LOGFILE_DEBUG,"schemarouter: Received reply from %s for session %p",
- bref->bref_backend->backend_server->unique_name,
- router_cli_ses->rses_client_dcb->session);
-#if !defined(FOR_BUG548_FIX_ONLY)
- /** This makes the issue becoming visible in poll.c */
+
if (bref == NULL)
{
/** Unlock router session */
rses_end_locked_router_action(router_cli_ses);
goto lock_failed;
}
-#endif
+ skygw_log_write(LOGFILE_DEBUG,"schemarouter: Received reply from %s for session %p",
+ bref->bref_backend->backend_server->unique_name,
+ router_cli_ses->rses_client_dcb->session);
+
+
+
if(router_cli_ses->init & INIT_MAPPING)
{
bool mapped = true, logged = false;
@@ -3905,7 +3906,7 @@ static bool handle_error_new_connection(
skygw_log_write(LOGFILE_TRACE,"schemarouter: Re-mapping databases");
gen_databaselist(rses->router,rses);
-
+ hashtable_iterator_free(iter);
return_succp:
return succp;
}
diff --git a/server/modules/routing/schemarouter/shardrouter.c b/server/modules/routing/schemarouter/shardrouter.c
index 8b82e4b3c..c4a9e88ed 100644
--- a/server/modules/routing/schemarouter/shardrouter.c
+++ b/server/modules/routing/schemarouter/shardrouter.c
@@ -274,7 +274,8 @@ char* get_lenenc_str(void* data, int* len)
if(data == NULL || len == NULL)
{
- *len = -1;
+ if(len)
+ *len = -1;
return NULL;
}
@@ -1099,7 +1100,8 @@ return_rses:
}
#endif
errorblock:
- if(client_rses->subservice)
+
+ if(client_rses && client_rses->subservice)
{
for(j = 0; j < i; j++)
{
@@ -1661,14 +1663,7 @@ routeQuery(ROUTER* instance,
ret = 1;
}
- else
- {
- /** Something else went wrong, terminate connection */
- ret = 0;
- }
-
goto retblock;
-
}
}
@@ -2794,6 +2789,9 @@ get_shard_subsvc(SUBSERVICE** subsvc,ROUTER_CLIENT_SES* session,char* target)
{
int i;
+ if(subsvc == NULL || session == NULL || target == NULL)
+ return false;
+
for(i = 0;in_subservice;i++)
{
if(strcmp(session->subservice[i]->service->name,target) == 0)
@@ -2859,7 +2857,7 @@ router_handle_state_switch(
CHK_DCB(dcb);
return rc;
-
+#if 0
if(SERVER_IS_RUNNING(srv) && SERVER_IS_IN_CLUSTER(srv))
{
goto return_rc;
@@ -2882,6 +2880,7 @@ router_handle_state_switch(
return_rc:
return rc;
+#endif
}
/**
diff --git a/server/modules/routing/schemarouter/test/testschemarouter2.c b/server/modules/routing/schemarouter/test/testschemarouter2.c
index 00c0a5bf6..a7dd1d94d 100644
--- a/server/modules/routing/schemarouter/test/testschemarouter2.c
+++ b/server/modules/routing/schemarouter/test/testschemarouter2.c
@@ -78,7 +78,7 @@ int main(int argc, char** argv)
goto report;
}
- sprintf(query,"STOP SLAVE",databases[i]);
+ sprintf(query,"STOP SLAVE");
if(mysql_real_query(server,query,strlen(query)))
{
fprintf(stderr, "Failed to stop slave in %d: %s.\n",