Develop Merge

Develop Merge
This commit is contained in:
MassimilianoPinto 2017-06-30 10:48:13 +02:00
commit 7913f0ddf1
14 changed files with 61 additions and 20 deletions

View File

@ -165,6 +165,10 @@ matched. The symbolic comparison operators (`<`, `>`, `>=` etc.) are also
considered functions whereas the text versions (`NOT`, `IS`, `IS NOT` etc.) are
not considered functions.
When the filter is in whitelist mode (`action=allow`) the function rule
will match any query that does not use a function. This means that queries
that do not use functions will be allowed through a function type rule.
##### Example
Deny SUM and COUNT functions:

View File

@ -54,6 +54,12 @@ The `match` and `exclude` parameters were changed to use PCRE2 syntax for the
regular expressions. The regular expression should be enclosed by slashes
e.g. `match=/select.*from.*test/`.
### Dbfwfilter
The `function` type rule will now match a query that does not use a function
when the filter is in whitelist mode (`action=allow`). This means that queries
that don't use functions are allowed though in whitelist mode.
## Dropped Features
### MaxAdmin

View File

@ -174,7 +174,11 @@ data block. The default value is 1000 row events.
#### `block_size`
The Avro data block size in bytes. The default is 16 kilobytes. Increase this
value if individual events in the binary logs are very large.
value if individual events in the binary logs are very large. The value is a
size type parameter which means that it can also be defined with an SI
suffix. Refer to the
[Configuration Guide](../Getting-Started/Configuration-Guide.md) for more
details about size type parameters and how to use them.
## Module commands

View File

@ -246,12 +246,17 @@ bool maxavro_read_float(MAXAVRO_FILE* file, float *dest)
{
bool rval = false;
if (file->buffer_ptr + sizeof(*dest) < file->buffer_end)
if (file->buffer_ptr + sizeof(*dest) <= file->buffer_end)
{
memcpy(dest, file->buffer_ptr, sizeof(*dest));
file->buffer_ptr += sizeof(*dest);
rval = true;
}
else
{
ss_dassert(!true);
MXS_ERROR("Block cannot hold a value of type float");
}
return rval;
}
@ -280,12 +285,17 @@ bool maxavro_read_double(MAXAVRO_FILE* file, double *dest)
{
bool rval = false;
if (file->buffer_ptr + sizeof(*dest) < file->buffer_end)
if (file->buffer_ptr + sizeof(*dest) <= file->buffer_end)
{
memcpy(dest, file->buffer_ptr, sizeof(*dest));
file->buffer_ptr += sizeof(*dest);
rval = true;
}
else
{
ss_dassert(!true);
MXS_ERROR("Block cannot hold a value of type double");
}
return rval;
}

View File

@ -1,3 +1,4 @@
#!/bin/bash
./non_native_setup insertstream
./mysqltest_driver.sh insertstream insertstream 4006

View File

