Change capabilities to uint64_t
- Since the capabilities are a bitmask, it is better if an unsigned integral type is used. - Since the function is part of an ABI, it is better if an explicit size is used. - 64-bits so that there also is room for independent filter capabilities.
This commit is contained in:
@ -82,7 +82,7 @@ typedef struct router_object
|
|||||||
DCB* backend_dcb,
|
DCB* backend_dcb,
|
||||||
error_action_t action,
|
error_action_t action,
|
||||||
bool* succp);
|
bool* succp);
|
||||||
int (*getCapabilities)();
|
uint64_t (*getCapabilities)();
|
||||||
} ROUTER_OBJECT;
|
} ROUTER_OBJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,7 +90,7 @@ typedef struct router_object
|
|||||||
* must update these versions numbers in accordance with the rules in
|
* must update these versions numbers in accordance with the rules in
|
||||||
* modinfo.h.
|
* modinfo.h.
|
||||||
*/
|
*/
|
||||||
#define ROUTER_VERSION { 1, 0, 0 }
|
#define ROUTER_VERSION { 2, 0, 0 }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Router capability type. Indicates what kind of input router accepts.
|
* Router capability type. Indicates what kind of input router accepts.
|
||||||
|
@ -89,7 +89,7 @@ static int route_by_statement(SESSION *, GWBUF **);
|
|||||||
static void mysql_client_auth_error_handling(DCB *dcb, int auth_val);
|
static void mysql_client_auth_error_handling(DCB *dcb, int auth_val);
|
||||||
static int gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
static int gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
||||||
static int gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
static int gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
||||||
static int gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint8_t capabilities);
|
static int gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities);
|
||||||
extern char* create_auth_fail_str(char *username, char *hostaddr, char *sha1, char *db, int);
|
extern char* create_auth_fail_str(char *username, char *hostaddr, char *sha1, char *db, int);
|
||||||
static bool ensure_complete_packet(DCB *dcb, GWBUF **read_buffer, int nbytes_read);
|
static bool ensure_complete_packet(DCB *dcb, GWBUF **read_buffer, int nbytes_read);
|
||||||
static void gw_process_one_new_client(DCB *client_dcb);
|
static void gw_process_one_new_client(DCB *client_dcb);
|
||||||
@ -780,7 +780,7 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
|
|||||||
{
|
{
|
||||||
SESSION *session;
|
SESSION *session;
|
||||||
session_state_t session_state_value;
|
session_state_t session_state_value;
|
||||||
uint8_t capabilities = 0;
|
uint64_t capabilities = 0;
|
||||||
|
|
||||||
session = dcb->session;
|
session = dcb->session;
|
||||||
CHK_SESSION(session);
|
CHK_SESSION(session);
|
||||||
@ -809,7 +809,7 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
|
|||||||
|
|
||||||
/** If the router requires statement input or we are still authenticating
|
/** If the router requires statement input or we are still authenticating
|
||||||
* we need to make sure that a complete SQL packet is read before continuing */
|
* we need to make sure that a complete SQL packet is read before continuing */
|
||||||
if (capabilities & (int)RCAP_TYPE_STMT_INPUT)
|
if (capabilities & RCAP_TYPE_STMT_INPUT)
|
||||||
{
|
{
|
||||||
uint8_t* data;
|
uint8_t* data;
|
||||||
int packet_size;
|
int packet_size;
|
||||||
@ -836,7 +836,7 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
|
|||||||
* @return 0 if succeed, 1 otherwise
|
* @return 0 if succeed, 1 otherwise
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint8_t capabilities)
|
gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities)
|
||||||
{
|
{
|
||||||
SESSION *session = dcb->session;
|
SESSION *session = dcb->session;
|
||||||
uint8_t *payload = GWBUF_DATA(read_buffer);
|
uint8_t *payload = GWBUF_DATA(read_buffer);
|
||||||
@ -847,7 +847,7 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint8_t capabilities)
|
|||||||
/** Reset error handler when routing of the new query begins */
|
/** Reset error handler when routing of the new query begins */
|
||||||
dcb->dcb_errhandle_called = false;
|
dcb->dcb_errhandle_called = false;
|
||||||
|
|
||||||
if (capabilities & (int)RCAP_TYPE_STMT_INPUT)
|
if (capabilities & RCAP_TYPE_STMT_INPUT)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Feed each statement completely and separately
|
* Feed each statement completely and separately
|
||||||
@ -865,7 +865,7 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint8_t capabilities)
|
|||||||
spinlock_release(&dcb->authlock);
|
spinlock_release(&dcb->authlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (NULL != session->router_session || (capabilities & (int)RCAP_TYPE_NO_RSESSION))
|
else if (NULL != session->router_session || (capabilities & RCAP_TYPE_NO_RSESSION))
|
||||||
{
|
{
|
||||||
/** Feed whole packet to router, which will free it
|
/** Feed whole packet to router, which will free it
|
||||||
* and return 1 for success, 0 for failure
|
* and return 1 for success, 0 for failure
|
||||||
|
@ -79,7 +79,7 @@ static void clientReply(ROUTER *instance, void *router_session, GWBUF *queue,
|
|||||||
DCB *backend_dcb);
|
DCB *backend_dcb);
|
||||||
static void errorReply(ROUTER *instance, void *router_session, GWBUF *message,
|
static void errorReply(ROUTER *instance, void *router_session, GWBUF *message,
|
||||||
DCB *backend_dcb, error_action_t action, bool *succp);
|
DCB *backend_dcb, error_action_t action, bool *succp);
|
||||||
static int getCapabilities();
|
static uint64_t getCapabilities();
|
||||||
extern int MaxScaleUptime();
|
extern int MaxScaleUptime();
|
||||||
extern void avro_get_used_tables(AVRO_INSTANCE *router, DCB *dcb);
|
extern void avro_get_used_tables(AVRO_INSTANCE *router, DCB *dcb);
|
||||||
void converter_func(void* data);
|
void converter_func(void* data);
|
||||||
@ -955,7 +955,7 @@ errorReply(ROUTER *instance, void *router_session, GWBUF *message, DCB *backend_
|
|||||||
ss_dassert(false);
|
ss_dassert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return RCAP_TYPE_NO_RSESSION;
|
return RCAP_TYPE_NO_RSESSION;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ static void errorReply(ROUTER *instance,
|
|||||||
error_action_t action,
|
error_action_t action,
|
||||||
bool *succp);
|
bool *succp);
|
||||||
|
|
||||||
static int getCapabilities();
|
static uint64_t getCapabilities();
|
||||||
static int blr_handler_config(void *userdata, const char *section, const char *name, const char *value);
|
static int blr_handler_config(void *userdata, const char *section, const char *name, const char *value);
|
||||||
static int blr_handle_config_item(const char *name, const char *value, ROUTER_INSTANCE *inst);
|
static int blr_handle_config_item(const char *name, const char *value, ROUTER_INSTANCE *inst);
|
||||||
static int blr_set_service_mysql_user(SERVICE *service);
|
static int blr_set_service_mysql_user(SERVICE *service);
|
||||||
@ -1788,9 +1788,9 @@ static void rses_end_locked_router_action(ROUTER_SLAVE *rses)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return (int)(RCAP_TYPE_NO_RSESSION | RCAP_TYPE_NO_USERS_INIT);
|
return (RCAP_TYPE_NO_RSESSION | RCAP_TYPE_NO_USERS_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +58,7 @@ static void closeSession(ROUTER *instance, void *router_session);
|
|||||||
static void freeSession(ROUTER *instance, void *router_session);
|
static void freeSession(ROUTER *instance, void *router_session);
|
||||||
static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
|
static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
|
||||||
static void diagnostics(ROUTER *instance, DCB *dcb);
|
static void diagnostics(ROUTER *instance, DCB *dcb);
|
||||||
static int getCapabilities();
|
static uint64_t getCapabilities();
|
||||||
|
|
||||||
/** The module object definition */
|
/** The module object definition */
|
||||||
static ROUTER_OBJECT MyObject =
|
static ROUTER_OBJECT MyObject =
|
||||||
@ -302,7 +302,7 @@ diagnostics(ROUTER *instance, DCB *dcb)
|
|||||||
return; /* Nothing to do currently */
|
return; /* Nothing to do currently */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ static void closeSession(ROUTER *instance, void *router_session);
|
|||||||
static void freeSession(ROUTER *instance, void *router_session);
|
static void freeSession(ROUTER *instance, void *router_session);
|
||||||
static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
|
static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
|
||||||
static void diagnostics(ROUTER *instance, DCB *dcb);
|
static void diagnostics(ROUTER *instance, DCB *dcb);
|
||||||
static int getCapabilities ();
|
static uint64_t getCapabilities ();
|
||||||
|
|
||||||
/** The module object definition */
|
/** The module object definition */
|
||||||
static ROUTER_OBJECT MyObject =
|
static ROUTER_OBJECT MyObject =
|
||||||
@ -333,7 +333,7 @@ diagnostics(ROUTER *instance, DCB *dcb)
|
|||||||
return; /* Nothing to do currently */
|
return; /* Nothing to do currently */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ static void closeSession(ROUTER *instance, void *router_session);
|
|||||||
static void freeSession(ROUTER *instance, void *router_session);
|
static void freeSession(ROUTER *instance, void *router_session);
|
||||||
static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
|
static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
|
||||||
static void diagnostics(ROUTER *instance, DCB *dcb);
|
static void diagnostics(ROUTER *instance, DCB *dcb);
|
||||||
static int getCapabilities();
|
static uint64_t getCapabilities();
|
||||||
static void handleError(ROUTER *instance,
|
static void handleError(ROUTER *instance,
|
||||||
void *router_session,
|
void *router_session,
|
||||||
GWBUF *errbuf,
|
GWBUF *errbuf,
|
||||||
@ -409,7 +409,7 @@ diagnostics(ROUTER *instance, DCB *dcb)
|
|||||||
*
|
*
|
||||||
* Not used for the maxinfo router
|
* Not used for the maxinfo router
|
||||||
*/
|
*/
|
||||||
static int
|
static uint64_t
|
||||||
getCapabilities()
|
getCapabilities()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -59,7 +59,6 @@ typedef struct router_client_session
|
|||||||
DCB *backend_dcb; /*< DCB Connection to the backend */
|
DCB *backend_dcb; /*< DCB Connection to the backend */
|
||||||
DCB *client_dcb; /**< Client DCB */
|
DCB *client_dcb; /**< Client DCB */
|
||||||
struct router_client_session *next;
|
struct router_client_session *next;
|
||||||
int rses_capabilities; /*< input type, for example */
|
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t rses_chk_tail;
|
skygw_chk_t rses_chk_tail;
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,7 +111,7 @@ static void clientReply(ROUTER *instance, void *router_session, GWBUF *queue,
|
|||||||
DCB *backend_dcb);
|
DCB *backend_dcb);
|
||||||
static void handleError(ROUTER *instance, void *router_session, GWBUF *errbuf,
|
static void handleError(ROUTER *instance, void *router_session, GWBUF *errbuf,
|
||||||
DCB *problem_dcb, error_action_t action, bool *succp);
|
DCB *problem_dcb, error_action_t action, bool *succp);
|
||||||
static int getCapabilities();
|
static uint64_t getCapabilities();
|
||||||
|
|
||||||
|
|
||||||
/** The module object definition */
|
/** The module object definition */
|
||||||
@ -561,8 +561,6 @@ newSession(ROUTER *instance, SESSION *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client_rses->rses_capabilities = RCAP_TYPE_PACKET_INPUT;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We now have the server with the least connections.
|
* We now have the server with the least connections.
|
||||||
* Bump the connection count for this server
|
* Bump the connection count for this server
|
||||||
@ -987,7 +985,7 @@ static void rses_end_locked_router_action(ROUTER_CLIENT_SES* rses)
|
|||||||
spinlock_release(&rses->rses_lock);
|
spinlock_release(&rses->rses_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return RCAP_TYPE_PACKET_INPUT;
|
return RCAP_TYPE_PACKET_INPUT;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ static void clientReply(ROUTER *instance, void *router_session, GWBUF *queue,
|
|||||||
static void handleError(ROUTER *instance, void *router_session,
|
static void handleError(ROUTER *instance, void *router_session,
|
||||||
GWBUF *errmsgbuf, DCB *backend_dcb,
|
GWBUF *errmsgbuf, DCB *backend_dcb,
|
||||||
error_action_t action, bool *succp);
|
error_action_t action, bool *succp);
|
||||||
static int getCapabilities();
|
static uint64_t getCapabilities();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* End of the API functions; now the module structure that links to them.
|
* End of the API functions; now the module structure that links to them.
|
||||||
@ -1055,14 +1055,14 @@ lock_failed:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get router capabilities (API)
|
* @brief Get router capabilities (API)
|
||||||
*
|
*
|
||||||
* Return a bit map indicating the characteristics of this particular router.
|
* Return a bit map indicating the characteristics of this particular router.
|
||||||
* In this case, the only bit set indicates that the router wants to receive
|
* In this case, the only bit set indicates that the router wants to receive
|
||||||
* data for routing as whole SQL statements.
|
* data for routing as whole SQL statements.
|
||||||
*
|
*
|
||||||
* @return int RCAP_TYPE_STMT_INPUT.
|
* @return RCAP_TYPE_STMT_INPUT.
|
||||||
*/
|
*/
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return RCAP_TYPE_STMT_INPUT;
|
return RCAP_TYPE_STMT_INPUT;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ static route_target_t get_shard_route_target(qc_query_type_t qtype,
|
|||||||
bool trx_active,
|
bool trx_active,
|
||||||
HINT* hint);
|
HINT* hint);
|
||||||
|
|
||||||
static int getCapabilities();
|
static uint64_t getCapabilities();
|
||||||
|
|
||||||
static bool connect_backend_servers(backend_ref_t* backend_ref,
|
static bool connect_backend_servers(backend_ref_t* backend_ref,
|
||||||
int router_nservers,
|
int router_nservers,
|
||||||
@ -3642,7 +3642,7 @@ static void tracelog_routed_query(ROUTER_CLIENT_SES* rses,
|
|||||||
/**
|
/**
|
||||||
* Return RCAP_TYPE_STMT_INPUT.
|
* Return RCAP_TYPE_STMT_INPUT.
|
||||||
*/
|
*/
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return RCAP_TYPE_STMT_INPUT;
|
return RCAP_TYPE_STMT_INPUT;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ static void freeSession(ROUTER *instance, void *session);
|
|||||||
static int routeQuery(ROUTER *instance, void *session, GWBUF *queue);
|
static int routeQuery(ROUTER *instance, void *session, GWBUF *queue);
|
||||||
static void clientReply(ROUTER *instance, void *session, GWBUF *queue, DCB*);
|
static void clientReply(ROUTER *instance, void *session, GWBUF *queue, DCB*);
|
||||||
static void diagnostic(ROUTER *instance, DCB *dcb);
|
static void diagnostic(ROUTER *instance, DCB *dcb);
|
||||||
static int getCapabilities ();
|
static uint64_t getCapabilities ();
|
||||||
static void handleError(ROUTER *instance,
|
static void handleError(ROUTER *instance,
|
||||||
void *router_session,
|
void *router_session,
|
||||||
GWBUF *errbuf,
|
GWBUF *errbuf,
|
||||||
@ -164,7 +164,7 @@ diagnostic(ROUTER *instance, DCB *dcb)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCapabilities()
|
static uint64_t getCapabilities()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ static void closeSession(ROUTER *instance, void *session);
|
|||||||
static void freeSession(ROUTER *instance, void *session);
|
static void freeSession(ROUTER *instance, void *session);
|
||||||
static int routeQuery(ROUTER *instance, void *session, GWBUF *queue);
|
static int routeQuery(ROUTER *instance, void *session, GWBUF *queue);
|
||||||
static void diagnostic(ROUTER *instance, DCB *dcb);
|
static void diagnostic(ROUTER *instance, DCB *dcb);
|
||||||
static uint8_t getCapabilities(ROUTER* inst, void* router_session);
|
static uint64_t getCapabilities(ROUTER* inst, void* router_session);
|
||||||
|
|
||||||
|
|
||||||
static ROUTER_OBJECT MyObject =
|
static ROUTER_OBJECT MyObject =
|
||||||
@ -257,7 +257,7 @@ diagnostic(ROUTER *instance, DCB *dcb)
|
|||||||
* @param router_session The router session
|
* @param router_session The router session
|
||||||
* @return Router capabilities bitmask
|
* @return Router capabilities bitmask
|
||||||
*/
|
*/
|
||||||
static uint8_t
|
static uint64_t
|
||||||
getCapabilities(ROUTER *inst, void *router_session)
|
getCapabilities(ROUTER *inst, void *router_session)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user