Fixed to Coverity defects and a fix to tee filter not compiling with SS_DEBUG flag.
This commit is contained in:
@ -34,9 +34,9 @@ add_library(namedserverfilter SHARED namedserverfilter.c)
|
||||
target_link_libraries(namedserverfilter log_manager utils)
|
||||
install(TARGETS namedserverfilter DESTINATION modules)
|
||||
|
||||
add_library(lagfilter SHARED lagfilter.c)
|
||||
target_link_libraries(lagfilter log_manager utils query_classifier)
|
||||
install(TARGETS lagfilter DESTINATION modules)
|
||||
add_library(slavelag SHARED slavelag.c)
|
||||
target_link_libraries(slavelag log_manager utils query_classifier)
|
||||
install(TARGETS slavelag DESTINATION modules)
|
||||
|
||||
|
||||
add_subdirectory(hint)
|
||||
|
||||
@ -1558,6 +1558,7 @@ bool check_match_any(FW_INSTANCE* my_instance, FW_SESSION* my_session, GWBUF *qu
|
||||
}
|
||||
|
||||
qlen = gw_mysql_get_byte3(memptr);
|
||||
qlen = qlen < 0xffffff ? qlen : 0xffffff;
|
||||
fullquery = malloc((qlen) * sizeof(char));
|
||||
memcpy(fullquery,memptr + 5,qlen - 1);
|
||||
memset(fullquery + qlen - 1,0,1);
|
||||
@ -1612,6 +1613,7 @@ bool check_match_all(FW_INSTANCE* my_instance, FW_SESSION* my_session, GWBUF *qu
|
||||
}
|
||||
|
||||
qlen = gw_mysql_get_byte3(memptr);
|
||||
qlen = qlen < 0xffffff ? qlen : 0xffffff;
|
||||
fullquery = malloc((qlen) * sizeof(char));
|
||||
memcpy(fullquery,memptr + 5,qlen - 1);
|
||||
memset(fullquery + qlen - 1,0,1);
|
||||
|
||||
@ -32,7 +32,7 @@ extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
|
||||
/**
|
||||
* @file lagfilter.c - a very simple filter designed to send queries to the
|
||||
* @file slavelag.c - a very simple filter designed to send queries to the
|
||||
* master server after data modification has occurred. This is done to prevent
|
||||
* replication lag affecting the outcome of a select query.
|
||||
*
|
||||
@ -42,8 +42,11 @@ extern __thread log_info_t tls_log_info;
|
||||
* is executed:
|
||||
*
|
||||
* count=<number of queries> Queries to route to master after data modification.
|
||||
* time=<time period> Seconds to wait before queries are routed to slaves.
|
||||
* time=<time period> Seconds to wait before queries are routed to slaves.
|
||||
* match=<regex> Regex for matching
|
||||
* ignore=<regex> Regex for ignoring
|
||||
*
|
||||
* The filter also has two options: @c case, which makes the regex case-sensitive, and @c ignorecase, which does the opposite.
|
||||
* Date Who Description
|
||||
* 03/03/2015 Markus Mäkelä Written for demonstrative purposes
|
||||
* @endverbatim
|
||||
@ -333,20 +336,20 @@ time_t now = time(NULL);
|
||||
|
||||
if(query_classifier_get_operation(queue) & (QUERY_OP_DELETE|QUERY_OP_INSERT|QUERY_OP_UPDATE))
|
||||
{
|
||||
sql = modutil_get_SQL(queue);
|
||||
|
||||
if(my_instance->nomatch == NULL||(my_instance->nomatch && regexec(&my_instance->nore,sql,0,NULL,0) != 0))
|
||||
if((sql = modutil_get_SQL(queue)) != NULL)
|
||||
{
|
||||
if(my_instance->match == NULL||
|
||||
(my_instance->match && regexec(&my_instance->re,sql,0,NULL,0) == 0))
|
||||
if(my_instance->nomatch == NULL||(my_instance->nomatch && regexec(&my_instance->nore,sql,0,NULL,0) != 0))
|
||||
{
|
||||
my_session->hints_left = my_instance->count;
|
||||
my_session->last_modification = now;
|
||||
my_instance->stats.n_modified++;
|
||||
if(my_instance->match == NULL||
|
||||
(my_instance->match && regexec(&my_instance->re,sql,0,NULL,0) == 0))
|
||||
{
|
||||
my_session->hints_left = my_instance->count;
|
||||
my_session->last_modification = now;
|
||||
my_instance->stats.n_modified++;
|
||||
}
|
||||
}
|
||||
free(sql);
|
||||
}
|
||||
|
||||
free(sql);
|
||||
}
|
||||
else if(my_session->hints_left > 0)
|
||||
{
|
||||
@ -1170,13 +1170,7 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
|
||||
if(my_session->waiting[PARENT])
|
||||
{
|
||||
route = true;
|
||||
#ifdef SS_DEBUG
|
||||
ss_dassert(my_session->replies[PARENT] < 2 ||
|
||||
modutil_count_signal_packets(my_session->tee_replybuf,
|
||||
my_session->use_ok,
|
||||
my_session->eof[PARENT]) == 0);
|
||||
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c:[%d] Routing partial response set.",my_session->d_id);
|
||||
#endif
|
||||
|
||||
}
|
||||
else if(my_session->eof[PARENT] >= min_eof &&
|
||||
my_session->eof[CHILD] >= min_eof)
|
||||
|
||||
Reference in New Issue
Block a user