@ -36,6 +36,10 @@ fi
echo $source copied to $target
test_dir=`pwd`
$test_dir/non_native_setup $1
password=
if [ $# -ge 3 ]
then

View File

@ -36,8 +36,6 @@ fi
test_dir=`pwd`
port=$3
$test_dir/non_native_setup $1
cd $2 || exit 1
res=0

View File

@ -58,7 +58,7 @@ int atomic_load_int32(const int *variable)
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_load_n(variable, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_or(variable, 0);
return __sync_fetch_and_or((volatile int *)variable, 0);
#endif
}
@ -67,7 +67,7 @@ int64_t atomic_load_int64(const int64_t *variable)
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_load_n(variable, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_or(variable, 0);
return __sync_fetch_and_or((volatile int *)variable, 0);
#endif
}
@ -76,7 +76,7 @@ uint64_t atomic_load_uint64(const uint64_t *variable)
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_load_n(variable, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_or(variable, 0);
return __sync_fetch_and_or((volatile int *)variable, 0);
#endif
}
@ -85,7 +85,7 @@ void* atomic_load_ptr(void * const *variable)
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_load_n(variable, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_or(variable, 0);
return __sync_fetch_and_or((void **)variable, 0);
#endif
}

View File

@ -56,6 +56,11 @@
#include "maxscale/queuemanager.h"
#include "maxscale/service.h"
/** This define is needed in CentOS 6 systems */
#if !defined(UINT64_MAX)
#define UINT64_MAX (18446744073709551615UL)
#endif
using std::string;
using std::set;

View File

@ -2082,12 +2082,18 @@ void match_column(RULE_BOOK *rulebook, GWBUF *queue, bool *matches, char **msg)
}
}
void match_function(RULE_BOOK *rulebook, GWBUF *queue, bool *matches, char **msg)
void match_function(RULE_BOOK *rulebook, GWBUF *queue, enum fw_actions mode,
bool *matches, char **msg)
{
const QC_FUNCTION_INFO* infos;
size_t n_infos;
qc_get_function_info(queue, &infos, &n_infos);
if (n_infos == 0 && mode == FW_ACTION_ALLOW)
{
*matches = true;
}
for (size_t i = 0; i < n_infos; ++i)
{
const char* tok = infos[i].name;
@ -2219,7 +2225,7 @@ bool rule_matches(FW_INSTANCE* my_instance,
case RT_FUNCTION:
if (is_sql)
{
match_function(rulebook, queue, &matches, &msg);
match_function(rulebook, queue, my_instance->action, &matches, &msg);
}
break;

View File

@ -700,14 +700,13 @@ gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
MXS_SESSION *session =
session_alloc_with_id(dcb->service, dcb, protocol->thread_id);
// For the time being only the sql_mode is stored in MXS_SESSION::client_protocol_data.
session->client_protocol_data = QC_SQL_MODE_DEFAULT;
if (session != NULL)
{
CHK_SESSION(session);
ss_dassert(session->state != SESSION_STATE_ALLOC &&
session->state != SESSION_STATE_DUMMY);
// For the time being only the sql_mode is stored in MXS_SESSION::client_protocol_data.
session->client_protocol_data = QC_SQL_MODE_DEFAULT;
protocol->protocol_auth_state = MXS_AUTH_STATE_COMPLETE;
ss_debug(bool check = ) mxs_worker_register_session(session);
ss_dassert(check);

View File

@ -201,7 +201,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
{"group_rows", MXS_MODULE_PARAM_COUNT, "1000"},
{"group_trx", MXS_MODULE_PARAM_COUNT, "1"},
{"start_index", MXS_MODULE_PARAM_COUNT, "1"},
{"block_size", MXS_MODULE_PARAM_COUNT, "0"},
{"block_size", MXS_MODULE_PARAM_SIZE, "0"},
{"codec", MXS_MODULE_PARAM_ENUM, "null", MXS_MODULE_OPT_ENUM_UNIQUE, codec_values},
{MXS_END_MODULE_PARAMS}
}
@ -425,7 +425,7 @@ createInstance(SERVICE *service, char **options)
inst->trx_target = config_get_integer(params, "group_trx");
inst->codec = config_get_enum(params, "codec", codec_values);
int first_file = config_get_integer(params, "start_index");
inst->block_size = config_get_integer(params, "block_size");
inst->block_size = config_get_size(params, "block_size");
MXS_CONFIG_PARAMETER *param = config_get_param(params, "source");
inst->gtid.domain = 0;

View File

@ -490,17 +490,20 @@ blr_file_add_magic(int fd)
* @return Non-zero if the fie creation succeeded
*/
static int
blr_file_create(ROUTER_INSTANCE *router, char *file)
blr_file_create(ROUTER_INSTANCE *router, char *orig_file)
{
if (strlen(file) > BINLOG_FNAMELEN)
if (strlen(orig_file) > BINLOG_FNAMELEN)
{
MXS_ERROR("The binlog filename %s is longer than "
"the maximum allowed length %d.",
file,
orig_file,
BINLOG_FNAMELEN);
return 0;
}
char file[strlen(orig_file) + 1];
strcpy(file, orig_file);
int created = 0;
char err_msg[MXS_STRERROR_BUFLEN];

View File

@ -948,7 +948,8 @@ struct subcommand pingoptions[] =
"Ping Workers",
"Ping Workers",
{ARG_TYPE_NONE}
}
},
{EMPTY_OPTION}
};
/**