Merge branch 'develop' into binlog_server_mariadb_master_encryption
This commit is contained in:
@ -39,7 +39,6 @@
|
||||
#include <maxscale/housekeeper.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
@ -412,7 +411,7 @@ createInstance(SERVICE *service, char **options)
|
||||
}
|
||||
else if (strcmp(options[i], "start_index") == 0)
|
||||
{
|
||||
first_file = MAX(1, atoi(value));
|
||||
first_file = MXS_MAX(1, atoi(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1038,7 +1037,7 @@ void converter_func(void* data)
|
||||
|
||||
if (binlog_end == AVRO_LAST_FILE)
|
||||
{
|
||||
router->task_delay = MIN(router->task_delay + 1, AVRO_TASK_DELAY_MAX);
|
||||
router->task_delay = MXS_MIN(router->task_delay + 1, AVRO_TASK_DELAY_MAX);
|
||||
add_conversion_task(router);
|
||||
MXS_INFO("Stopped processing file %s at position %lu. Waiting until"
|
||||
" more data is written before continuing. Next check in %d seconds.",
|
||||
@ -1061,7 +1060,7 @@ static bool ensure_dir_ok(const char* path, int mode)
|
||||
|
||||
if (path)
|
||||
{
|
||||
char err[STRERROR_BUFLEN];
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
char resolved[PATH_MAX + 1];
|
||||
const char *rp = realpath(path, resolved);
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/version.h>
|
||||
@ -858,7 +857,7 @@ GWBUF* read_avro_json_schema(const char *avrofile, const char* dir)
|
||||
}
|
||||
else
|
||||
{
|
||||
char err[STRERROR_BUFLEN];
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to open file '%s': %d, %s", buffer, errno,
|
||||
strerror_r(errno, err, sizeof(err)));
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <glob.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
||||
static const char *statefile_section = "avro-conversion";
|
||||
static const char *ddl_list_name = "table-ddl.list";
|
||||
@ -160,7 +161,7 @@ bool avro_save_conversion_state(AVRO_INSTANCE *router)
|
||||
{
|
||||
FILE *config_file;
|
||||
char filename[PATH_MAX + 1];
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/"AVRO_PROGRESS_FILE".tmp", router->avrodir);
|
||||
|
||||
@ -419,7 +420,7 @@ static GWBUF* read_event_data(AVRO_INSTANCE *router, REP_HEADER* hdr, uint64_t p
|
||||
{
|
||||
if (n == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Error reading the event at %lu in %s. "
|
||||
"%s, expected %d bytes.",
|
||||
pos, router->binlog_name,
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include "avrorouter.h"
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <glob.h>
|
||||
|
||||
void* safe_key_free(void *data);
|
||||
|
||||
@ -523,7 +523,7 @@ uint8_t* process_row_event_data(TABLE_MAP *map, TABLE_CREATE *create, avro_value
|
||||
{
|
||||
uint64_t value = 0;
|
||||
int width = metadata[metadata_offset] + metadata[metadata_offset + 1] * 8;
|
||||
int bits_in_nullmap = MIN(width, extra_bits);
|
||||
int bits_in_nullmap = MXS_MIN(width, extra_bits);
|
||||
extra_bits -= bits_in_nullmap;
|
||||
width -= bits_in_nullmap;
|
||||
size_t bytes = width / 8;
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef _MXS_AVRO_H
|
||||
#define _MXS_AVRO_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -15,8 +18,7 @@
|
||||
* MaxScale AVRO router
|
||||
*
|
||||
*/
|
||||
#ifndef _MXS_AVRO_H
|
||||
#define _MXS_AVRO_H
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <blr_constants.h>
|
||||
@ -35,6 +37,8 @@
|
||||
#include <sqlite3.h>
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/** SQLite3 version 3.7.14 introduced the new v2 close interface */
|
||||
#if SQLITE_VERSION_NUMBER < 3007014
|
||||
#define sqlite3_close_v2 sqlite3_close
|
||||
@ -312,4 +316,6 @@ extern void table_map_remap(uint8_t *ptr, uint8_t hdr_len, TABLE_MAP *map);
|
||||
#define AVRO_CS_BUSY 0x0001
|
||||
#define AVRO_WAIT_DATA 0x0002
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@ -72,7 +72,6 @@
|
||||
#include <maxscale/housekeeper.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
@ -570,7 +569,7 @@ createInstance(SERVICE *service, char **options)
|
||||
mkdir_rval = mkdir(inst->binlogdir, 0700);
|
||||
if (mkdir_rval == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Service %s, Failed to create binlog directory '%s': [%d] %s",
|
||||
service->name,
|
||||
inst->binlogdir,
|
||||
@ -1631,7 +1630,7 @@ errorReply(ROUTER *instance,
|
||||
ROUTER_INSTANCE *router = (ROUTER_INSTANCE *)instance;
|
||||
int error;
|
||||
socklen_t len;
|
||||
char msg[STRERROR_BUFLEN + 1 + 5] = "";
|
||||
char msg[MXS_STRERROR_BUFLEN + 1 + 5] = "";
|
||||
char *errmsg;
|
||||
unsigned long mysql_errno;
|
||||
|
||||
@ -1691,7 +1690,7 @@ errorReply(ROUTER *instance,
|
||||
getsockopt(router->master->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0 &&
|
||||
error != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
sprintf(msg, "%s ", strerror_r(error, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
else
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _BLR_H
|
||||
#define _BLR_H
|
||||
/*
|
||||
@ -38,6 +39,8 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <pthread.h>
|
||||
@ -48,6 +51,8 @@
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
#include <maxscale/secrets.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define BINLOG_FNAMELEN 255
|
||||
#define BLR_PROTOCOL "MySQLBackend"
|
||||
#define BINLOG_MAGIC { 0xfe, 0x62, 0x69, 0x6e }
|
||||
@ -705,4 +710,6 @@ extern bool blr_send_event(blr_thread_role_t role,
|
||||
REP_HEADER *hdr,
|
||||
uint8_t *buf);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@ -43,7 +43,6 @@
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
|
||||
@ -59,7 +59,6 @@
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/gwdirs.h>
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/alloc.h>
|
||||
@ -288,7 +287,7 @@ blr_file_create(ROUTER_INSTANCE *router, char *file)
|
||||
}
|
||||
|
||||
int created = 0;
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
|
||||
char path[PATH_MAX + 1] = "";
|
||||
|
||||
@ -428,7 +427,7 @@ blr_write_binlog_record(ROUTER_INSTANCE *router, REP_HEADER *hdr, uint32_t size,
|
||||
if ((n = pwrite(router->binlog_fd, buf, size,
|
||||
router->last_written)) != size)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("%s: Failed to write binlog record at %lu of %s, %s. "
|
||||
"Truncating to previous record.",
|
||||
router->service->name, router->last_written,
|
||||
@ -658,7 +657,7 @@ blr_read_binlog(ROUTER_INSTANCE *router, BLFILE *file, unsigned long pos, REP_HE
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "Failed to read binlog file '%s'; (%s), event at %lu",
|
||||
file->binlogname, strerror_r(errno, err_msg, sizeof(err_msg)), pos);
|
||||
|
||||
@ -741,7 +740,7 @@ blr_read_binlog(ROUTER_INSTANCE *router, BLFILE *file, unsigned long pos, REP_HE
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(errmsg, BINLOG_ERROR_MSG_LEN,
|
||||
"Failed to reread header in binlog file '%s'; (%s), event at %lu",
|
||||
file->binlogname, strerror_r(errno, err_msg, sizeof(err_msg)), pos);
|
||||
@ -801,7 +800,7 @@ blr_read_binlog(ROUTER_INSTANCE *router, BLFILE *file, unsigned long pos, REP_HE
|
||||
{
|
||||
if (n == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(errmsg, BINLOG_ERROR_MSG_LEN,
|
||||
"Error reading the binlog event at %lu in binlog file '%s';"
|
||||
"(%s), expected %d bytes.",
|
||||
@ -2053,7 +2052,7 @@ blr_file_write_master_config(ROUTER_INSTANCE *router, char *error)
|
||||
|
||||
char filename[len + sizeof('/') + sizeof(MASTER_INI)]; // sizeof includes NULL
|
||||
char tmp_file[len + sizeof('/') + sizeof(MASTER_INI) + sizeof('.') + sizeof(TMP)];
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
char *ssl_ca;
|
||||
char *ssl_cert;
|
||||
char *ssl_key;
|
||||
|
||||
@ -69,7 +69,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
@ -1292,7 +1291,7 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt)
|
||||
|
||||
if (router->master_chksum)
|
||||
{
|
||||
uint32_t size = MIN(len - extra_bytes - semisync_bytes,
|
||||
uint32_t size = MXS_MIN(len - extra_bytes - semisync_bytes,
|
||||
router->checksum_size);
|
||||
|
||||
router->stored_checksum = crc32(router->stored_checksum,
|
||||
@ -1343,7 +1342,7 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt)
|
||||
size = len - (check_packet_len + MYSQL_CHECKSUM_LEN);
|
||||
}
|
||||
|
||||
size = MIN(size, router->checksum_size);
|
||||
size = MXS_MIN(size, router->checksum_size);
|
||||
|
||||
if (router->checksum_size > 0)
|
||||
{
|
||||
@ -2455,7 +2454,7 @@ GWBUF
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Reading saved events: failed to read binlog "
|
||||
"file %s at position %llu"
|
||||
" (%s).", router->binlog_name,
|
||||
@ -2515,7 +2514,7 @@ GWBUF
|
||||
{
|
||||
if (n == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Reading saved events: the event at %llu in %s. "
|
||||
"%s, expected %d bytes.",
|
||||
pos, router->binlog_name,
|
||||
@ -2807,7 +2806,7 @@ blr_write_data_into_binlog(ROUTER_INSTANCE *router, uint32_t data_len, uint8_t *
|
||||
if ((n = pwrite(router->binlog_fd, buf, data_len,
|
||||
router->last_written)) != data_len)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("%s: Failed to write binlog record at %lu of %s, %s. "
|
||||
"Truncating to previous record.",
|
||||
router->service->name, router->last_written,
|
||||
@ -2935,7 +2934,7 @@ bool blr_send_event(blr_thread_role_t role,
|
||||
while (rval && len > 0)
|
||||
{
|
||||
uint64_t payload_len = first ? MYSQL_PACKET_LENGTH_MAX - 1 :
|
||||
MIN(MYSQL_PACKET_LENGTH_MAX, len);
|
||||
MXS_MIN(MYSQL_PACKET_LENGTH_MAX, len);
|
||||
|
||||
if (blr_send_packet(slave, buf, payload_len, first))
|
||||
{
|
||||
|
||||
@ -81,7 +81,6 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
#include <sys/stat.h>
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/version.h>
|
||||
@ -877,7 +876,7 @@ blr_slave_query(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
|
||||
|
||||
if (removed_cfg == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(error_string, BINLOG_ERROR_MSG_LEN,
|
||||
"Error removing %s, %s, errno %u", path,
|
||||
strerror_r(errno, err_msg, sizeof(err_msg)), errno);
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
#include <time.h>
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/gwdirs.h>
|
||||
|
||||
@ -272,7 +272,7 @@ execute(ROUTER *instance, void *router_session, GWBUF *queue)
|
||||
{
|
||||
const char* data = GWBUF_DATA(queue);
|
||||
int len = GWBUF_LENGTH(queue);
|
||||
int n = MIN(len, CMDBUFLEN - cmdlen - 1);
|
||||
int n = MXS_MIN(len, CMDBUFLEN - cmdlen - 1);
|
||||
|
||||
if (n != len)
|
||||
{
|
||||
|
||||
@ -293,7 +293,7 @@ execute(ROUTER *instance, void *router_session, GWBUF *queue)
|
||||
{
|
||||
const char* data = GWBUF_DATA(queue);
|
||||
int len = GWBUF_LENGTH(queue);
|
||||
int n = MIN(len, CMDBUFLEN - cmdlen - 1);
|
||||
int n = MXS_MIN(len, CMDBUFLEN - cmdlen - 1);
|
||||
|
||||
if (n != len)
|
||||
{
|
||||
|
||||
@ -1051,7 +1051,7 @@ execute_cmd(CLI_SESSION *cli)
|
||||
}
|
||||
}
|
||||
*lptr = 0;
|
||||
args[MIN(MAXARGS - 1, i + 1)] = NULL;
|
||||
args[MXS_MIN(MAXARGS - 1, i + 1)] = NULL;
|
||||
|
||||
if (args[0] == NULL || *args[0] == 0)
|
||||
{
|
||||
@ -1964,9 +1964,9 @@ static void fail_accept(
|
||||
char* arg1,
|
||||
char* arg2)
|
||||
{
|
||||
int failcount = MIN(atoi(arg2), 100);
|
||||
int failcount = MXS_MIN(atoi(arg2), 100);
|
||||
fail_accept_errno = atoi(arg1);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
|
||||
switch(fail_accept_errno) {
|
||||
case EAGAIN:
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _MAXINFO_H
|
||||
#define _MAXINFO_H
|
||||
/*
|
||||
@ -12,9 +13,6 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <maxscale/service.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
/**
|
||||
* @file maxinfo.h The MaxScale information schema provider
|
||||
@ -27,6 +25,14 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/service.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
struct maxinfo_session;
|
||||
|
||||
/**
|
||||
@ -138,4 +144,7 @@ extern void maxinfo_send_parse_error(DCB *, char *, PARSE_ERROR);
|
||||
extern void maxinfo_send_error(DCB *, int, char *);
|
||||
extern RESULTSET *maxinfo_variables();
|
||||
extern RESULTSET *maxinfo_status();
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@ -23,6 +23,8 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _READCONNECTION_H
|
||||
#define _READCONNECTION_H
|
||||
/*
|
||||
@ -25,8 +26,12 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Internal structure used to define the set of backend servers we are routing
|
||||
* connections to. This provides the storage for routing module specific data
|
||||
@ -84,4 +89,7 @@ typedef struct router_instance
|
||||
struct router_instance
|
||||
*next;
|
||||
} ROUTER_INSTANCE;
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@ -84,7 +84,6 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
|
||||
@ -559,7 +559,7 @@ static void *newSession(ROUTER *router_inst, SESSION *session)
|
||||
{
|
||||
int n_conn = 0;
|
||||
double pct = (double)client_rses->rses_config.rw_max_slave_conn_percent / 100.0;
|
||||
n_conn = MAX(floor((double)client_rses->rses_nbackends * pct), 1);
|
||||
n_conn = MXS_MAX(floor((double)client_rses->rses_nbackends * pct), 1);
|
||||
client_rses->rses_config.rw_max_slave_conn_count = n_conn;
|
||||
}
|
||||
|
||||
@ -1294,7 +1294,7 @@ int rses_get_max_slavecount(ROUTER_CLIENT_SES *rses,
|
||||
{
|
||||
conf_max_nslaves = (router_nservers * rses->rses_config.rw_max_slave_conn_percent) / 100;
|
||||
}
|
||||
max_nslaves = MIN(router_nservers - 1, MAX(1, conf_max_nslaves));
|
||||
max_nslaves = MXS_MIN(router_nservers - 1, MXS_MAX(1, conf_max_nslaves));
|
||||
|
||||
return max_nslaves;
|
||||
}
|
||||
@ -1897,7 +1897,7 @@ static bool have_enough_servers(ROUTER_CLIENT_SES **p_rses, const int min_nsrv,
|
||||
|
||||
/** With too few servers session is not created */
|
||||
if (router_nsrv < min_nsrv ||
|
||||
MAX((*p_rses)->rses_config.rw_max_slave_conn_count,
|
||||
MXS_MAX((*p_rses)->rses_config.rw_max_slave_conn_count,
|
||||
(router_nsrv * (*p_rses)->rses_config.rw_max_slave_conn_percent) /
|
||||
100) < min_nsrv)
|
||||
{
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _RWSPLITROUTER_H
|
||||
#define _RWSPLITROUTER_H
|
||||
/*
|
||||
@ -24,10 +25,13 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <math.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#undef PREP_STMT_CACHING
|
||||
|
||||
#if defined(PREP_STMT_CACHING)
|
||||
@ -356,5 +360,6 @@ typedef struct router_instance
|
||||
#define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
|
||||
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /*< _RWSPLITROUTER_H */
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef _RWSPLIT_INTERNAL_H
|
||||
#define _RWSPLIT_INTERNAL_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -18,15 +21,11 @@
|
||||
* Created on 08 August 2016, 11:54
|
||||
*/
|
||||
|
||||
#ifndef RWSPLIT_INTERNAL_H
|
||||
#define RWSPLIT_INTERNAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/query_classifier.h>
|
||||
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/* This needs to be removed along with dependency on it - see the
|
||||
* rwsplit_tmp_table_multi functions
|
||||
*/
|
||||
@ -145,5 +144,7 @@ qc_query_type_t determine_query_type(GWBUF *querybuf, int packet_type, bool non_
|
||||
}
|
||||
#endif
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* RWSPLIT_INTERNAL_H */
|
||||
|
||||
|
||||
@ -163,10 +163,10 @@ log_transaction_status(ROUTER_CLIENT_SES *rses, GWBUF *querybuf, qc_query_type_t
|
||||
{
|
||||
uint8_t *packet = GWBUF_DATA(querybuf);
|
||||
unsigned char ptype = packet[4];
|
||||
size_t len = MIN(GWBUF_LENGTH(querybuf),
|
||||
size_t len = MXS_MIN(GWBUF_LENGTH(querybuf),
|
||||
MYSQL_GET_PACKET_LEN((unsigned char *)querybuf->start) - 1);
|
||||
char *data = (char *)&packet[5];
|
||||
char *contentstr = strndup(data, MIN(len, RWSPLIT_TRACE_MSG_LEN));
|
||||
char *contentstr = strndup(data, MXS_MIN(len, RWSPLIT_TRACE_MSG_LEN));
|
||||
char *qtypestr = qc_get_qtype_str(qtype);
|
||||
MXS_INFO("> Autocommit: %s, trx is %s, cmd: %s, type: %s, stmt: %s%s %s",
|
||||
(rses->rses_autocommit_enabled ? "[enabled]" : "[disabled]"),
|
||||
|
||||
@ -2004,7 +2004,7 @@ static int routeQuery(ROUTER* instance,
|
||||
{
|
||||
uint8_t* packet = GWBUF_DATA(querybuf);
|
||||
unsigned char ptype = packet[4];
|
||||
size_t len = MIN(GWBUF_LENGTH(querybuf),
|
||||
size_t len = MXS_MIN(GWBUF_LENGTH(querybuf),
|
||||
MYSQL_GET_PACKET_LEN((unsigned char *)querybuf->start) - 1);
|
||||
char* data = (char*)&packet[5];
|
||||
char* contentstr = strndup(data, len);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _SCHEMAROUTER_H
|
||||
#define _SCHEMAROUTER_H
|
||||
/*
|
||||
@ -23,14 +24,15 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
#ifndef PCRE2_CODE_UNIT_WIDTH
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#endif
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
#include <pcre2.h>
|
||||
#include <maxscale/pcre2.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Bitmask values for the router session's initialization. These values are used
|
||||
* to prevent responses from internal commands being forwarded to the client.
|
||||
@ -377,4 +379,6 @@ typedef struct router_instance
|
||||
#define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
|
||||
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /*< _SCHEMAROUTER_H */
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef _SHARDING_COMMON_HG
|
||||
#define _SHARDING_COMMON_HG
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -11,9 +14,7 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#ifndef _SHARDING_COMMON_HG
|
||||
#define _SHARDING_COMMON_HG
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <my_config.h>
|
||||
#include <poll.h>
|
||||
#include <maxscale/buffer.h>
|
||||
@ -23,8 +24,12 @@
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/query_classifier.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
bool extract_database(GWBUF* buf, char* str);
|
||||
void create_error_reply(char* fail_str, DCB* dcb);
|
||||
bool change_current_db(char* dest, HASHTABLE* dbhash, GWBUF* buf);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user