Module private headers moved to modules
This commit is contained in:
parent
1895c04fc6
commit
c433d11b39
@ -54,7 +54,7 @@
|
||||
#include <histedit.h>
|
||||
#endif
|
||||
|
||||
#include <maxadmin.h>
|
||||
#include <maxscale/maxadmin.h>
|
||||
/*
|
||||
* We need a common.h file that is included by every component.
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/modutil.h>
|
||||
#include <mysqlhint.h>
|
||||
#include "mysqlhint.h"
|
||||
|
||||
/**
|
||||
* hintfilter.c - a filter to parse the MaxScale hint syntax and attach those
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <maxscale/filter.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/modutil.h>
|
||||
#include <mysqlhint.h>
|
||||
#include "mysqlhint.h"
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
/**
|
||||
|
@ -1,258 +0,0 @@
|
||||
#ifndef _SHARDROUTER_H
|
||||
#define _SHARDROUTER_H
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file shardrouter.h - The sharding router module header file
|
||||
*
|
||||
* @verbatim
|
||||
* Revision History
|
||||
*
|
||||
* See GitHub https://github.com/mariadb-corporation/MaxScale
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <dcb.h>
|
||||
#include <hashtable.h>
|
||||
#include <mysql_client_server_protocol.h>
|
||||
|
||||
struct router_instance;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TARGET_UNDEFINED = 0x00,
|
||||
TARGET_MASTER = 0x01,
|
||||
TARGET_SLAVE = 0x02,
|
||||
TARGET_NAMED_SERVER = 0x04,
|
||||
TARGET_ALL = 0x08,
|
||||
TARGET_RLAG_MAX = 0x10,
|
||||
TARGET_ANY = 0x20
|
||||
} route_target_t;
|
||||
|
||||
#define TARGET_IS_UNDEFINED(t) (t == TARGET_UNDEFINED)
|
||||
#define TARGET_IS_NAMED_SERVER(t) (t & TARGET_NAMED_SERVER)
|
||||
#define TARGET_IS_ALL(t) (t & TARGET_ALL)
|
||||
#define TARGET_IS_ANY(t) (t & TARGET_ANY)
|
||||
|
||||
typedef struct rses_property_st rses_property_t;
|
||||
typedef struct router_client_session ROUTER_CLIENT_SES;
|
||||
|
||||
typedef enum rses_property_type_t
|
||||
{
|
||||
RSES_PROP_TYPE_UNDEFINED = -1,
|
||||
RSES_PROP_TYPE_SESCMD = 0,
|
||||
RSES_PROP_TYPE_FIRST = RSES_PROP_TYPE_SESCMD,
|
||||
RSES_PROP_TYPE_TMPTABLES,
|
||||
RSES_PROP_TYPE_LAST = RSES_PROP_TYPE_TMPTABLES,
|
||||
RSES_PROP_TYPE_COUNT = RSES_PROP_TYPE_LAST + 1
|
||||
} rses_property_type_t;
|
||||
|
||||
/** default values for rwsplit configuration parameters */
|
||||
#define CONFIG_MAX_SLAVE_CONN 1
|
||||
#define CONFIG_MAX_SLAVE_RLAG -1 /*< not used */
|
||||
#define CONFIG_SQL_VARIABLES_IN TYPE_ALL
|
||||
|
||||
#define GET_SELECT_CRITERIA(s) \
|
||||
(strncmp(s,"LEAST_GLOBAL_CONNECTIONS", strlen("LEAST_GLOBAL_CONNECTIONS")) == 0 ? \
|
||||
LEAST_GLOBAL_CONNECTIONS : ( \
|
||||
strncmp(s,"LEAST_BEHIND_MASTER", strlen("LEAST_BEHIND_MASTER")) == 0 ? \
|
||||
LEAST_BEHIND_MASTER : ( \
|
||||
strncmp(s,"LEAST_ROUTER_CONNECTIONS", strlen("LEAST_ROUTER_CONNECTIONS")) == 0 ? \
|
||||
LEAST_ROUTER_CONNECTIONS : ( \
|
||||
strncmp(s,"LEAST_CURRENT_OPERATIONS", strlen("LEAST_CURRENT_OPERATIONS")) == 0 ? \
|
||||
LEAST_CURRENT_OPERATIONS : UNDEFINED_CRITERIA))))
|
||||
|
||||
|
||||
|
||||
#define SUBSVC_IS_MAPPED(s) (s->state & SUBSVC_MAPPED)
|
||||
#define SUBSVC_IS_CLOSED(s) (s->state & SUBSVC_CLOSED)
|
||||
#define SUBSVC_IS_OK(s) (s->state & SUBSVC_OK)
|
||||
#define SUBSVC_IS_WAITING(s) (s->state & SUBSVC_WAITING_RESULT)
|
||||
|
||||
/**
|
||||
* Session variable command
|
||||
*/
|
||||
typedef struct mysql_sescmd_st
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t my_sescmd_chk_top;
|
||||
#endif
|
||||
rses_property_t* my_sescmd_prop; /*< parent property */
|
||||
GWBUF* my_sescmd_buf; /*< query buffer */
|
||||
unsigned char my_sescmd_packet_type;/*< packet type */
|
||||
bool my_sescmd_is_replied; /*< is cmd replied to client */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t my_sescmd_chk_tail;
|
||||
#endif
|
||||
} mysql_sescmd_t;
|
||||
|
||||
|
||||
/**
|
||||
* Property structure
|
||||
*/
|
||||
struct rses_property_st
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t rses_prop_chk_top;
|
||||
#endif
|
||||
ROUTER_CLIENT_SES* rses_prop_rsession; /*< parent router session */
|
||||
int rses_prop_refcount;
|
||||
rses_property_type_t rses_prop_type;
|
||||
union rses_prop_data
|
||||
{
|
||||
mysql_sescmd_t sescmd;
|
||||
HASHTABLE* temp_tables;
|
||||
} rses_prop_data;
|
||||
rses_property_t* rses_prop_next; /*< next property of same type */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t rses_prop_chk_tail;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct sescmd_cursor_st
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t scmd_cur_chk_top;
|
||||
#endif
|
||||
ROUTER_CLIENT_SES* scmd_cur_rses; /*< pointer to owning router session */
|
||||
rses_property_t** scmd_cur_ptr_property; /*< address of pointer to owner property */
|
||||
mysql_sescmd_t* scmd_cur_cmd; /*< pointer to current session command */
|
||||
bool scmd_cur_active; /*< true if command is being executed */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t scmd_cur_chk_tail;
|
||||
#endif
|
||||
} sescmd_cursor_t;
|
||||
|
||||
typedef struct shardrouter_config_st
|
||||
{
|
||||
int rw_max_slave_conn_percent;
|
||||
int rw_max_slave_conn_count;
|
||||
target_t rw_use_sql_variables_in;
|
||||
} shard_config_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SUBSVC_ALLOC = 0,
|
||||
SUBSVC_OK = 1,
|
||||
SUBSVC_CLOSED = (1 << 1), /* This is when the service was cleanly closed */
|
||||
SUBSVC_FAILED = (1 << 2), /* This is when something went wrong */
|
||||
SUBSVC_QUERY_ACTIVE = (1 << 3),
|
||||
SUBSVC_WAITING_RESULT = (1 << 4),
|
||||
SUBSVC_MAPPED = (1 << 5)
|
||||
} subsvc_state_t;
|
||||
|
||||
typedef struct subservice_t
|
||||
{
|
||||
SERVICE* service;
|
||||
SESSION* session;
|
||||
DCB* dcb;
|
||||
GWBUF* pending_cmd;
|
||||
sescmd_cursor_t* scur;
|
||||
int state;
|
||||
int n_res_waiting;
|
||||
bool mapped;
|
||||
} SUBSERVICE;
|
||||
|
||||
/**
|
||||
* Bitmask values for the router session's initialization. These values are used
|
||||
* to prevent responses from internal commands being forwarded to the client.
|
||||
*/
|
||||
typedef enum shard_init_mask
|
||||
{
|
||||
INIT_READY = 0x0,
|
||||
INIT_MAPPING = 0x1,
|
||||
INIT_USE_DB = 0x02,
|
||||
INIT_UNINT = 0x04
|
||||
|
||||
} shard_init_mask_t;
|
||||
|
||||
/**
|
||||
* The client session structure used within this router.
|
||||
*/
|
||||
struct router_client_session
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t rses_chk_top;
|
||||
#endif
|
||||
SPINLOCK rses_lock; /*< protects rses_deleted */
|
||||
int rses_versno; /*< even = no active update, else odd. not used 4/14 */
|
||||
bool rses_closed; /*< true when closeSession is called */
|
||||
DCB* rses_client_dcb;
|
||||
DCB* replydcb; /* DCB used to send the client write messages from the router itself */
|
||||
DCB* routedcb; /* DCB used to send queued queries to the router */
|
||||
MYSQL_session* rses_mysql_session;
|
||||
/** Properties listed by their type */
|
||||
rses_property_t* rses_properties[RSES_PROP_TYPE_COUNT];
|
||||
|
||||
shard_config_t rses_config; /*< copied config info from router instance */
|
||||
bool rses_autocommit_enabled;
|
||||
bool rses_transaction_active;
|
||||
struct router_instance *router; /*< The router instance */
|
||||
struct router_client_session* next;
|
||||
HASHTABLE* dbhash;
|
||||
SUBSERVICE * *subservice;
|
||||
int n_subservice;
|
||||
bool hash_init;
|
||||
SESSION* session;
|
||||
GWBUF* queue;
|
||||
char connect_db[MYSQL_DATABASE_MAXLEN + 1]; /*< Database the user was trying to connect to */
|
||||
char current_db[MYSQL_DATABASE_MAXLEN + 1]; /*< Current active database */
|
||||
shard_init_mask_t init; /*< Initialization state bitmask */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t rses_chk_tail;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* The statistics for this router instance
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int n_sessions; /*< Number sessions created */
|
||||
int n_queries; /*< Number of queries forwarded */
|
||||
int n_master; /*< Number of stmts sent to master */
|
||||
int n_slave; /*< Number of stmts sent to slave */
|
||||
int n_all; /*< Number of stmts sent to all */
|
||||
} ROUTER_STATS;
|
||||
|
||||
|
||||
/**
|
||||
* The per instance data for the router.
|
||||
*/
|
||||
typedef struct router_instance
|
||||
{
|
||||
SERVICE* service; /*< Pointer to owning service */
|
||||
ROUTER_CLIENT_SES* connections; /*< List of client connections */
|
||||
SERVICE** services; /*< List of services to map for sharding */
|
||||
int n_services;
|
||||
SUBSERVICE* all_subsvc;
|
||||
SPINLOCK lock; /*< Lock for the instance data */
|
||||
shard_config_t shardrouter_config; /*< expanded config info from SERVICE */
|
||||
int shardrouter_version;/*< version number for router's config */
|
||||
unsigned int bitmask; /*< Bitmask to apply to server->status */
|
||||
unsigned int bitvalue; /*< Required value of server->status */
|
||||
ROUTER_STATS stats; /*< Statistics for this router */
|
||||
struct router_instance* next; /*< Next router on the list */
|
||||
bool available_slaves; /*< The router has some slaves available */
|
||||
DCB* dumy_backend;
|
||||
} ROUTER_INSTANCE;
|
||||
|
||||
#define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
|
||||
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
|
||||
|
||||
bool subsvc_is_valid(SUBSERVICE*);
|
||||
|
||||
#endif /*< _SHARDROUTER_H */
|
@ -32,7 +32,7 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <httpd.h>
|
||||
#include "httpd.h"
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/gw_protocol.h>
|
||||
#include <maxscale/gw.h>
|
||||
|
@ -33,8 +33,8 @@
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscaled.h>
|
||||
#include <maxadmin.h>
|
||||
#include "maxscaled.h"
|
||||
#include <maxscale/maxadmin.h>
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
/* @see function load_module in load_utils.c for explanation of the following
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include <ini.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <avrorouter.h>
|
||||
#include "avrorouter.h"
|
||||
#include <maxscale/random_jkiss.h>
|
||||
#include <binlog_common.h>
|
||||
#include <avro/errors.h>
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/version.h>
|
||||
#include <avrorouter.h>
|
||||
#include "avrorouter.h"
|
||||
#include <maxavro.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/dbusers.h>
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <binlog_common.h>
|
||||
#include <blr_constants.h>
|
||||
#include <sys/stat.h>
|
||||
#include <avrorouter.h>
|
||||
#include "avrorouter.h"
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/maxscale_pcre2.h>
|
||||
#include <ini.h>
|
||||
|
@ -32,7 +32,7 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <avrorouter.h>
|
||||
#include "avrorouter.h"
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <glob.h>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <maxscale/mysql_utils.h>
|
||||
#include <jansson.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <avrorouter.h>
|
||||
#include "avrorouter.h"
|
||||
#include <strings.h>
|
||||
|
||||
#define WRITE_EVENT 0
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <avrorouter.h>
|
||||
#include "avrorouter.h"
|
||||
#include <maxscale/mysql_utils.h>
|
||||
#include <jansson.h>
|
||||
#include <stdio.h>
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include <maxscale/utils.h>
|
||||
#include <maxscale/secrets.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <blr.h>
|
||||
#include "blr.h"
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <maxscale/router.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <blr.h>
|
||||
#include "blr.h"
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include <maxscale/router.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <blr.h>
|
||||
#include "blr.h"
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/gwdirs.h>
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include <maxscale/router.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <blr.h>
|
||||
#include "blr.h"
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
|
@ -74,7 +74,7 @@
|
||||
#include <maxscale/router.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <blr.h>
|
||||
#include "blr.h"
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <blr.h>
|
||||
#include "blr.h"
|
||||
|
||||
|
||||
static void printVersion(const char *progname);
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <maxscale/router.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <blr.h>
|
||||
#include "../blr.h"
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/maxscale.h>
|
||||
#include <maxscale/poll.h>
|
||||
#include <maxinfo.h>
|
||||
#include "maxinfo.h"
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/resultset.h>
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/poll.h>
|
||||
#include <maxinfo.h>
|
||||
#include "maxinfo.h"
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/maxscale.h>
|
||||
#include <maxscale/poll.h>
|
||||
#include <maxinfo.h>
|
||||
#include "maxinfo.h"
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/resultset.h>
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/poll.h>
|
||||
#include <maxinfo.h>
|
||||
#include "maxinfo.h"
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
#include <maxscale/router.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <readconnection.h>
|
||||
#include "readconnection.h"
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -17,8 +17,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <maxscale/router.h>
|
||||
#include <readwritesplit.h>
|
||||
#include <rwsplit_internal.h>
|
||||
#include "readwritesplit.h"
|
||||
#include "rwsplit_internal.h"
|
||||
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -18,8 +18,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <maxscale/router.h>
|
||||
#include <readwritesplit.h>
|
||||
#include <rwsplit_internal.h>
|
||||
#include "readwritesplit.h"
|
||||
#include "rwsplit_internal.h"
|
||||
|
||||
#include <mysql.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -18,8 +18,8 @@
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
#include <maxscale/router.h>
|
||||
#include <readwritesplit.h>
|
||||
#include <rwsplit_internal.h>
|
||||
#include "readwritesplit.h"
|
||||
#include "rwsplit_internal.h"
|
||||
/**
|
||||
* @file rwsplit_route_stmt.c The functions that support the routing of
|
||||
* queries to back end servers. All the functions in this module are internal
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -17,8 +17,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <maxscale/router.h>
|
||||
#include <readwritesplit.h>
|
||||
#include <rwsplit_internal.h>
|
||||
#include "readwritesplit.h"
|
||||
#include "rwsplit_internal.h"
|
||||
/**
|
||||
* @file rwsplit_select_backends.c The functions that implement back end
|
||||
* selection for the read write split router. All of these functions are
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -17,8 +17,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <maxscale/router.h>
|
||||
#include <readwritesplit.h>
|
||||
#include <rwsplit_internal.h>
|
||||
#include "readwritesplit.h"
|
||||
#include "rwsplit_internal.h"
|
||||
|
||||
/**
|
||||
* @file rwsplit_session_cmd.c The functions that provide session command
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -21,8 +21,8 @@
|
||||
#include <maxscale/modutil.h>
|
||||
|
||||
#include <maxscale/router.h>
|
||||
#include <readwritesplit.h>
|
||||
#include <rwsplit_internal.h>
|
||||
#include "readwritesplit.h"
|
||||
#include "rwsplit_internal.h"
|
||||
/**
|
||||
* @file rwsplit_tmp_table.c The functions that carry out checks on
|
||||
* statements to see if they involve various operations involving temporary
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <maxscale/router.h>
|
||||
#include <schemarouter.h>
|
||||
#include <sharding_common.h>
|
||||
#include "schemarouter.h"
|
||||
#include "sharding_common.h"
|
||||
#include <maxscale/secrets.h>
|
||||
#include <mysql.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <sharding_common.h>
|
||||
#include "sharding_common.h"
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/poll.h>
|
||||
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <shardrouter.h>
|
||||
|
||||
void
|
||||
subsvc_set_state(SUBSERVICE* svc, subsvc_state_t state)
|
||||
{
|
||||
if (state & SUBSVC_WAITING_RESULT)
|
||||
{
|
||||
/** Increase waiter count */
|
||||
atomic_add(&svc->n_res_waiting, 1);
|
||||
}
|
||||
|
||||
svc->state |= state;
|
||||
}
|
||||
|
||||
void
|
||||
subsvc_clear_state(SUBSERVICE* svc, subsvc_state_t state)
|
||||
{
|
||||
if (state & SUBSVC_WAITING_RESULT)
|
||||
{
|
||||
/** Decrease waiter count */
|
||||
atomic_add(&svc->n_res_waiting, -1);
|
||||
}
|
||||
|
||||
svc->state &= ~state;
|
||||
}
|
||||
|
||||
bool
|
||||
get_shard_subsvc(SUBSERVICE** subsvc, ROUTER_CLIENT_SES* session, char* target)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (subsvc == NULL || session == NULL || target == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < session->n_subservice; i++)
|
||||
{
|
||||
if (strcmp(session->subservice[i]->service->name, target) == 0)
|
||||
{
|
||||
|
||||
if (SUBSVC_IS_OK(session->subservice[i]))
|
||||
{
|
||||
if (subsvc_is_valid(session->subservice[i]))
|
||||
{
|
||||
*subsvc = session->subservice[i];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The service has failed
|
||||
*/
|
||||
|
||||
subsvc_set_state(session->subservice[i], SUBSVC_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user