Merge branch '2.1' into develop
This commit is contained in:
commit
46a04773a4
@ -16,7 +16,7 @@ endif()
|
||||
|
||||
# Set default values for cache entries and set the MaxScale version
|
||||
include(cmake/defaults.cmake)
|
||||
include(VERSION.cmake)
|
||||
include(VERSION22.cmake)
|
||||
include(ExternalProject)
|
||||
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
|
14
VERSION21.cmake
Normal file
14
VERSION21.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
# MaxScale version for CMake
|
||||
#
|
||||
# This file contains cache values for CMake which control MaxScale's version
|
||||
# number.
|
||||
|
||||
set(MAXSCALE_VERSION_MAJOR "2" CACHE STRING "Major version")
|
||||
set(MAXSCALE_VERSION_MINOR "1" CACHE STRING "Minor version")
|
||||
set(MAXSCALE_VERSION_PATCH "3" CACHE STRING "Patch version")
|
||||
|
||||
# This should only be incremented if a package is rebuilt
|
||||
set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number")
|
||||
|
||||
set(MAXSCALE_VERSION_NUMERIC "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}.${MAXSCALE_VERSION_PATCH}")
|
||||
set(MAXSCALE_VERSION "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}.${MAXSCALE_VERSION_PATCH}")
|
14
VERSION22.cmake
Normal file
14
VERSION22.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
# MaxScale version for CMake
|
||||
#
|
||||
# This file contains cache values for CMake which control MaxScale's version
|
||||
# number.
|
||||
|
||||
set(MAXSCALE_VERSION_MAJOR "2" CACHE STRING "Major version")
|
||||
set(MAXSCALE_VERSION_MINOR "1" CACHE STRING "Minor version")
|
||||
set(MAXSCALE_VERSION_PATCH "3" CACHE STRING "Patch version")
|
||||
|
||||
# This should only be incremented if a package is rebuilt
|
||||
set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number")
|
||||
|
||||
set(MAXSCALE_VERSION_NUMERIC "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}.${MAXSCALE_VERSION_PATCH}")
|
||||
set(MAXSCALE_VERSION "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}.${MAXSCALE_VERSION_PATCH}")
|
@ -296,6 +296,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
CCR_INSTANCE *my_instance = (CCR_INSTANCE *)instance;
|
||||
CCR_SESSION *my_session = (CCR_SESSION *)session;
|
||||
char *sql;
|
||||
regmatch_t limits[] = {{0, 0}};
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (modutil_is_SQL(queue))
|
||||
@ -306,7 +307,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
*/
|
||||
if (qc_query_is_type(qc_get_type_mask(queue), QUERY_TYPE_WRITE))
|
||||
{
|
||||
if ((sql = modutil_get_SQL(queue)) != NULL)
|
||||
if (modutil_extract_SQL(queue, &sql, &limits[0].rm_eo))
|
||||
{
|
||||
bool trigger_ccr = true;
|
||||
bool decided = false; // Set by hints to take precedence.
|
||||
@ -323,13 +324,13 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
if (!decided)
|
||||
{
|
||||
if (my_instance->nomatch &&
|
||||
regexec(&my_instance->nore, sql, 0, NULL, 0) == 0)
|
||||
regexec(&my_instance->nore, sql, 0, limits, 0) == 0)
|
||||
{
|
||||
// Nomatch was present and sql matched it.
|
||||
trigger_ccr = false;
|
||||
}
|
||||
else if (my_instance->match &&
|
||||
(regexec(&my_instance->re, sql, 0, NULL, 0) != 0))
|
||||
(regexec(&my_instance->re, sql, 0, limits, 0) != 0))
|
||||
{
|
||||
// Match was present but sql did *not* match it.
|
||||
trigger_ccr = false;
|
||||
@ -351,7 +352,6 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
|
||||
my_instance->stats.n_modified++;
|
||||
}
|
||||
MXS_FREE(sql);
|
||||
}
|
||||
}
|
||||
else if (my_session->hints_left > 0)
|
||||
|
@ -96,7 +96,11 @@ static const char* token_get_keyword(
|
||||
{
|
||||
switch (token->token)
|
||||
{
|
||||
case TOK_EOL:
|
||||
case TOK_END:
|
||||
return "End of hint";
|
||||
break;
|
||||
|
||||
case TOK_LINEBRK:
|
||||
return "End of line";
|
||||
break;
|
||||
|
||||
@ -107,14 +111,14 @@ static const char* token_get_keyword(
|
||||
default:
|
||||
{
|
||||
int i = 0;
|
||||
while (i < TOK_EOL && keywords[i].token != token->token)
|
||||
while (i < TOK_LINEBRK && keywords[i].token != token->token)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
ss_dassert(i != TOK_EOL);
|
||||
ss_dassert(i != TOK_LINEBRK);
|
||||
|
||||
if (i == TOK_EOL)
|
||||
if (i == TOK_LINEBRK)
|
||||
{
|
||||
return "Unknown token";
|
||||
}
|
||||
@ -147,7 +151,7 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
|
||||
GWBUF *buf;
|
||||
HINT_TOKEN *tok;
|
||||
HINT_MODE mode = HM_EXECUTE;
|
||||
|
||||
bool multiline_comment = false;
|
||||
/* First look for any comment in the SQL */
|
||||
modutil_MySQL_Query(request, &ptr, &len, &residual);
|
||||
buf = request;
|
||||
@ -180,7 +184,9 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
|
||||
squoted = 0;
|
||||
}
|
||||
else if (quoted || squoted)
|
||||
{
|
||||
;
|
||||
}
|
||||
else if (escape)
|
||||
{
|
||||
escape = 0;
|
||||
@ -197,6 +203,7 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
|
||||
else if (*ptr == '*' && lastch == '/')
|
||||
{
|
||||
found = 1;
|
||||
multiline_comment = true;
|
||||
break;
|
||||
}
|
||||
else if (*ptr == '-' && lastch == '-')
|
||||
@ -271,9 +278,24 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
|
||||
|
||||
state = HS_INIT;
|
||||
|
||||
while ((tok = hint_next_token(&buf, &ptr)) != NULL
|
||||
&& tok->token != TOK_EOL)
|
||||
while (((tok = hint_next_token(&buf, &ptr)) != NULL) &&
|
||||
(tok->token != TOK_END))
|
||||
{
|
||||
if (tok->token == TOK_LINEBRK)
|
||||
{
|
||||
if (multiline_comment)
|
||||
{
|
||||
// Skip token
|
||||
token_free(tok);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Treat as TOK_END
|
||||
tok->token = TOK_END;
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (state)
|
||||
{
|
||||
case HS_INIT:
|
||||
@ -365,6 +387,7 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
|
||||
{
|
||||
case TOK_EQUAL:
|
||||
pname = lvalue;
|
||||
lvalue = NULL;
|
||||
state = HS_PVALUE;
|
||||
break;
|
||||
case TOK_PREPARE:
|
||||
@ -390,6 +413,8 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
|
||||
case HS_PVALUE:
|
||||
/* Action: pname = tok->value */
|
||||
rval = hint_create_parameter(rval, pname, tok->value);
|
||||
MXS_FREE(pname);
|
||||
pname = NULL;
|
||||
state = HS_INIT;
|
||||
break;
|
||||
case HS_PREPARE:
|
||||
@ -418,7 +443,7 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
|
||||
token_free(tok);
|
||||
} /*< while */
|
||||
|
||||
if (tok && tok->token == TOK_EOL)
|
||||
if (tok && tok->token == TOK_END)
|
||||
{
|
||||
token_free(tok);
|
||||
}
|
||||
@ -536,8 +561,8 @@ hint_next_token(GWBUF **buf, char **ptr)
|
||||
inword = 0;
|
||||
break;
|
||||
}
|
||||
/** found '=', move ptr and return with '=' */
|
||||
else if (!inword && inquote == '\0' && **ptr == '=')
|
||||
/** found '=' or '\n', move ptr and return with the char */
|
||||
else if (!inword && inquote == '\0' && ((**ptr == '=') || (**ptr == '\n')))
|
||||
{
|
||||
*dest = **ptr;
|
||||
dest++;
|
||||
@ -590,7 +615,12 @@ hint_next_token(GWBUF **buf, char **ptr)
|
||||
*/
|
||||
if (word[0] == '\0' || (word[0] == '*' && word[1] == '/'))
|
||||
{
|
||||
tok->token = TOK_EOL;
|
||||
tok->token = TOK_END;
|
||||
return tok;
|
||||
}
|
||||
if (word[0] == '\n')
|
||||
{
|
||||
tok->token = TOK_LINEBRK;
|
||||
return tok;
|
||||
}
|
||||
found = 0;
|
||||
|
@ -40,7 +40,8 @@ typedef enum
|
||||
TOK_MASTER,
|
||||
TOK_SLAVE,
|
||||
TOK_SERVER,
|
||||
TOK_EOL
|
||||
TOK_LINEBRK,
|
||||
TOK_END
|
||||
} TOKEN_VALUE;
|
||||
|
||||
/* The tokenising return type */
|
||||
|
@ -640,7 +640,7 @@ static MXS_MONITOR_SERVERS *build_mysql51_replication_tree(MXS_MONITOR *mon)
|
||||
(database->server->master_id <= 0 ||
|
||||
database->server->master_id != handle->master->server->node_id))
|
||||
{
|
||||
monitor_clear_pending_status(database, SERVER_SLAVE);
|
||||
monitor_set_pending_status(database, SERVER_SLAVE);
|
||||
monitor_set_pending_status(database, SERVER_SLAVE_OF_EXTERNAL_MASTER);
|
||||
}
|
||||
database = database->next;
|
||||
@ -1853,7 +1853,7 @@ static MXS_MONITOR_SERVERS *get_replication_tree(MXS_MONITOR *mon, int num_serve
|
||||
/* this server is slave of another server not in MaxScale configuration
|
||||
* we cannot use it as a real slave.
|
||||
*/
|
||||
monitor_clear_pending_status(ptr, SERVER_SLAVE);
|
||||
monitor_set_pending_status(ptr, SERVER_SLAVE);
|
||||
monitor_set_pending_status(ptr, SERVER_SLAVE_OF_EXTERNAL_MASTER);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ while True:
|
||||
if len(buf) == 0:
|
||||
break
|
||||
|
||||
data = buf.encode().strip()
|
||||
data = buf[:-1]
|
||||
producer.send(topic=opts.kafka_topic, value=data)
|
||||
producer.flush()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user