Merge branch 'develop' into 1.2.1-binlog_router_trx
This commit is contained in:
@ -96,7 +96,7 @@ configure_file(${CMAKE_SOURCE_DIR}/etc/postinst.in ${CMAKE_BINARY_DIR}/postinst
|
|||||||
configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm @ONLY)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.cnf ${CMAKE_BINARY_DIR}/maxscale.cnf @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.cnf ${CMAKE_BINARY_DIR}/maxscale.cnf @ONLY)
|
||||||
|
|
||||||
set(FLAGS "-Wall -Wno-unused-variable -Wno-unused-function -fPIC" CACHE STRING "Compilation flags")
|
set(FLAGS "-Wall -Wno-unused-variable -Wno-unused-function -Werror -fPIC" CACHE STRING "Compilation flags")
|
||||||
set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4" CACHE STRING "Debug compilation flags")
|
set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4" CACHE STRING "Debug compilation flags")
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_GREATER 2.6)
|
if(CMAKE_VERSION VERSION_GREATER 2.6)
|
||||||
|
@ -10,8 +10,6 @@ This section describes the limitations that are common to all configuration of p
|
|||||||
|
|
||||||
Compression is not included in MySQL server handshake
|
Compression is not included in MySQL server handshake
|
||||||
|
|
||||||
## Limitations with MySQL Master/Slave Replication monitoring
|
|
||||||
|
|
||||||
## Limitations with Galera Cluster Monitoring
|
## Limitations with Galera Cluster Monitoring
|
||||||
|
|
||||||
Master selection is based only on MIN(wsrep_local_index), no other server parameter.
|
Master selection is based only on MIN(wsrep_local_index), no other server parameter.
|
||||||
@ -35,7 +33,9 @@ In master-slave replication cluster also read-only queries are routed to master
|
|||||||
* statement includes a stored procedure, or an UDF call
|
* statement includes a stored procedure, or an UDF call
|
||||||
|
|
||||||
### Limitations in client session handling
|
### Limitations in client session handling
|
||||||
|
|
||||||
Some of the queries that client sends are routed to all backends instead of sending them just to one of server. These queries include `USE <db name>` and `SET autocommit=0` among many others. Readwritesplit sends a copy of these queries to each backend server and forwards the master's reply to the client. Below is a list of MySQL commands which are classified as session commands :
|
Some of the queries that client sends are routed to all backends instead of sending them just to one of server. These queries include `USE <db name>` and `SET autocommit=0` among many others. Readwritesplit sends a copy of these queries to each backend server and forwards the master's reply to the client. Below is a list of MySQL commands which are classified as session commands :
|
||||||
|
|
||||||
```
|
```
|
||||||
COM_INIT_DB (USE <db name> creates this)
|
COM_INIT_DB (USE <db name> creates this)
|
||||||
|
|
||||||
@ -90,4 +90,4 @@ Most imaginable reasons are related to replication lag but it could be possible
|
|||||||
|
|
||||||
## Authentication Related Limitations
|
## Authentication Related Limitations
|
||||||
|
|
||||||
MySQL old passwords are not supported
|
MySQL old style passwords are not supported. MySQL versions 4.1 and newer use a new authentication protocol which does not support pre-4.1 style passwords.
|
||||||
|
@ -73,9 +73,12 @@ When value all is used, queries reading session variables can be routed to any a
|
|||||||
|
|
||||||
In above-mentioned case the user-defined variable would only be updated in the master where query would be routed due to `INSERT` statement.
|
In above-mentioned case the user-defined variable would only be updated in the master where query would be routed due to `INSERT` statement.
|
||||||
|
|
||||||
**`max_sescmd_history`** sets a limit on how many session commands each session can execute before the connection is closed. The default is an unlimited number of session commands.
|
**`max_sescmd_history`** sets a limit on how many session commands each session can execute before the session command history is disabled. The default is an unlimited number of session commands.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Set a limit on the session command history
|
||||||
max_sescmd_history=1500
|
max_sescmd_history=1500
|
||||||
|
```
|
||||||
|
|
||||||
When a limitation is set, it effectively creates a cap on the session's memory consumption. This might be useful if connection pooling is used and the sessions use large amounts of session commands.
|
When a limitation is set, it effectively creates a cap on the session's memory consumption. This might be useful if connection pooling is used and the sessions use large amounts of session commands.
|
||||||
|
|
||||||
@ -86,13 +89,6 @@ When a limitation is set, it effectively creates a cap on the session's memory c
|
|||||||
disable_sescmd_history=true
|
disable_sescmd_history=true
|
||||||
```
|
```
|
||||||
|
|
||||||
**`disable_slave_recovery`** disables the recovery and replacement of slave servers. If this option is enabled and a connection to a slave server in use is lost, no replacement slave will be taken. This allows the safe use of session state modifying statements when the session command history is disabled. This is mostly intended to be used with the `disable_sescmd_history` option enabled.
|
|
||||||
|
|
||||||
```
|
|
||||||
# Disable the session command history
|
|
||||||
disable_slave_recovery=true
|
|
||||||
```
|
|
||||||
|
|
||||||
**`master_accept_reads`** allows the master server to be used for reads. This is a useful option to enable if you are using a small number of servers and wish to use the master for reads as well.
|
**`master_accept_reads`** allows the master server to be used for reads. This is a useful option to enable if you are using a small number of servers and wish to use the master for reads as well.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -23,12 +23,12 @@ endif()
|
|||||||
target_link_libraries(maxscale ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++)
|
target_link_libraries(maxscale ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++)
|
||||||
install(TARGETS maxscale DESTINATION ${MAXSCALE_BINDIR})
|
install(TARGETS maxscale DESTINATION ${MAXSCALE_BINDIR})
|
||||||
|
|
||||||
add_executable(maxkeys maxkeys.c secrets.c utils.c gwdirs.c)
|
add_executable(maxkeys maxkeys.c secrets.c utils.c gwdirs.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc)
|
||||||
target_link_libraries(maxkeys log_manager utils pthread crypt crypto)
|
target_link_libraries(maxkeys utils pthread crypt crypto)
|
||||||
install(TARGETS maxkeys DESTINATION ${MAXSCALE_BINDIR})
|
install(TARGETS maxkeys DESTINATION ${MAXSCALE_BINDIR})
|
||||||
|
|
||||||
add_executable(maxpasswd maxpasswd.c secrets.c utils.c gwdirs.c)
|
add_executable(maxpasswd maxpasswd.c secrets.c utils.c gwdirs.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc)
|
||||||
target_link_libraries(maxpasswd log_manager utils pthread crypt crypto)
|
target_link_libraries(maxpasswd utils pthread crypt crypto)
|
||||||
install(TARGETS maxpasswd DESTINATION ${MAXSCALE_BINDIR})
|
install(TARGETS maxpasswd DESTINATION ${MAXSCALE_BINDIR})
|
||||||
|
|
||||||
if(BUILD_TESTS)
|
if(BUILD_TESTS)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <skygw_utils.h>
|
#include <skygw_utils.h>
|
||||||
#include <log_manager.h>
|
#include <log_manager.h>
|
||||||
#include <gwdirs.h>
|
#include <gwdirs.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
/** Defined in log_manager.cc */
|
/** Defined in log_manager.cc */
|
||||||
extern int lm_enabled_logfiles_bitmask;
|
extern int lm_enabled_logfiles_bitmask;
|
||||||
extern size_t log_ses_count[];
|
extern size_t log_ses_count[];
|
||||||
@ -154,6 +154,11 @@ FILE *fp;
|
|||||||
char fname[1024], *home, *cpasswd;
|
char fname[1024], *home, *cpasswd;
|
||||||
|
|
||||||
initialise();
|
initialise();
|
||||||
|
|
||||||
|
if(access(get_datadir(), F_OK) != 0)
|
||||||
|
if(mkdir(get_datadir(), S_IRWXU) != 0 && errno != EEXIST)
|
||||||
|
return ADMIN_ERR_PWDFILEOPEN;
|
||||||
|
|
||||||
snprintf(fname,1023, "%s/passwd", get_datadir());
|
snprintf(fname,1023, "%s/passwd", get_datadir());
|
||||||
fname[1023] = '\0';
|
fname[1023] = '\0';
|
||||||
if (users == NULL)
|
if (users == NULL)
|
||||||
|
@ -2334,6 +2334,7 @@ static char *InternalRouters[] = {
|
|||||||
"cli",
|
"cli",
|
||||||
"maxinfo",
|
"maxinfo",
|
||||||
"binlogrouter",
|
"binlogrouter",
|
||||||
|
"testroute",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ char *home, buf[1024];
|
|||||||
|
|
||||||
/* Unlink any existing password file before running this test */
|
/* Unlink any existing password file before running this test */
|
||||||
|
|
||||||
sprintf(buf, "%s/passwd", default_cachedir);
|
sprintf(buf, "%s/passwd", get_datadir());
|
||||||
if(!is_valid_posix_path(buf))
|
if(!is_valid_posix_path(buf))
|
||||||
exit(1);
|
exit(1);
|
||||||
if (strcmp(buf, "/etc/passwd") != 0)
|
if (strcmp(buf, "/etc/passwd") != 0)
|
||||||
|
@ -27,6 +27,13 @@
|
|||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// To ensure that ss_info_assert asserts also when builing in non-debug mode.
|
||||||
|
#if !defined(SS_DEBUG)
|
||||||
|
#define SS_DEBUG
|
||||||
|
#endif
|
||||||
|
#if defined(NDEBUG)
|
||||||
|
#undef NDEBUG
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -59,7 +59,7 @@ int buflen;
|
|||||||
printAllDCBs();
|
printAllDCBs();
|
||||||
ss_info_dassert(true, "Something is true");
|
ss_info_dassert(true, "Something is true");
|
||||||
ss_dfprintf(stderr, "\t..done\n");
|
ss_dfprintf(stderr, "\t..done\n");
|
||||||
dcb_free(dcb);
|
dcb_close(dcb);
|
||||||
ss_dfprintf(stderr, "Freed original dcb");
|
ss_dfprintf(stderr, "Freed original dcb");
|
||||||
ss_info_dassert(!dcb_isvalid(dcb), "Freed DCB must not be valid");
|
ss_info_dassert(!dcb_isvalid(dcb), "Freed DCB must not be valid");
|
||||||
ss_dfprintf(stderr, "\t..done\nMake clone DCB a zombie");
|
ss_dfprintf(stderr, "\t..done\nMake clone DCB a zombie");
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <buffer.h>
|
#include <buffer.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <modules.h>
|
#include <modules.h>
|
||||||
|
#include <maxscale_test.h>
|
||||||
|
|
||||||
static char* server_options[] = {
|
static char* server_options[] = {
|
||||||
"MariaDB Corporation MaxScale",
|
"MariaDB Corporation MaxScale",
|
||||||
@ -65,6 +66,7 @@ static char* server_groups[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int config_load(char *);
|
int config_load(char *);
|
||||||
|
void config_enable_feedback_task(void);
|
||||||
int module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *cfg);
|
int module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *cfg);
|
||||||
int do_http_post(GWBUF *buffer, void *cfg);
|
int do_http_post(GWBUF *buffer, void *cfg);
|
||||||
|
|
||||||
@ -78,7 +80,8 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
hkinit();
|
hkinit();
|
||||||
|
|
||||||
cnf = strdup("/etc/MaxScale.cnf");
|
cnf = malloc(sizeof(char) * (strlen(TEST_DIR) + strlen("/maxscale.cnf") + 1));
|
||||||
|
sprintf(cnf, "%s/maxscale.cnf", TEST_DIR);
|
||||||
|
|
||||||
printf("Config: %s\n",cnf);
|
printf("Config: %s\n",cnf);
|
||||||
|
|
||||||
@ -89,7 +92,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_load(cnf);
|
config_load(cnf);
|
||||||
|
config_enable_feedback_task();
|
||||||
if ((fc = config_get_feedback_data()) == NULL)
|
if ((fc = config_get_feedback_data()) == NULL)
|
||||||
{
|
{
|
||||||
FAILTEST("Configuration for Feedback was NULL.");
|
FAILTEST("Configuration for Feedback was NULL.");
|
||||||
|
@ -70,10 +70,11 @@ int
|
|||||||
test2()
|
test2()
|
||||||
{
|
{
|
||||||
GWBUF *buffer;
|
GWBUF *buffer;
|
||||||
char len = 128;
|
unsigned int len = 128;
|
||||||
char query[129];
|
char query[129];
|
||||||
|
|
||||||
buffer = gwbuf_alloc(132);
|
/** Allocate space for the COM_QUERY header and payload */
|
||||||
|
buffer = gwbuf_alloc(5 + 128);
|
||||||
ss_info_dassert((buffer != NULL),"Buffer should not be null");
|
ss_info_dassert((buffer != NULL),"Buffer should not be null");
|
||||||
|
|
||||||
memset(query,';',128);
|
memset(query,';',128);
|
||||||
|
@ -86,7 +86,7 @@ int result;
|
|||||||
sleep(10);
|
sleep(10);
|
||||||
poll_shutdown();
|
poll_shutdown();
|
||||||
ss_dfprintf(stderr, "\t..done\nTidy up.");
|
ss_dfprintf(stderr, "\t..done\nTidy up.");
|
||||||
dcb_free(dcb);
|
dcb_close(dcb);
|
||||||
ss_dfprintf(stderr, "\t..done\n");
|
ss_dfprintf(stderr, "\t..done\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -27,6 +27,13 @@
|
|||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// To ensure that ss_info_assert asserts also when builing in non-debug mode.
|
||||||
|
#if !defined(SS_DEBUG)
|
||||||
|
#define SS_DEBUG
|
||||||
|
#endif
|
||||||
|
#if defined(NDEBUG)
|
||||||
|
#undef NDEBUG
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -34,15 +41,6 @@
|
|||||||
#include <test_utils.h>
|
#include <test_utils.h>
|
||||||
#include <service.h>
|
#include <service.h>
|
||||||
|
|
||||||
|
|
||||||
static bool success = false;
|
|
||||||
|
|
||||||
int hup(DCB* dcb)
|
|
||||||
{
|
|
||||||
success = true;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test1 Allocate a service and do lots of other things
|
* test1 Allocate a service and do lots of other things
|
||||||
*
|
*
|
||||||
@ -57,17 +55,6 @@ int result;
|
|||||||
int argc = 3;
|
int argc = 3;
|
||||||
|
|
||||||
init_test_env(NULL);
|
init_test_env(NULL);
|
||||||
/* char* argv[] = */
|
|
||||||
/* { */
|
|
||||||
/* "log_manager", */
|
|
||||||
/* "-j", */
|
|
||||||
/* TEST_LOG_DIR, */
|
|
||||||
/* NULL */
|
|
||||||
/* }; */
|
|
||||||
|
|
||||||
/* skygw_logmanager_init(argc,argv); */
|
|
||||||
/* poll_init(); */
|
|
||||||
/* hkinit(); */
|
|
||||||
|
|
||||||
/* Service tests */
|
/* Service tests */
|
||||||
ss_dfprintf(stderr,
|
ss_dfprintf(stderr,
|
||||||
@ -91,9 +78,9 @@ init_test_env(NULL);
|
|||||||
result = serviceStart(service);
|
result = serviceStart(service);
|
||||||
skygw_log_sync_all();
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Start should succeed");
|
ss_info_dassert(0 != result, "Start should succeed");
|
||||||
result = serviceStop(service);
|
serviceStop(service);
|
||||||
skygw_log_sync_all();
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Stop should succeed");
|
ss_info_dassert(service->state == SERVICE_STATE_STOPPED, "Stop should succeed");
|
||||||
result = serviceStartAll();
|
result = serviceStartAll();
|
||||||
skygw_log_sync_all();
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Start all should succeed");
|
ss_info_dassert(0 != result, "Start all should succeed");
|
||||||
@ -104,9 +91,9 @@ init_test_env(NULL);
|
|||||||
result = serviceStart(service);
|
result = serviceStart(service);
|
||||||
skygw_log_sync_all();
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Start should succeed");
|
ss_info_dassert(0 != result, "Start should succeed");
|
||||||
result = serviceStop(service);
|
serviceStop(service);
|
||||||
skygw_log_sync_all();
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Stop should succeed");
|
ss_info_dassert(service->state == SERVICE_STATE_STOPPED, "Stop should succeed");
|
||||||
|
|
||||||
if((dcb = dcb_alloc(DCB_ROLE_REQUEST_HANDLER)) == NULL)
|
if((dcb = dcb_alloc(DCB_ROLE_REQUEST_HANDLER)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
@ -114,25 +101,16 @@ init_test_env(NULL);
|
|||||||
|
|
||||||
session = session_alloc(service,dcb);
|
session = session_alloc(service,dcb);
|
||||||
ss_info_dassert(session != NULL, "Session allocation failed");
|
ss_info_dassert(session != NULL, "Session allocation failed");
|
||||||
session->client->state = DCB_STATE_POLLING;
|
dcb->state = DCB_STATE_POLLING;
|
||||||
session->client->func.hangup = hup;
|
|
||||||
sleep(15);
|
sleep(15);
|
||||||
|
|
||||||
ss_info_dassert(success, "Session timeout failed");
|
ss_info_dassert(dcb->state != DCB_STATE_POLLING, "Session timeout failed");
|
||||||
|
|
||||||
ss_dfprintf(stderr, "\t..done\nStopping Service.");
|
ss_dfprintf(stderr, "\t..done\nStopping Service.");
|
||||||
ss_info_dassert(0 != serviceStop(service), "Stop should succeed");
|
serviceStop(service);
|
||||||
|
ss_info_dassert(service->state == SERVICE_STATE_STOPPED, "Stop should succeed");
|
||||||
ss_dfprintf(stderr, "\t..done\n");
|
ss_dfprintf(stderr, "\t..done\n");
|
||||||
|
|
||||||
/** This is never used in MaxScale and will always fail due to service's
|
|
||||||
* stats.n_current value never being decremented */
|
|
||||||
/*
|
|
||||||
|
|
||||||
ss_dfprintf(stderr, "\t..done\nFreeing Service.");
|
|
||||||
ss_info_dassert(0 != service_free(service), "Free should succeed");
|
|
||||||
ss_dfprintf(stderr, "\t..done\n");
|
|
||||||
|
|
||||||
*/
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,13 @@
|
|||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// To ensure that ss_info_assert asserts also when builing in non-debug mode.
|
||||||
|
#if !defined(SS_DEBUG)
|
||||||
|
#define SS_DEBUG
|
||||||
|
#endif
|
||||||
|
#if defined(NDEBUG)
|
||||||
|
#undef NDEBUG
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -472,73 +472,55 @@ bool check_time(char* str)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_RVRS_TIME(tr) (mktime(&tr->end) < mktime(&tr->start))
|
#define IS_RVRS_TIME(tr) (mktime(&tr->end) < mktime(&tr->start))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a null-terminated string into two tm_t structs that mark a timerange
|
* Parses a null-terminated string into a timerange defined by two ISO-8601 compliant
|
||||||
|
* times separated by a single dash. The times are interpreted at one second precision
|
||||||
|
* and follow the extended format by separating the hours, minutes and seconds with
|
||||||
|
* semicolons.
|
||||||
* @param str String to parse
|
* @param str String to parse
|
||||||
* @param instance FW_FILTER instance
|
* @param instance FW_FILTER instance
|
||||||
* @return If successful returns a pointer to the new TIMERANGE instance. If errors occurred or
|
* @return If successful returns a pointer to the new TIMERANGE instance. If errors occurred or
|
||||||
* the timerange was invalid, a NULL pointer is returned.
|
* the timerange was invalid, a NULL pointer is returned.
|
||||||
*/
|
*/
|
||||||
TIMERANGE* parse_time(char* str, FW_INSTANCE* instance)
|
static TIMERANGE* parse_time(const char* str)
|
||||||
{
|
{
|
||||||
|
assert(str != NULL);
|
||||||
|
|
||||||
|
char strbuf[strlen(str) + 1];
|
||||||
|
char *separator;
|
||||||
|
struct tm start, end;
|
||||||
TIMERANGE* tr = NULL;
|
TIMERANGE* tr = NULL;
|
||||||
int intbuffer[3];
|
|
||||||
int* idest = intbuffer;
|
|
||||||
char strbuffer[3];
|
|
||||||
char *ptr,*sdest;
|
|
||||||
struct tm* tmptr;
|
|
||||||
|
|
||||||
assert(str != NULL && instance != NULL);
|
strcpy(strbuf, str);
|
||||||
|
|
||||||
tr = (TIMERANGE*)calloc(1,sizeof(TIMERANGE));
|
if ((separator = strchr(strbuf, '-')))
|
||||||
|
{
|
||||||
|
*separator++ = '\0';
|
||||||
|
if (strptime(strbuf, "%H:%M:%S", &start) &&
|
||||||
|
strptime(separator, "%H:%M:%S", &end))
|
||||||
|
{
|
||||||
|
/** The time string was valid */
|
||||||
|
CHK_TIMES((&start));
|
||||||
|
CHK_TIMES((&end));
|
||||||
|
|
||||||
if(tr == NULL){
|
tr = (TIMERANGE*) malloc(sizeof(TIMERANGE));
|
||||||
skygw_log_write(LOGFILE_ERROR, "dbfwfilter: malloc returned NULL.");
|
|
||||||
return NULL;
|
if (tr)
|
||||||
|
{
|
||||||
|
tr->start = start;
|
||||||
|
tr->end = end;
|
||||||
|
tr->next = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skygw_log_write(LOGFILE_ERROR, "dbfwfilter: malloc returned NULL.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&tr->start,0,sizeof(struct tm));
|
|
||||||
memset(&tr->end,0,sizeof(struct tm));
|
|
||||||
ptr = str;
|
|
||||||
sdest = strbuffer;
|
|
||||||
tmptr = &tr->start;
|
|
||||||
|
|
||||||
while(ptr - str < 19){
|
|
||||||
if(isdigit(*ptr)){
|
|
||||||
*sdest = *ptr;
|
|
||||||
}else if(*ptr == ':' ||*ptr == '-' || *ptr == '\0' || *ptr == ' '){
|
|
||||||
*sdest = '\0';
|
|
||||||
*idest++ = atoi(strbuffer);
|
|
||||||
sdest = strbuffer;
|
|
||||||
|
|
||||||
if(*ptr == '-' || *ptr == '\0'){
|
|
||||||
|
|
||||||
tmptr->tm_hour = intbuffer[0];
|
|
||||||
tmptr->tm_min = intbuffer[1];
|
|
||||||
tmptr->tm_sec = intbuffer[2];
|
|
||||||
|
|
||||||
CHK_TIMES(tmptr);
|
|
||||||
|
|
||||||
if(*ptr == '\0' || *ptr == ' '){
|
|
||||||
return tr;
|
return tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
idest = intbuffer;
|
|
||||||
tmptr = &tr->end;
|
|
||||||
}
|
|
||||||
ptr++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ptr++;
|
|
||||||
sdest++;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(tr);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splits the reversed timerange into two.
|
* Splits the reversed timerange into two.
|
||||||
*@param tr A reversed timerange
|
*@param tr A reversed timerange
|
||||||
@ -1020,7 +1002,7 @@ bool parse_rule(char* rule, FW_INSTANCE* instance)
|
|||||||
goto retblock;
|
goto retblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMERANGE *tmp = parse_time(tok,instance);
|
TIMERANGE *tmp = parse_time(tok);
|
||||||
|
|
||||||
if(tmp == NULL)
|
if(tmp == NULL)
|
||||||
{
|
{
|
||||||
|
@ -242,20 +242,18 @@ typedef struct backend_ref_st {
|
|||||||
#endif
|
#endif
|
||||||
} backend_ref_t;
|
} backend_ref_t;
|
||||||
|
|
||||||
|
typedef struct rwsplit_config_st
|
||||||
typedef struct rwsplit_config_st {
|
{
|
||||||
int rw_max_slave_conn_percent;
|
int rw_max_slave_conn_percent;
|
||||||
int rw_max_slave_conn_count;
|
int rw_max_slave_conn_count;
|
||||||
select_criteria_t rw_slave_select_criteria;
|
select_criteria_t rw_slave_select_criteria;
|
||||||
int rw_max_slave_replication_lag;
|
int rw_max_slave_replication_lag;
|
||||||
target_t rw_use_sql_variables_in;
|
target_t rw_use_sql_variables_in;
|
||||||
int rw_max_sescmd_history_size;
|
int rw_max_sescmd_history_size;
|
||||||
bool disable_sescmd_hist;
|
bool rw_disable_sescmd_hist;
|
||||||
bool disable_slave_recovery;
|
bool rw_master_reads; /*< Use master for reads */
|
||||||
bool master_reads; /*< Use master for reads */
|
|
||||||
} rwsplit_config_t;
|
} rwsplit_config_t;
|
||||||
|
|
||||||
|
|
||||||
#if defined(PREP_STMT_CACHING)
|
#if defined(PREP_STMT_CACHING)
|
||||||
|
|
||||||
typedef struct prep_stmt_st {
|
typedef struct prep_stmt_st {
|
||||||
|
@ -3,9 +3,22 @@ set_target_properties(binlogrouter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPAT
|
|||||||
target_link_libraries(binlogrouter ssl pthread log_manager)
|
target_link_libraries(binlogrouter ssl pthread log_manager)
|
||||||
install(TARGETS binlogrouter DESTINATION ${MAXSCALE_LIBDIR})
|
install(TARGETS binlogrouter DESTINATION ${MAXSCALE_LIBDIR})
|
||||||
|
|
||||||
add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c ${CMAKE_SOURCE_DIR}/server/core/service.c ${CMAKE_SOURCE_DIR}/server/core/spinlock.c ${CMAKE_SOURCE_DIR}/server/core/buffer.c ${CMAKE_SOURCE_DIR}/server/core/atomic.c ${CMAKE_SOURCE_DIR}/server/core/hint.c ${CMAKE_SOURCE_DIR}/server/core/gwdirs.c ${CMAKE_SOURCE_DIR}/server/core/server.c ${CMAKE_SOURCE_DIR}/server/core/dcb.c ${CMAKE_SOURCE_DIR}/server/core/users.c ${CMAKE_SOURCE_DIR}/server/core/dbusers.c ${CMAKE_SOURCE_DIR}/server/core/utils.c ${CMAKE_SOURCE_DIR}/server/core/hashtable.c ${CMAKE_SOURCE_DIR}/server/core/poll.c ${CMAKE_SOURCE_DIR}/server/core/gwbitmask.c ${CMAKE_SOURCE_DIR}/server/core/config.c ${CMAKE_SOURCE_DIR}/server/core/session.c ${CMAKE_SOURCE_DIR}/server/core/housekeeper.c ${CMAKE_SOURCE_DIR}/server/core/filter.c ${CMAKE_SOURCE_DIR}/server/core/resultset.c ${CMAKE_SOURCE_DIR}/server/core/load_utils.c ${CMAKE_SOURCE_DIR}/server/core/monitor.c ${CMAKE_SOURCE_DIR}/server/core/gw_utils.c ${CMAKE_SOURCE_DIR}/server/core/thread.c ${CMAKE_SOURCE_DIR}/server/core/secrets.c)
|
add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/service.c ${CMAKE_SOURCE_DIR}/server/core/spinlock.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/buffer.c ${CMAKE_SOURCE_DIR}/server/core/atomic.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/hint.c ${CMAKE_SOURCE_DIR}/server/core/gwdirs.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/server.c ${CMAKE_SOURCE_DIR}/server/core/dcb.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/users.c ${CMAKE_SOURCE_DIR}/server/core/dbusers.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/utils.c ${CMAKE_SOURCE_DIR}/server/core/hashtable.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/poll.c ${CMAKE_SOURCE_DIR}/server/core/gwbitmask.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/config.c ${CMAKE_SOURCE_DIR}/server/core/session.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/housekeeper.c ${CMAKE_SOURCE_DIR}/server/core/filter.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/resultset.c ${CMAKE_SOURCE_DIR}/server/core/load_utils.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/monitor.c ${CMAKE_SOURCE_DIR}/server/core/gw_utils.c
|
||||||
|
${CMAKE_SOURCE_DIR}/server/core/thread.c ${CMAKE_SOURCE_DIR}/server/core/secrets.c
|
||||||
|
${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc)
|
||||||
|
|
||||||
target_link_libraries(maxbinlogcheck utils ssl pthread log_manager ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} aio rt crypt dl crypto inih z m stdc++ ${CURL_LIBRARIES})
|
target_link_libraries(maxbinlogcheck utils ssl pthread ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} aio rt crypt dl crypto inih z m stdc++ ${CURL_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS maxbinlogcheck DESTINATION bin)
|
install(TARGETS maxbinlogcheck DESTINATION bin)
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ createInstance(SERVICE *service, char **options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** These options cancel each other out */
|
/** These options cancel each other out */
|
||||||
if(router->rwsplit_config.disable_sescmd_hist && router->rwsplit_config.rw_max_sescmd_history_size > 0)
|
if(router->rwsplit_config.rw_disable_sescmd_hist && router->rwsplit_config.rw_max_sescmd_history_size > 0)
|
||||||
{
|
{
|
||||||
router->rwsplit_config.rw_max_sescmd_history_size = 0;
|
router->rwsplit_config.rw_max_sescmd_history_size = 0;
|
||||||
}
|
}
|
||||||
@ -1246,7 +1246,7 @@ static bool get_dcb(
|
|||||||
(max_rlag == MAX_RLAG_UNDEFINED ||
|
(max_rlag == MAX_RLAG_UNDEFINED ||
|
||||||
(b->backend_server->rlag != MAX_RLAG_NOT_AVAILABLE &&
|
(b->backend_server->rlag != MAX_RLAG_NOT_AVAILABLE &&
|
||||||
b->backend_server->rlag <= max_rlag)) &&
|
b->backend_server->rlag <= max_rlag)) &&
|
||||||
!rses->rses_config.master_reads)
|
!rses->rses_config.rw_master_reads)
|
||||||
{
|
{
|
||||||
/** found slave */
|
/** found slave */
|
||||||
candidate_bref = &backend_ref[i];
|
candidate_bref = &backend_ref[i];
|
||||||
@ -2022,6 +2022,9 @@ static int routeQuery(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/** route_single_stmt expects the buffer to be contiguous. */
|
||||||
|
querybuf = gwbuf_make_contiguous(querybuf);
|
||||||
|
|
||||||
succp = route_single_stmt(inst, router_cli_ses, querybuf);
|
succp = route_single_stmt(inst, router_cli_ses, querybuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2053,6 +2056,9 @@ static int routeQuery(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/** route_single_stmt expects the buffer to be contiguous. */
|
||||||
|
querybuf = gwbuf_make_contiguous(querybuf);
|
||||||
|
|
||||||
succp = route_single_stmt(inst, router_cli_ses, querybuf);
|
succp = route_single_stmt(inst, router_cli_ses, querybuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2108,6 +2114,7 @@ static bool route_single_stmt(
|
|||||||
int rlag_max = MAX_RLAG_UNDEFINED;
|
int rlag_max = MAX_RLAG_UNDEFINED;
|
||||||
backend_type_t btype; /*< target backend type */
|
backend_type_t btype; /*< target backend type */
|
||||||
|
|
||||||
|
ss_dassert(querybuf->next == NULL); // The buffer must be contiguous.
|
||||||
ss_dassert(!GWBUF_IS_TYPE_UNDEFINED(querybuf));
|
ss_dassert(!GWBUF_IS_TYPE_UNDEFINED(querybuf));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2131,12 +2138,6 @@ static bool route_single_stmt(
|
|||||||
goto retblock;
|
goto retblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** If buffer is not contiguous, make it such */
|
|
||||||
if (querybuf->next != NULL)
|
|
||||||
{
|
|
||||||
querybuf = gwbuf_make_contiguous(querybuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
packet = GWBUF_DATA(querybuf);
|
packet = GWBUF_DATA(querybuf);
|
||||||
packet_len = gw_mysql_get_byte3(packet);
|
packet_len = gw_mysql_get_byte3(packet);
|
||||||
|
|
||||||
@ -2896,7 +2897,7 @@ static void clientReply (
|
|||||||
bool rconn = false;
|
bool rconn = false;
|
||||||
writebuf = sescmd_cursor_process_replies(writebuf, bref, &rconn);
|
writebuf = sescmd_cursor_process_replies(writebuf, bref, &rconn);
|
||||||
|
|
||||||
if(rconn && !router_inst->rwsplit_config.disable_slave_recovery)
|
if(rconn && !router_inst->rwsplit_config.rw_disable_sescmd_hist)
|
||||||
{
|
{
|
||||||
select_connect_backend_servers(&router_cli_ses->rses_master_ref,
|
select_connect_backend_servers(&router_cli_ses->rses_master_ref,
|
||||||
router_cli_ses->rses_backend_ref,
|
router_cli_ses->rses_backend_ref,
|
||||||
@ -4543,18 +4544,14 @@ static bool route_session_write(
|
|||||||
if (router_cli_ses->rses_config.rw_max_sescmd_history_size > 0 &&
|
if (router_cli_ses->rses_config.rw_max_sescmd_history_size > 0 &&
|
||||||
router_cli_ses->rses_nsescmd >= router_cli_ses->rses_config.rw_max_sescmd_history_size)
|
router_cli_ses->rses_nsescmd >= router_cli_ses->rses_config.rw_max_sescmd_history_size)
|
||||||
{
|
{
|
||||||
LOGIF(LT, (skygw_log_write(
|
skygw_log_write(LE, "Warning: Router session exceeded session command history limit. "
|
||||||
LOGFILE_TRACE,
|
"Slave recovery is disabled and only slave servers with consistent session state are used "
|
||||||
"Router session exceeded session command history limit. "
|
"for the duration of the session.");
|
||||||
"Closing router session. <")));
|
router_cli_ses->rses_config.rw_disable_sescmd_hist = true;
|
||||||
gwbuf_free(querybuf);
|
router_cli_ses->rses_config.rw_max_sescmd_history_size = 0;
|
||||||
rses_end_locked_router_action(router_cli_ses);
|
|
||||||
router_cli_ses->client_dcb->func.hangup(router_cli_ses->client_dcb);
|
|
||||||
|
|
||||||
goto return_succp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(router_cli_ses->rses_config.disable_sescmd_hist)
|
if(router_cli_ses->rses_config.rw_disable_sescmd_hist)
|
||||||
{
|
{
|
||||||
rses_property_t *prop, *tmp;
|
rses_property_t *prop, *tmp;
|
||||||
backend_ref_t* bref;
|
backend_ref_t* bref;
|
||||||
@ -4783,15 +4780,11 @@ static void rwsplit_process_router_options(
|
|||||||
}
|
}
|
||||||
else if(strcmp(options[i],"disable_sescmd_history") == 0)
|
else if(strcmp(options[i],"disable_sescmd_history") == 0)
|
||||||
{
|
{
|
||||||
router->rwsplit_config.disable_sescmd_hist = config_truth_value(value);
|
router->rwsplit_config.rw_disable_sescmd_hist = config_truth_value(value);
|
||||||
}
|
|
||||||
else if(strcmp(options[i],"disable_slave_recovery") == 0)
|
|
||||||
{
|
|
||||||
router->rwsplit_config.disable_slave_recovery = config_truth_value(value);
|
|
||||||
}
|
}
|
||||||
else if(strcmp(options[i],"master_accept_reads") == 0)
|
else if(strcmp(options[i],"master_accept_reads") == 0)
|
||||||
{
|
{
|
||||||
router->rwsplit_config.master_reads = config_truth_value(value);
|
router->rwsplit_config.rw_master_reads = config_truth_value(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /*< for */
|
} /*< for */
|
||||||
@ -5038,7 +5031,7 @@ static bool handle_error_new_connection(
|
|||||||
* Try to get replacement slave or at least the minimum
|
* Try to get replacement slave or at least the minimum
|
||||||
* number of slave connections for router session.
|
* number of slave connections for router session.
|
||||||
*/
|
*/
|
||||||
if(inst->rwsplit_config.disable_slave_recovery)
|
if(inst->rwsplit_config.rw_disable_sescmd_hist)
|
||||||
{
|
{
|
||||||
succp = have_enough_servers(&myrses,1,router_nservers,inst) ? true : false;
|
succp = have_enough_servers(&myrses,1,router_nservers,inst) ? true : false;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ else
|
|||||||
TDIR=.
|
TDIR=.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUNCMD=mysql\ --host=$THOST\ -P$TPORT\ -u$TUSER\ -p$TPWD\ --unbuffered=true\ --disable-reconnect\ --silent\ --comment
|
RUNCMD="mysql --host=$THOST -P$TPORT -u$TUSER -p$TPWD --unbuffered=true --disable-reconnect --silent -c"
|
||||||
i=0
|
i=0
|
||||||
|
|
||||||
while read -r LINE
|
while read -r LINE
|
||||||
|
Reference in New Issue
Block a user