MXS-2013 Remove all CHK_-macros
This commit is contained in:
@ -468,7 +468,6 @@ static inline void prepare_for_write(DCB *dcb, GWBUF *buffer)
|
||||
static int
|
||||
gw_read_backend_event(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
if (dcb->persistentstart)
|
||||
{
|
||||
/** If a DCB gets a read event when it's in the persistent pool, it is
|
||||
@ -483,10 +482,7 @@ gw_read_backend_event(DCB *dcb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
CHK_SESSION(dcb->session);
|
||||
|
||||
MySQLProtocol *proto = (MySQLProtocol *)dcb->protocol;
|
||||
CHK_PROTOCOL(proto);
|
||||
|
||||
MXS_DEBUG("Read dcb %p fd %d protocol state %d, %s.", dcb, dcb->fd,
|
||||
proto->protocol_auth_state, STRPROTOCOLSTATE(proto->protocol_auth_state));
|
||||
@ -611,7 +607,6 @@ static void do_handle_error(DCB *dcb, mxs_error_action_t action, const char *err
|
||||
static void gw_reply_on_error(DCB *dcb, mxs_auth_state_t state)
|
||||
{
|
||||
MXS_SESSION *session = dcb->session;
|
||||
CHK_SESSION(session);
|
||||
|
||||
do_handle_error(dcb, ERRACT_REPLY_CLIENT,
|
||||
"Authentication with backend failed. Session will be closed.");
|
||||
@ -637,8 +632,6 @@ static inline bool session_ok_to_route(DCB *dcb)
|
||||
|
||||
if (client_protocol)
|
||||
{
|
||||
CHK_PROTOCOL(client_protocol);
|
||||
|
||||
if (client_protocol->protocol_auth_state == MXS_AUTH_STATE_COMPLETE)
|
||||
{
|
||||
rval = true;
|
||||
@ -776,8 +769,6 @@ gw_read_and_write(DCB *dcb)
|
||||
int nbytes_read;
|
||||
int return_code = 0;
|
||||
|
||||
CHK_SESSION(session);
|
||||
|
||||
/* read available backend data */
|
||||
return_code = dcb_read(dcb, &read_buffer, 0);
|
||||
|
||||
@ -1114,8 +1105,6 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
MySQLProtocol *backend_protocol = static_cast<MySQLProtocol*>(dcb->protocol);
|
||||
int rc = 0;
|
||||
|
||||
CHK_DCB(dcb);
|
||||
|
||||
if (dcb->was_persistent)
|
||||
{
|
||||
ss_dassert(!dcb->fakeq);
|
||||
@ -1284,9 +1273,7 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
*/
|
||||
static int gw_error_backend_event(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
MXS_SESSION *session = dcb->session;
|
||||
CHK_SESSION(session);
|
||||
|
||||
if (session->state == SESSION_STATE_DUMMY)
|
||||
{
|
||||
@ -1337,9 +1324,7 @@ static int gw_error_backend_event(DCB *dcb)
|
||||
*/
|
||||
static int gw_backend_hangup(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
MXS_SESSION *session = dcb->session;
|
||||
CHK_SESSION(session);
|
||||
|
||||
if (dcb->persistentstart)
|
||||
{
|
||||
@ -1374,7 +1359,6 @@ static int gw_backend_hangup(DCB *dcb)
|
||||
*/
|
||||
static int gw_backend_close(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
ss_dassert(dcb->session);
|
||||
|
||||
/** Send COM_QUIT to the backend being closed */
|
||||
@ -1385,7 +1369,6 @@ static int gw_backend_close(DCB *dcb)
|
||||
mysql_protocol_done(dcb);
|
||||
|
||||
MXS_SESSION* session = dcb->session;
|
||||
CHK_SESSION(session);
|
||||
|
||||
/**
|
||||
* If session state is SESSION_STATE_STOPPING, start closing client session.
|
||||
|
@ -421,7 +421,6 @@ int gw_read_client_event(DCB* dcb)
|
||||
uint32_t nbytes_read = 0;
|
||||
uint32_t max_bytes = 0;
|
||||
|
||||
CHK_DCB(dcb);
|
||||
if (dcb->dcb_role != DCB_ROLE_CLIENT_HANDLER)
|
||||
{
|
||||
MXS_ERROR("DCB must be a client handler for MySQL client protocol.");
|
||||
@ -429,7 +428,6 @@ int gw_read_client_event(DCB* dcb)
|
||||
}
|
||||
|
||||
protocol = (MySQLProtocol *)dcb->protocol;
|
||||
CHK_PROTOCOL(protocol);
|
||||
|
||||
MXS_DEBUG("Protocol state: %s", gw_mysql_protocol_state2string(protocol->protocol_auth_state));
|
||||
|
||||
@ -740,7 +738,6 @@ gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
|
||||
|
||||
if (session != NULL)
|
||||
{
|
||||
CHK_SESSION(session);
|
||||
ss_dassert(session->state != SESSION_STATE_ALLOC &&
|
||||
session->state != SESSION_STATE_DUMMY);
|
||||
// For the time being only the sql_mode is stored in MXS_SESSION::client_protocol_data.
|
||||
@ -1015,7 +1012,6 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
|
||||
uint64_t capabilities = 0;
|
||||
|
||||
session = dcb->session;
|
||||
CHK_SESSION(session);
|
||||
session_state_value = session->state;
|
||||
if (session_state_value != SESSION_STATE_ROUTER_READY)
|
||||
{
|
||||
@ -1156,7 +1152,6 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities)
|
||||
MXS_SESSION *session = dcb->session;
|
||||
uint8_t *payload = GWBUF_DATA(read_buffer);
|
||||
MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol;
|
||||
CHK_PROTOCOL(proto);
|
||||
int return_code = 0;
|
||||
|
||||
/** Reset error handler when routing of the new query begins */
|
||||
@ -1309,8 +1304,6 @@ int gw_write_client_event(DCB *dcb)
|
||||
{
|
||||
MySQLProtocol *protocol = NULL;
|
||||
|
||||
CHK_DCB(dcb);
|
||||
|
||||
ss_dassert(dcb->state != DCB_STATE_DISCONNECTED);
|
||||
|
||||
if (dcb == NULL)
|
||||
@ -1328,7 +1321,6 @@ int gw_write_client_event(DCB *dcb)
|
||||
goto return_1;
|
||||
}
|
||||
protocol = (MySQLProtocol *)dcb->protocol;
|
||||
CHK_PROTOCOL(protocol);
|
||||
|
||||
if (protocol->protocol_auth_state == MXS_AUTH_STATE_COMPLETE)
|
||||
{
|
||||
@ -1337,13 +1329,6 @@ int gw_write_client_event(DCB *dcb)
|
||||
}
|
||||
|
||||
return_1:
|
||||
#if defined(SS_DEBUG)
|
||||
if (dcb->state == DCB_STATE_POLLING ||
|
||||
dcb->state == DCB_STATE_NOPOLLING)
|
||||
{
|
||||
CHK_PROTOCOL(protocol);
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1381,8 +1366,6 @@ int gw_MySQLAccept(DCB *listener)
|
||||
{
|
||||
DCB *client_dcb;
|
||||
|
||||
CHK_DCB(listener);
|
||||
|
||||
while ((client_dcb = dcb_accept(listener)) != NULL)
|
||||
{
|
||||
gw_process_one_new_client(client_dcb);
|
||||
@ -1396,7 +1379,6 @@ static void gw_process_one_new_client(DCB *client_dcb)
|
||||
{
|
||||
MySQLProtocol *protocol;
|
||||
|
||||
CHK_DCB(client_dcb);
|
||||
protocol = mysql_protocol_init(client_dcb, client_dcb->fd);
|
||||
|
||||
if (protocol == NULL)
|
||||
@ -1406,7 +1388,6 @@ static void gw_process_one_new_client(DCB *client_dcb)
|
||||
MXS_ERROR("Failed to create protocol object for client connection.");
|
||||
return;
|
||||
}
|
||||
CHK_PROTOCOL(protocol);
|
||||
client_dcb->protocol = protocol;
|
||||
|
||||
//send handshake to the client_dcb
|
||||
@ -1449,8 +1430,6 @@ static int gw_error_client_event(DCB* dcb)
|
||||
{
|
||||
MXS_SESSION* session;
|
||||
|
||||
CHK_DCB(dcb);
|
||||
|
||||
session = dcb->session;
|
||||
|
||||
if (session != NULL && session->state == SESSION_STATE_STOPPING)
|
||||
@ -1469,7 +1448,6 @@ retblock:
|
||||
|
||||
static int gw_client_close(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
ss_dassert(dcb->protocol);
|
||||
|
||||
if (mysql_protocol_done(dcb))
|
||||
@ -1500,12 +1478,10 @@ static int gw_client_close(DCB *dcb)
|
||||
*/
|
||||
static int gw_client_hangup_event(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
MXS_SESSION* session = dcb->session;
|
||||
|
||||
if (session)
|
||||
{
|
||||
CHK_SESSION(session);
|
||||
if (session->state != SESSION_STATE_DUMMY && !session_valid_for_pool(session))
|
||||
{
|
||||
if (session_get_dump_statements() == SESSION_DUMP_STATEMENTS_ON_ERROR)
|
||||
@ -1638,7 +1614,6 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
|
||||
// TODO: Do this only when RCAP_TYPE_CONTIGUOUS_INPUT is requested
|
||||
packetbuf = gwbuf_make_contiguous(packetbuf);
|
||||
|
||||
CHK_GWBUF(packetbuf);
|
||||
MySQLProtocol* proto = (MySQLProtocol*)session->client_dcb->protocol;
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,6 @@ MySQLProtocol* mysql_protocol_init(DCB* dcb, int fd)
|
||||
p->fd = fd;
|
||||
p->owner_dcb = dcb;
|
||||
p->protocol_state = MYSQL_PROTOCOL_ACTIVE;
|
||||
CHK_PROTOCOL(p);
|
||||
return_p:
|
||||
return p;
|
||||
}
|
||||
@ -155,7 +154,6 @@ int mysql_send_com_quit(DCB* dcb,
|
||||
GWBUF *buf;
|
||||
int nbytes = 0;
|
||||
|
||||
CHK_DCB(dcb);
|
||||
ss_dassert(packet_number <= 255);
|
||||
|
||||
if (dcb == NULL)
|
||||
@ -585,8 +583,6 @@ bool read_complete_packet(DCB *dcb, GWBUF **readbuf)
|
||||
bool gw_get_shared_session_auth_info(DCB* dcb, MYSQL_session* session)
|
||||
{
|
||||
bool rval = true;
|
||||
CHK_DCB(dcb);
|
||||
CHK_SESSION(dcb->session);
|
||||
|
||||
if (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER)
|
||||
{
|
||||
|
Reference in New Issue
Block a user