diff --git a/client/maxadmin.c b/client/maxadmin.c index 32b1a6b3f..13c92de7e 100644 --- a/client/maxadmin.c +++ b/client/maxadmin.c @@ -54,7 +54,7 @@ #include #endif -#include +#include /* * We need a common.h file that is included by every component. */ diff --git a/server/modules/include/maxadmin.h b/include/maxscale/maxadmin.h similarity index 100% rename from server/modules/include/maxadmin.h rename to include/maxscale/maxadmin.h diff --git a/server/modules/filter/hintfilter/hintfilter.c b/server/modules/filter/hintfilter/hintfilter.c index 87f74bbb3..c7efaabaa 100644 --- a/server/modules/filter/hintfilter/hintfilter.c +++ b/server/modules/filter/hintfilter/hintfilter.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include "mysqlhint.h" /** * hintfilter.c - a filter to parse the MaxScale hint syntax and attach those diff --git a/server/modules/filter/hintfilter/hintparser.c b/server/modules/filter/hintfilter/hintparser.c index ab72b8ccd..bfc721a3a 100644 --- a/server/modules/filter/hintfilter/hintparser.c +++ b/server/modules/filter/hintfilter/hintparser.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include "mysqlhint.h" #include /** diff --git a/server/modules/include/mysqlhint.h b/server/modules/filter/hintfilter/mysqlhint.h similarity index 100% rename from server/modules/include/mysqlhint.h rename to server/modules/filter/hintfilter/mysqlhint.h diff --git a/server/modules/include/shardrouter.h b/server/modules/include/shardrouter.h deleted file mode 100644 index a57aa1603..000000000 --- a/server/modules/include/shardrouter.h +++ /dev/null @@ -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 -#include -#include - -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 */ diff --git a/server/modules/protocol/HTTPD/httpd.c b/server/modules/protocol/HTTPD/httpd.c index c584fd27d..d3ae66ff9 100644 --- a/server/modules/protocol/HTTPD/httpd.c +++ b/server/modules/protocol/HTTPD/httpd.c @@ -32,7 +32,7 @@ * @endverbatim */ -#include +#include "httpd.h" #include #include #include diff --git a/server/modules/include/httpd.h b/server/modules/protocol/HTTPD/httpd.h similarity index 100% rename from server/modules/include/httpd.h rename to server/modules/protocol/HTTPD/httpd.h diff --git a/server/modules/protocol/maxscaled/maxscaled.c b/server/modules/protocol/maxscaled/maxscaled.c index 75f2c660e..9e8e6d4d2 100644 --- a/server/modules/protocol/maxscaled/maxscaled.c +++ b/server/modules/protocol/maxscaled/maxscaled.c @@ -33,8 +33,8 @@ #include #include #include -#include -#include +#include "maxscaled.h" +#include #include /* @see function load_module in load_utils.c for explanation of the following diff --git a/server/modules/include/maxscaled.h b/server/modules/protocol/maxscaled/maxscaled.h similarity index 100% rename from server/modules/include/maxscaled.h rename to server/modules/protocol/maxscaled/maxscaled.h diff --git a/server/modules/routing/avro/avro.c b/server/modules/routing/avro/avro.c index c580c574e..a4e5c5581 100644 --- a/server/modules/routing/avro/avro.c +++ b/server/modules/routing/avro/avro.c @@ -47,7 +47,7 @@ #include #include -#include +#include "avrorouter.h" #include #include #include diff --git a/server/modules/routing/avro/avro_client.c b/server/modules/routing/avro/avro_client.c index 505be1ec4..9a051728c 100644 --- a/server/modules/routing/avro/avro_client.c +++ b/server/modules/routing/avro/avro_client.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include "avrorouter.h" #include #include #include diff --git a/server/modules/routing/avro/avro_file.c b/server/modules/routing/avro/avro_file.c index 05f4b020b..8fe34f3a7 100644 --- a/server/modules/routing/avro/avro_file.c +++ b/server/modules/routing/avro/avro_file.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include "avrorouter.h" #include #include #include diff --git a/server/modules/routing/avro/avro_index.c b/server/modules/routing/avro/avro_index.c index 99da0cab2..70acf2353 100644 --- a/server/modules/routing/avro/avro_index.c +++ b/server/modules/routing/avro/avro_index.c @@ -32,7 +32,7 @@ * @endverbatim */ -#include +#include "avrorouter.h" #include #include diff --git a/server/modules/routing/avro/avro_rbr.c b/server/modules/routing/avro/avro_rbr.c index 27f68aa98..a64927290 100644 --- a/server/modules/routing/avro/avro_rbr.c +++ b/server/modules/routing/avro/avro_rbr.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include "avrorouter.h" #include #define WRITE_EVENT 0 diff --git a/server/modules/routing/avro/avro_schema.c b/server/modules/routing/avro/avro_schema.c index e7244fa4c..fdf48448a 100644 --- a/server/modules/routing/avro/avro_schema.c +++ b/server/modules/routing/avro/avro_schema.c @@ -18,7 +18,7 @@ #define _GNU_SOURCE #endif -#include +#include "avrorouter.h" #include #include #include diff --git a/server/modules/include/avrorouter.h b/server/modules/routing/avro/avrorouter.h similarity index 100% rename from server/modules/include/avrorouter.h rename to server/modules/routing/avro/avrorouter.h diff --git a/server/modules/routing/binlog/blr.c b/server/modules/routing/binlog/blr.c index 43f0facea..b8dc3d202 100644 --- a/server/modules/routing/binlog/blr.c +++ b/server/modules/routing/binlog/blr.c @@ -65,7 +65,7 @@ #include #include #include -#include +#include "blr.h" #include #include #include diff --git a/server/modules/include/blr.h b/server/modules/routing/binlog/blr.h similarity index 100% rename from server/modules/include/blr.h rename to server/modules/routing/binlog/blr.h diff --git a/server/modules/routing/binlog/blr_cache.c b/server/modules/routing/binlog/blr_cache.c index 2f8848ab6..3e6e5768d 100644 --- a/server/modules/routing/binlog/blr_cache.c +++ b/server/modules/routing/binlog/blr_cache.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include "blr.h" #include #include diff --git a/server/modules/routing/binlog/blr_file.c b/server/modules/routing/binlog/blr_file.c index 14e259036..6edafcb3c 100644 --- a/server/modules/routing/binlog/blr_file.c +++ b/server/modules/routing/binlog/blr_file.c @@ -52,7 +52,7 @@ #include #include #include -#include +#include "blr.h" #include #include #include diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index cc33bee65..de9589879 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -60,7 +60,7 @@ #include #include #include -#include +#include "blr.h" #include #include #include diff --git a/server/modules/routing/binlog/blr_slave.c b/server/modules/routing/binlog/blr_slave.c index d319d8514..cbe4b3d07 100644 --- a/server/modules/routing/binlog/blr_slave.c +++ b/server/modules/routing/binlog/blr_slave.c @@ -74,7 +74,7 @@ #include #include #include -#include +#include "blr.h" #include #include #include diff --git a/server/modules/routing/binlog/maxbinlogcheck.c b/server/modules/routing/binlog/maxbinlogcheck.c index 4c926ce75..de8dbddb6 100644 --- a/server/modules/routing/binlog/maxbinlogcheck.c +++ b/server/modules/routing/binlog/maxbinlogcheck.c @@ -39,7 +39,7 @@ #include #include -#include +#include "blr.h" static void printVersion(const char *progname); diff --git a/server/modules/routing/binlog/test/testbinlog.c b/server/modules/routing/binlog/test/testbinlog.c index aaf060cd0..844dd2ba2 100644 --- a/server/modules/routing/binlog/test/testbinlog.c +++ b/server/modules/routing/binlog/test/testbinlog.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include "../blr.h" #include #include #include diff --git a/server/modules/routing/maxinfo/maxinfo.c b/server/modules/routing/maxinfo/maxinfo.c index 21b1a391b..ded66eff0 100644 --- a/server/modules/routing/maxinfo/maxinfo.c +++ b/server/modules/routing/maxinfo/maxinfo.c @@ -43,7 +43,7 @@ #include #include #include -#include +#include "maxinfo.h" #include #include #include diff --git a/server/modules/include/maxinfo.h b/server/modules/routing/maxinfo/maxinfo.h similarity index 100% rename from server/modules/include/maxinfo.h rename to server/modules/routing/maxinfo/maxinfo.h diff --git a/server/modules/routing/maxinfo/maxinfo_error.c b/server/modules/routing/maxinfo/maxinfo_error.c index 1dd4c3087..b16258a5b 100644 --- a/server/modules/routing/maxinfo/maxinfo_error.c +++ b/server/modules/routing/maxinfo/maxinfo_error.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include "maxinfo.h" #include #include diff --git a/server/modules/routing/maxinfo/maxinfo_exec.c b/server/modules/routing/maxinfo/maxinfo_exec.c index bdbfa3d47..950ae0183 100644 --- a/server/modules/routing/maxinfo/maxinfo_exec.c +++ b/server/modules/routing/maxinfo/maxinfo_exec.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include "maxinfo.h" #include #include #include diff --git a/server/modules/routing/maxinfo/maxinfo_parse.c b/server/modules/routing/maxinfo/maxinfo_parse.c index c80b2323c..5fd8bfe05 100644 --- a/server/modules/routing/maxinfo/maxinfo_parse.c +++ b/server/modules/routing/maxinfo/maxinfo_parse.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include "maxinfo.h" #include #include diff --git a/server/modules/include/readconnection.h b/server/modules/routing/readconnroute/readconnection.h similarity index 100% rename from server/modules/include/readconnection.h rename to server/modules/routing/readconnroute/readconnection.h diff --git a/server/modules/routing/readconnroute/readconnroute.c b/server/modules/routing/readconnroute/readconnroute.c index d15269635..04df306c4 100644 --- a/server/modules/routing/readconnroute/readconnroute.c +++ b/server/modules/routing/readconnroute/readconnroute.c @@ -79,7 +79,7 @@ #include #include #include -#include +#include "readconnection.h" #include #include #include diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index d9437339b..347ce8d15 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -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 #include -#include -#include +#include "readwritesplit.h" +#include "rwsplit_internal.h" #include #include diff --git a/server/modules/include/readwritesplit.h b/server/modules/routing/readwritesplit/readwritesplit.h similarity index 100% rename from server/modules/include/readwritesplit.h rename to server/modules/routing/readwritesplit/readwritesplit.h diff --git a/server/modules/include/rwsplit_internal.h b/server/modules/routing/readwritesplit/rwsplit_internal.h similarity index 100% rename from server/modules/include/rwsplit_internal.h rename to server/modules/routing/readwritesplit/rwsplit_internal.h diff --git a/server/modules/routing/readwritesplit/rwsplit_mysql.c b/server/modules/routing/readwritesplit/rwsplit_mysql.c index 72228395a..d7ff0ca95 100644 --- a/server/modules/routing/readwritesplit/rwsplit_mysql.c +++ b/server/modules/routing/readwritesplit/rwsplit_mysql.c @@ -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 #include -#include -#include +#include "readwritesplit.h" +#include "rwsplit_internal.h" #include #include diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.c b/server/modules/routing/readwritesplit/rwsplit_route_stmt.c index bbf690b14..73f0120f0 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.c +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.c @@ -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 #include -#include -#include +#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 diff --git a/server/modules/routing/readwritesplit/rwsplit_select_backends.c b/server/modules/routing/readwritesplit/rwsplit_select_backends.c index 114e118fb..1198dec52 100644 --- a/server/modules/routing/readwritesplit/rwsplit_select_backends.c +++ b/server/modules/routing/readwritesplit/rwsplit_select_backends.c @@ -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 #include -#include -#include +#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 diff --git a/server/modules/routing/readwritesplit/rwsplit_session_cmd.c b/server/modules/routing/readwritesplit/rwsplit_session_cmd.c index ddfc0987d..b37951543 100644 --- a/server/modules/routing/readwritesplit/rwsplit_session_cmd.c +++ b/server/modules/routing/readwritesplit/rwsplit_session_cmd.c @@ -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 #include -#include -#include +#include "readwritesplit.h" +#include "rwsplit_internal.h" /** * @file rwsplit_session_cmd.c The functions that provide session command diff --git a/server/modules/routing/readwritesplit/rwsplit_tmp_table_multi.c b/server/modules/routing/readwritesplit/rwsplit_tmp_table_multi.c index 41d9e8526..a82945982 100644 --- a/server/modules/routing/readwritesplit/rwsplit_tmp_table_multi.c +++ b/server/modules/routing/readwritesplit/rwsplit_tmp_table_multi.c @@ -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 #include -#include -#include +#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 diff --git a/server/modules/routing/schemarouter/schemarouter.c b/server/modules/routing/schemarouter/schemarouter.c index 35882d9f9..895dd0388 100644 --- a/server/modules/routing/schemarouter/schemarouter.c +++ b/server/modules/routing/schemarouter/schemarouter.c @@ -17,8 +17,8 @@ #include #include #include -#include -#include +#include "schemarouter.h" +#include "sharding_common.h" #include #include #include diff --git a/server/modules/include/schemarouter.h b/server/modules/routing/schemarouter/schemarouter.h similarity index 100% rename from server/modules/include/schemarouter.h rename to server/modules/routing/schemarouter/schemarouter.h diff --git a/server/modules/routing/schemarouter/sharding_common.c b/server/modules/routing/schemarouter/sharding_common.c index 1c6fa75fc..43104a4b1 100644 --- a/server/modules/routing/schemarouter/sharding_common.c +++ b/server/modules/routing/schemarouter/sharding_common.c @@ -11,7 +11,7 @@ * Public License. */ -#include +#include "sharding_common.h" #include #include diff --git a/server/modules/include/sharding_common.h b/server/modules/routing/schemarouter/sharding_common.h similarity index 100% rename from server/modules/include/sharding_common.h rename to server/modules/routing/schemarouter/sharding_common.h diff --git a/server/modules/routing/schemarouter/svcconn.c b/server/modules/routing/schemarouter/svcconn.c deleted file mode 100644 index c88a29072..000000000 --- a/server/modules/routing/schemarouter/svcconn.c +++ /dev/null @@ -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 - -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; -}