query_classifier.cc:cleaned up some intendentions and brackets.
dbshard.h:removed unnecessary code dbshard.c:removed unnecessary code, cleaned up a bit and made some required changes readwritesplit.c:removed two unnecessary variable assignments.
This commit is contained in:
@ -1441,11 +1441,14 @@ char* skygw_get_qtype_str(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of strings of databases that this query uses.
|
* Returns an array of strings of databases that this query uses.
|
||||||
* If the database isn't defined in the query, it is assumed that this query only targets the current database.
|
* If the database isn't defined in the query, it is assumed that this query
|
||||||
* The value of @p size is set to the number of allocated strings. The caller is responsible for freeing all the allocated memory.
|
* only targets the current database.
|
||||||
|
* The value of @p size is set to the number of allocated strings. The caller is
|
||||||
|
* responsible for freeing all the allocated memory.
|
||||||
* @param querybuf GWBUF containing the query
|
* @param querybuf GWBUF containing the query
|
||||||
* @param size Size of the resulting array
|
* @param size Size of the resulting array
|
||||||
* @return A new array of strings containing the database names or NULL if no databases were found.
|
* @return A new array of strings containing the database names or NULL if no
|
||||||
|
* databases were found.
|
||||||
*/
|
*/
|
||||||
char** skygw_get_database_names(GWBUF* querybuf,int* size)
|
char** skygw_get_database_names(GWBUF* querybuf,int* size)
|
||||||
{
|
{
|
||||||
@ -1461,15 +1464,21 @@ char** skygw_get_database_names(GWBUF* querybuf,int* size)
|
|||||||
|
|
||||||
lex->current_select = lex->all_selects_list;
|
lex->current_select = lex->all_selects_list;
|
||||||
|
|
||||||
|
while(lex->current_select)
|
||||||
while(lex->current_select){
|
{
|
||||||
tbl = lex->current_select->join_list->head();
|
tbl = lex->current_select->join_list->head();
|
||||||
while(tbl)
|
while(tbl)
|
||||||
{
|
{
|
||||||
if(strcmp(tbl->db,"skygw_virtual") != 0){
|
if(strcmp(tbl->db,"skygw_virtual") != 0)
|
||||||
if(i>= currsz){
|
{
|
||||||
tmp = (char**)realloc(databases,sizeof(char*)*(currsz*2 + 1));
|
if(i>= currsz)
|
||||||
if(tmp == NULL) goto retblock;
|
{
|
||||||
|
tmp = (char**)realloc(databases,
|
||||||
|
sizeof(char*)*(currsz*2 + 1));
|
||||||
|
if(tmp == NULL)
|
||||||
|
{
|
||||||
|
goto retblock;
|
||||||
|
}
|
||||||
databases = tmp;
|
databases = tmp;
|
||||||
currsz = currsz*2 + 1;
|
currsz = currsz*2 + 1;
|
||||||
}
|
}
|
||||||
@ -1477,7 +1486,6 @@ char** skygw_get_database_names(GWBUF* querybuf,int* size)
|
|||||||
}
|
}
|
||||||
tbl=tbl->next_local;
|
tbl=tbl->next_local;
|
||||||
}
|
}
|
||||||
|
|
||||||
lex->current_select = lex->current_select->next_select_in_list();
|
lex->current_select = lex->current_select->next_select_in_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,15 +75,16 @@ struct router_instance;
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TARGET_UNDEFINED = 0x00,
|
TARGET_UNDEFINED = 0x00,
|
||||||
TARGET_SINGLE = 0x01,
|
TARGET_MASTER = 0x01,
|
||||||
TARGET_ALL = 0x02
|
TARGET_SLAVE = 0x02,
|
||||||
|
TARGET_NAMED_SERVER = 0x04,
|
||||||
|
TARGET_ALL = 0x08,
|
||||||
|
TARGET_RLAG_MAX = 0x10
|
||||||
} route_target_t;
|
} route_target_t;
|
||||||
|
|
||||||
#define TARGET_IS_MASTER(t) (t & TARGET_MASTER)
|
|
||||||
#define TARGET_IS_SLAVE(t) (t & TARGET_SLAVE)
|
|
||||||
#define TARGET_IS_NAMED_SERVER(t) (t & TARGET_NAMED_SERVER)
|
#define TARGET_IS_NAMED_SERVER(t) (t & TARGET_NAMED_SERVER)
|
||||||
#define TARGET_IS_ALL(t) (t & TARGET_ALL)
|
#define TARGET_IS_ALL(t) (t & TARGET_ALL)
|
||||||
#define TARGET_IS_RLAG_MAX(t) (t & TARGET_RLAG_MAX)
|
|
||||||
|
|
||||||
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;
|
||||||
@ -97,24 +98,6 @@ typedef enum rses_property_type_t {
|
|||||||
RSES_PROP_TYPE_COUNT=RSES_PROP_TYPE_LAST+1
|
RSES_PROP_TYPE_COUNT=RSES_PROP_TYPE_LAST+1
|
||||||
} rses_property_type_t;
|
} rses_property_type_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This criteria is used when backends are chosen for a router session's use.
|
|
||||||
* Backend servers are sorted to ascending order according to the criteria
|
|
||||||
* and top N are chosen.
|
|
||||||
*/
|
|
||||||
typedef enum select_criteria {
|
|
||||||
UNDEFINED_CRITERIA=0,
|
|
||||||
LEAST_GLOBAL_CONNECTIONS, /*< all connections established by MaxScale */
|
|
||||||
LEAST_ROUTER_CONNECTIONS, /*< connections established by this router */
|
|
||||||
LEAST_BEHIND_MASTER,
|
|
||||||
LEAST_CURRENT_OPERATIONS,
|
|
||||||
DEFAULT_CRITERIA=LEAST_CURRENT_OPERATIONS,
|
|
||||||
LAST_CRITERIA /*< not used except for an index */
|
|
||||||
} select_criteria_t;
|
|
||||||
|
|
||||||
|
|
||||||
/** default values for rwsplit configuration parameters */
|
/** default values for rwsplit configuration parameters */
|
||||||
#define CONFIG_MAX_SLAVE_CONN 1
|
#define CONFIG_MAX_SLAVE_CONN 1
|
||||||
#define CONFIG_MAX_SLAVE_RLAG -1 /*< not used */
|
#define CONFIG_MAX_SLAVE_RLAG -1 /*< not used */
|
||||||
@ -229,11 +212,9 @@ typedef struct backend_ref_st {
|
|||||||
} backend_ref_t;
|
} backend_ref_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct rwsplit_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;
|
||||||
select_criteria_t rw_slave_select_criteria;
|
|
||||||
int rw_max_slave_replication_lag;
|
|
||||||
target_t rw_use_sql_variables_in;
|
target_t rw_use_sql_variables_in;
|
||||||
} rwsplit_config_t;
|
} rwsplit_config_t;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3220,8 +3220,6 @@ static bool select_connect_backend_servers(
|
|||||||
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
|
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
master_connected = false;
|
|
||||||
slaves_connected = 0;
|
|
||||||
}
|
}
|
||||||
return_succp:
|
return_succp:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user