Added more doxygen documentation.
This commit is contained in:
@ -33,32 +33,21 @@
|
|||||||
#include <hashtable.h>
|
#include <hashtable.h>
|
||||||
#include <mysql_client_server_protocol.h>
|
#include <mysql_client_server_protocol.h>
|
||||||
|
|
||||||
#undef PREP_STMT_CACHING
|
/**
|
||||||
|
* Bitmask values for the router session's initialization. These values are used
|
||||||
#if defined(PREP_STMT_CACHING)
|
* to prevent responses from internal commands being forwarded to the client.
|
||||||
|
*/
|
||||||
typedef enum prep_stmt_type {
|
typedef enum init_mask
|
||||||
PREP_STMT_NAME,
|
|
||||||
PREP_STMT_ID
|
|
||||||
} prep_stmt_type_t;
|
|
||||||
|
|
||||||
typedef enum prep_stmt_state {
|
|
||||||
PREP_STMT_ALLOC,
|
|
||||||
PREP_STMT_SENT,
|
|
||||||
PREP_STMT_RECV,
|
|
||||||
PREP_STMT_DROPPED
|
|
||||||
} prep_stmt_state_t;
|
|
||||||
|
|
||||||
#endif /*< PREP_STMT_CACHING */
|
|
||||||
|
|
||||||
typedef enum init_state
|
|
||||||
{
|
{
|
||||||
INIT_READY = 0x0,
|
INIT_READY = 0x0,
|
||||||
INIT_MAPPING = 0x1,
|
INIT_MAPPING = 0x1,
|
||||||
INIT_USE_DB = 0x02
|
INIT_USE_DB = 0x02
|
||||||
|
|
||||||
} init_state_t;
|
} init_mask_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The state of the backend server reference
|
||||||
|
*/
|
||||||
typedef enum bref_state {
|
typedef enum bref_state {
|
||||||
BREF_IN_USE = 0x01,
|
BREF_IN_USE = 0x01,
|
||||||
BREF_WAITING_RESULT = 0x02, /*< for session commands only */
|
BREF_WAITING_RESULT = 0x02, /*< for session commands only */
|
||||||
@ -73,6 +62,10 @@ typedef enum bref_state {
|
|||||||
#define BREF_IS_QUERY_ACTIVE(s) ((s)->bref_state & BREF_QUERY_ACTIVE)
|
#define BREF_IS_QUERY_ACTIVE(s) ((s)->bref_state & BREF_QUERY_ACTIVE)
|
||||||
#define BREF_IS_CLOSED(s) ((s)->bref_state & BREF_CLOSED)
|
#define BREF_IS_CLOSED(s) ((s)->bref_state & BREF_CLOSED)
|
||||||
#define BREF_IS_MAPPED(s) ((s)->bref_mapped)
|
#define BREF_IS_MAPPED(s) ((s)->bref_mapped)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of the backend server
|
||||||
|
*/
|
||||||
typedef enum backend_type_t {
|
typedef enum backend_type_t {
|
||||||
BE_UNDEFINED=-1,
|
BE_UNDEFINED=-1,
|
||||||
BE_MASTER,
|
BE_MASTER,
|
||||||
@ -83,6 +76,9 @@ typedef enum backend_type_t {
|
|||||||
|
|
||||||
struct router_instance;
|
struct router_instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Route target types
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TARGET_UNDEFINED = 0x00,
|
TARGET_UNDEFINED = 0x00,
|
||||||
TARGET_MASTER = 0x01,
|
TARGET_MASTER = 0x01,
|
||||||
@ -101,6 +97,9 @@ typedef enum {
|
|||||||
typedef struct rses_property_st rses_property_t;
|
typedef struct rses_property_st rses_property_t;
|
||||||
typedef struct router_client_session ROUTER_CLIENT_SES;
|
typedef struct router_client_session ROUTER_CLIENT_SES;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Router session properties
|
||||||
|
*/
|
||||||
typedef enum rses_property_type_t {
|
typedef enum rses_property_type_t {
|
||||||
RSES_PROP_TYPE_UNDEFINED=-1,
|
RSES_PROP_TYPE_UNDEFINED=-1,
|
||||||
RSES_PROP_TYPE_SESCMD=0,
|
RSES_PROP_TYPE_SESCMD=0,
|
||||||
@ -132,10 +131,10 @@ typedef struct mysql_sescmd_st {
|
|||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t my_sescmd_chk_top;
|
skygw_chk_t my_sescmd_chk_top;
|
||||||
#endif
|
#endif
|
||||||
rses_property_t* my_sescmd_prop; /*< parent property */
|
rses_property_t* my_sescmd_prop; /*< Parent property */
|
||||||
GWBUF* my_sescmd_buf; /*< query buffer */
|
GWBUF* my_sescmd_buf; /*< Query buffer */
|
||||||
unsigned char my_sescmd_packet_type;/*< packet type */
|
unsigned char my_sescmd_packet_type;/*< Packet type */
|
||||||
bool my_sescmd_is_replied; /*< is cmd replied to client */
|
bool my_sescmd_is_replied; /*< Is cmd replied to client */
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t my_sescmd_chk_tail;
|
skygw_chk_t my_sescmd_chk_tail;
|
||||||
#endif
|
#endif
|
||||||
@ -149,14 +148,14 @@ struct rses_property_st {
|
|||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t rses_prop_chk_top;
|
skygw_chk_t rses_prop_chk_top;
|
||||||
#endif
|
#endif
|
||||||
ROUTER_CLIENT_SES* rses_prop_rsession; /*< parent router session */
|
ROUTER_CLIENT_SES* rses_prop_rsession; /*< Parent router session */
|
||||||
int rses_prop_refcount;
|
int rses_prop_refcount; /*< Reference count*/
|
||||||
rses_property_type_t rses_prop_type;
|
rses_property_type_t rses_prop_type; /*< Property type */
|
||||||
union rses_prop_data {
|
union rses_prop_data {
|
||||||
mysql_sescmd_t sescmd;
|
mysql_sescmd_t sescmd; /*< Session commands */
|
||||||
HASHTABLE* temp_tables;
|
HASHTABLE* temp_tables; /*< Hashtable of table names */
|
||||||
} rses_prop_data;
|
} rses_prop_data;
|
||||||
rses_property_t* rses_prop_next; /*< next property of same type */
|
rses_property_t* rses_prop_next; /*< Next property of same type */
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t rses_prop_chk_tail;
|
skygw_chk_t rses_prop_chk_tail;
|
||||||
#endif
|
#endif
|
||||||
@ -212,24 +211,26 @@ typedef struct backend_ref_st {
|
|||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t bref_chk_top;
|
skygw_chk_t bref_chk_top;
|
||||||
#endif
|
#endif
|
||||||
BACKEND* bref_backend;
|
BACKEND* bref_backend; /*< Backend server */
|
||||||
DCB* bref_dcb;
|
DCB* bref_dcb; /*< Backend DCB */
|
||||||
bref_state_t bref_state;
|
bref_state_t bref_state; /*< State of the backend */
|
||||||
bool bref_mapped;
|
bool bref_mapped; /*< Whether the backend has been mapped */
|
||||||
int bref_num_result_wait;
|
int bref_num_result_wait; /*< Number of not yet received results */
|
||||||
sescmd_cursor_t bref_sescmd_cur;
|
sescmd_cursor_t bref_sescmd_cur; /*< Session command cursor */
|
||||||
GWBUF* bref_pending_cmd; /*< For stmt which can't be routed due active sescmd execution */
|
GWBUF* bref_pending_cmd; /*< For stmt which can't be routed due active sescmd execution */
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t bref_chk_tail;
|
skygw_chk_t bref_chk_tail;
|
||||||
#endif
|
#endif
|
||||||
} backend_ref_t;
|
} backend_ref_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration values
|
||||||
|
*/
|
||||||
typedef struct dbshard_config_st {
|
typedef struct dbshard_config_st {
|
||||||
int rw_max_slave_conn_percent;
|
int rw_max_slave_conn_percent;
|
||||||
int rw_max_slave_conn_count;
|
int rw_max_slave_conn_count;
|
||||||
target_t rw_use_sql_variables_in;
|
target_t rw_use_sql_variables_in;
|
||||||
} rwsplit_config_t;
|
} dbshard_config_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -243,27 +244,24 @@ struct router_client_session {
|
|||||||
int rses_versno; /*< even = no active update, else odd. not used 4/14 */
|
int rses_versno; /*< even = no active update, else odd. not used 4/14 */
|
||||||
bool rses_closed; /*< true when closeSession is called */
|
bool rses_closed; /*< true when closeSession is called */
|
||||||
DCB* rses_client_dcb;
|
DCB* rses_client_dcb;
|
||||||
MYSQL_session* rses_mysql_session;
|
MYSQL_session* rses_mysql_session; /*< Session client data (username, password, SHA1). */
|
||||||
/** Properties listed by their type */
|
/** Properties listed by their type */
|
||||||
rses_property_t* rses_properties[RSES_PROP_TYPE_COUNT];
|
rses_property_t* rses_properties[RSES_PROP_TYPE_COUNT]; /*< Session properties */
|
||||||
backend_ref_t* rses_master_ref;
|
backend_ref_t* rses_master_ref; /*< Router session master reference */
|
||||||
backend_ref_t* rses_backend_ref; /*< Pointer to backend reference array */
|
backend_ref_t* rses_backend_ref; /*< Pointer to backend reference array */
|
||||||
rwsplit_config_t rses_config; /*< copied config info from router instance */
|
dbshard_config_t rses_config; /*< Copied config info from router instance */
|
||||||
int rses_nbackends;
|
int rses_nbackends; /*< Number of backends */
|
||||||
int rses_capabilities; /*< input type, for example */
|
int rses_capabilities; /*< Input type, for example */
|
||||||
bool rses_autocommit_enabled;
|
bool rses_autocommit_enabled; /*< Is autocommit enabled */
|
||||||
bool rses_transaction_active;
|
bool rses_transaction_active; /*< Is a transaction active */
|
||||||
#if defined(PREP_STMT_CACHING)
|
|
||||||
HASHTABLE* rses_prep_stmt[2];
|
|
||||||
#endif
|
|
||||||
struct router_instance *router; /*< The router instance */
|
struct router_instance *router; /*< The router instance */
|
||||||
struct router_client_session* next;
|
struct router_client_session* next; /*< List of router sessions */
|
||||||
HASHTABLE* dbhash;
|
HASHTABLE* dbhash; /*< Database hash containing names of the databases mapped to the servers that contain them */
|
||||||
char connect_db[MYSQL_DATABASE_MAXLEN+1];
|
char connect_db[MYSQL_DATABASE_MAXLEN+1]; /*< Database the user was trying to connect to */
|
||||||
init_state_t init;
|
init_mask_t init; /*< Initialization state bitmask */
|
||||||
GWBUF* queue;
|
GWBUF* queue; /*< Query that was received before the session was ready */
|
||||||
DCB* dcb_route;
|
DCB* dcb_route; /*< Internal DCB used to trigger re-routing of buffers */
|
||||||
DCB* dcb_reply;
|
DCB* dcb_reply; /*< Internal DCB used to send replies to the client */
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t rses_chk_tail;
|
skygw_chk_t rses_chk_tail;
|
||||||
#endif
|
#endif
|
||||||
@ -290,7 +288,7 @@ typedef struct router_instance {
|
|||||||
SPINLOCK lock; /*< Lock for the instance data */
|
SPINLOCK lock; /*< Lock for the instance data */
|
||||||
BACKEND** servers; /*< Backend servers */
|
BACKEND** servers; /*< Backend servers */
|
||||||
BACKEND* master; /*< NULL or pointer */
|
BACKEND* master; /*< NULL or pointer */
|
||||||
rwsplit_config_t dbshard_config; /*< expanded config info from SERVICE */
|
dbshard_config_t dbshard_config; /*< expanded config info from SERVICE */
|
||||||
int dbshard_version;/*< version number for router's config */
|
int dbshard_version;/*< version number for router's config */
|
||||||
unsigned int bitmask; /*< Bitmask to apply to server->status */
|
unsigned int bitmask; /*< Bitmask to apply to server->status */
|
||||||
unsigned int bitvalue; /*< Required value of server->status */
|
unsigned int bitvalue; /*< Required value of server->status */
|
||||||
|
|||||||
Reference in New Issue
Block a user