MXS-2013 Remove all CHK_-macros
This commit is contained in:
parent
8fd1648217
commit
ae43e4f0f2
@ -196,178 +196,4 @@ MXS_BEGIN_DECLS
|
||||
((r) == DCB_REASON_NOT_RESPONDING ? "DCB_REASON_NOT_RESPONDING" : \
|
||||
"Unknown DCB reason")))))))
|
||||
|
||||
#define CHK_MLIST(l) { \
|
||||
if (l->mlist_first == NULL) { \
|
||||
ss_info_dassert(l->mlist_nodecount == 0, \
|
||||
"List head is NULL but element counter is not zero."); \
|
||||
ss_info_dassert(l->mlist_last == NULL, \
|
||||
"List head is NULL but tail has node"); \
|
||||
} else { \
|
||||
ss_info_dassert(l->mlist_nodecount > 0, \
|
||||
"List head has node but element counter is not " \
|
||||
"positive."); \
|
||||
CHK_MLIST_NODE(l->mlist_first); \
|
||||
CHK_MLIST_NODE(l->mlist_last); \
|
||||
} \
|
||||
if (l->mlist_nodecount == 0) { \
|
||||
ss_info_dassert(l->mlist_first == NULL, \
|
||||
"Element counter is zero but head has node"); \
|
||||
ss_info_dassert(l->mlist_last == NULL, \
|
||||
"Element counter is zero but tail has node"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define CHK_MLIST_NODE(n) { \
|
||||
}
|
||||
|
||||
#define CHK_MLIST_CURSOR(c) { \
|
||||
ss_info_dassert(c->mlcursor_list != NULL, \
|
||||
"List cursor doesn't have list"); \
|
||||
ss_info_dassert(c->mlcursor_pos != NULL || \
|
||||
(c->mlcursor_pos == NULL && \
|
||||
c->mlcursor_list->mlist_first == NULL), \
|
||||
"List cursor doesn't have position"); \
|
||||
}
|
||||
|
||||
#define CHK_SLIST(l) { \
|
||||
if (l->slist_head == NULL) { \
|
||||
ss_info_dassert(l->slist_nelems == 0, \
|
||||
"List head is NULL but element counter is not zero."); \
|
||||
ss_info_dassert(l->slist_tail == NULL, \
|
||||
"List head is NULL but tail has node"); \
|
||||
} else { \
|
||||
ss_info_dassert(l->slist_nelems > 0, \
|
||||
"List head has node but element counter is not " \
|
||||
"positive."); \
|
||||
CHK_SLIST_NODE(l->slist_head); \
|
||||
CHK_SLIST_NODE(l->slist_tail); \
|
||||
} \
|
||||
if (l->slist_nelems == 0) { \
|
||||
ss_info_dassert(l->slist_head == NULL, \
|
||||
"Element counter is zero but head has node"); \
|
||||
ss_info_dassert(l->slist_tail == NULL, \
|
||||
"Element counter is zero but tail has node"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define CHK_SLIST_NODE(n) { \
|
||||
}
|
||||
|
||||
#define CHK_SLIST_CURSOR(c) { \
|
||||
ss_info_dassert(c->slcursor_list != NULL, \
|
||||
"List cursor doesn't have list"); \
|
||||
ss_info_dassert(c->slcursor_pos != NULL || \
|
||||
(c->slcursor_pos == NULL && \
|
||||
c->slcursor_list->slist_head == NULL), \
|
||||
"List cursor doesn't have position"); \
|
||||
}
|
||||
|
||||
#define CHK_QUERY_TEST(q) { \
|
||||
}
|
||||
|
||||
#define CHK_LOGFILE(lf) { \
|
||||
ss_info_dassert(lf->lf_filepath != NULL && \
|
||||
lf->lf_name_prefix != NULL && \
|
||||
lf->lf_name_suffix != NULL && \
|
||||
lf->lf_full_file_name != NULL, \
|
||||
"NULL in name variable\n"); \
|
||||
}
|
||||
|
||||
#define CHK_FILEWRITER(fwr) { \
|
||||
}
|
||||
|
||||
#define CHK_THREAD(thr) { \
|
||||
}
|
||||
|
||||
#define CHK_SIMPLE_MUTEX(sm) { \
|
||||
}
|
||||
|
||||
#define CHK_MESSAGE(mes) { \
|
||||
}
|
||||
|
||||
|
||||
#define CHK_MLIST_ISLOCKED(l) { \
|
||||
ss_info_dassert((l.mlist_uselock && l.mlist_islocked) || \
|
||||
!(l.mlist_uselock || l.mlist_islocked), \
|
||||
("mlist is not locked although it should.")); \
|
||||
CHK_MUTEXED_FOR_THR(l.mlist_uselock,l.mlist_rwlock); \
|
||||
}
|
||||
|
||||
#define CHK_MUTEXED_FOR_THR(b,l) { \
|
||||
ss_info_dassert(!b || \
|
||||
(b && (l->srw_rwlock_thr == pthread_self())), \
|
||||
"rwlock is not acquired although it should be."); \
|
||||
}
|
||||
|
||||
#define CHK_FNAMES_CONF(fn) { \
|
||||
}
|
||||
|
||||
#define CHK_LOGMANAGER(lm) { \
|
||||
}
|
||||
|
||||
#define CHK_FILE(f) { \
|
||||
}
|
||||
|
||||
|
||||
#define CHK_BLOCKBUF(bb) { \
|
||||
}
|
||||
|
||||
#define CHK_HASHTABLE(t) { \
|
||||
}
|
||||
|
||||
#define CHK_MANAGED_LIST(l) { \
|
||||
}
|
||||
|
||||
#define CHK_DCB(d) { \
|
||||
}
|
||||
|
||||
#define CHK_PROTOCOL(p) { \
|
||||
}
|
||||
|
||||
#define CHK_SESSION(s) { \
|
||||
}
|
||||
|
||||
#define CHK_SERVER(s) { \
|
||||
}
|
||||
|
||||
#define CHK_GWBUF(b) { \
|
||||
ss_info_dassert(((char *)(b)->start <= (char *)(b)->end), \
|
||||
"gwbuf start has passed the endpoint"); \
|
||||
}
|
||||
|
||||
#define CHK_CLIENT_RSES(r) { \
|
||||
}
|
||||
|
||||
#define CHK_RSES_PROP(p) { \
|
||||
}
|
||||
|
||||
#define CHK_MYSQL_SESCMD(s) { \
|
||||
}
|
||||
|
||||
#define CHK_SESCMD_CUR(c) { \
|
||||
}
|
||||
|
||||
#define CHK_BACKEND(b) { \
|
||||
}
|
||||
|
||||
#define CHK_BACKEND_REF(r) { \
|
||||
}
|
||||
|
||||
#define CHK_PREP_STMT(p) { \
|
||||
}
|
||||
|
||||
#define CHK_PARSING_INFO(p) { \
|
||||
}
|
||||
|
||||
#define CHK_MYSQL_SESSION(s) { \
|
||||
}
|
||||
|
||||
#define CHK_ADMIN_SESSION(s) { \
|
||||
}
|
||||
|
||||
|
||||
MXS_END_DECLS
|
||||
|
@ -359,7 +359,6 @@ static bool parse_query(GWBUF* querybuf)
|
||||
char* query_str = NULL;
|
||||
parsing_info_t* pi;
|
||||
|
||||
CHK_GWBUF(querybuf);
|
||||
/** Do not parse without releasing previous parse info first */
|
||||
ss_dassert(!query_is_parsed(querybuf));
|
||||
|
||||
@ -440,7 +439,6 @@ retblock:
|
||||
*/
|
||||
static bool query_is_parsed(GWBUF* buf)
|
||||
{
|
||||
CHK_GWBUF(buf);
|
||||
return (buf != NULL && GWBUF_IS_PARSED(buf));
|
||||
}
|
||||
|
||||
@ -1804,7 +1802,6 @@ static void parsing_info_done(void* ptr)
|
||||
static void parsing_info_set_plain_str(void* ptr, char* str)
|
||||
{
|
||||
parsing_info_t* pi = (parsing_info_t *) ptr;
|
||||
CHK_PARSING_INFO(pi);
|
||||
|
||||
pi->pi_query_plain_str = str;
|
||||
}
|
||||
|
@ -51,8 +51,6 @@ void Backend::close(close_type type)
|
||||
|
||||
if (in_use())
|
||||
{
|
||||
CHK_DCB(m_dcb);
|
||||
|
||||
/** Clean operation counter in bref and in SERVER */
|
||||
if (is_waiting_result())
|
||||
{
|
||||
@ -85,8 +83,6 @@ bool Backend::execute_session_command()
|
||||
return false;
|
||||
}
|
||||
|
||||
CHK_DCB(m_dcb);
|
||||
|
||||
SSessionCommand& sescmd = m_session_commands.front();
|
||||
GWBUF *buffer = sescmd->deep_copy_buffer();
|
||||
bool rval = false;
|
||||
|
@ -88,7 +88,6 @@ gwbuf_alloc(unsigned int size)
|
||||
rval->properties = NULL;
|
||||
rval->gwbuf_type = GWBUF_TYPE_UNDEFINED;
|
||||
rval->server = NULL;
|
||||
CHK_GWBUF(rval);
|
||||
retblock:
|
||||
if (rval == NULL)
|
||||
{
|
||||
@ -232,7 +231,6 @@ gwbuf_free(GWBUF *buf)
|
||||
|
||||
while (buf)
|
||||
{
|
||||
CHK_GWBUF(buf);
|
||||
nextbuf = buf->next;
|
||||
gwbuf_free_one(buf);
|
||||
buf = nextbuf;
|
||||
@ -311,7 +309,6 @@ gwbuf_clone_one(GWBUF *buf)
|
||||
rval->gwbuf_type = buf->gwbuf_type;
|
||||
rval->tail = rval;
|
||||
rval->next = NULL;
|
||||
CHK_GWBUF(rval);
|
||||
#if defined(BUFFER_TRACE)
|
||||
gwbuf_add_to_hashtable(rval);
|
||||
#endif
|
||||
@ -378,7 +375,6 @@ static GWBUF *gwbuf_clone_portion(GWBUF *buf,
|
||||
{
|
||||
GWBUF* clonebuf;
|
||||
|
||||
CHK_GWBUF(buf);
|
||||
ss_dassert(start_offset + length <= GWBUF_LENGTH(buf));
|
||||
|
||||
if ((clonebuf = (GWBUF *)MXS_MALLOC(sizeof(GWBUF))) == NULL)
|
||||
@ -396,7 +392,6 @@ static GWBUF *gwbuf_clone_portion(GWBUF *buf,
|
||||
clonebuf->hint = NULL;
|
||||
clonebuf->next = NULL;
|
||||
clonebuf->tail = clonebuf;
|
||||
CHK_GWBUF(clonebuf);
|
||||
#if defined(BUFFER_TRACE)
|
||||
gwbuf_add_to_hashtable(clonebuf);
|
||||
#endif
|
||||
@ -582,7 +577,6 @@ gwbuf_append(GWBUF *head, GWBUF *tail)
|
||||
{
|
||||
return head;
|
||||
}
|
||||
CHK_GWBUF(head);
|
||||
head->tail->next = tail;
|
||||
head->tail = tail->tail;
|
||||
|
||||
@ -594,7 +588,6 @@ gwbuf_consume(GWBUF *head, unsigned int length)
|
||||
{
|
||||
while (head && length > 0)
|
||||
{
|
||||
CHK_GWBUF(head);
|
||||
unsigned int buflen = GWBUF_LENGTH(head);
|
||||
|
||||
GWBUF_CONSUME(head, length);
|
||||
@ -623,7 +616,6 @@ gwbuf_length(const GWBUF *head)
|
||||
|
||||
if (head)
|
||||
{
|
||||
CHK_GWBUF(head);
|
||||
}
|
||||
while (head)
|
||||
{
|
||||
@ -649,9 +641,7 @@ GWBUF *
|
||||
gwbuf_rtrim(GWBUF *head, unsigned int n_bytes)
|
||||
{
|
||||
GWBUF *rval = head;
|
||||
CHK_GWBUF(head);
|
||||
GWBUF_RTRIM(head, n_bytes);
|
||||
CHK_GWBUF(head);
|
||||
|
||||
if (GWBUF_EMPTY(head))
|
||||
{
|
||||
@ -666,7 +656,6 @@ void gwbuf_set_type(GWBUF* buf, uint32_t type)
|
||||
/** Set type consistenly to all buffers on the list */
|
||||
while (buf != NULL)
|
||||
{
|
||||
CHK_GWBUF(buf);
|
||||
buf->gwbuf_type |= type;
|
||||
buf = buf->next;
|
||||
}
|
||||
@ -677,7 +666,6 @@ void gwbuf_add_buffer_object(GWBUF* buf,
|
||||
void* data,
|
||||
void (*donefun_fp)(void *))
|
||||
{
|
||||
CHK_GWBUF(buf);
|
||||
buffer_object_t* newb = (buffer_object_t *)MXS_MALLOC(sizeof(buffer_object_t));
|
||||
MXS_ABORT_IF_NULL(newb);
|
||||
|
||||
@ -699,8 +687,6 @@ void gwbuf_add_buffer_object(GWBUF* buf,
|
||||
|
||||
void* gwbuf_get_buffer_object_data(GWBUF* buf, bufobj_id_t id)
|
||||
{
|
||||
CHK_GWBUF(buf);
|
||||
|
||||
buffer_object_t* bo = buf->sbuf->bufobj;
|
||||
|
||||
while (bo != NULL && bo->bo_id != id)
|
||||
|
@ -223,7 +223,6 @@ dcb_alloc(dcb_role_t role, SERV_LISTENER *listener)
|
||||
static void
|
||||
dcb_final_free(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
ss_info_dassert(dcb->state == DCB_STATE_DISCONNECTED ||
|
||||
dcb->state == DCB_STATE_ALLOC,
|
||||
"dcb not in DCB_STATE_DISCONNECTED not in DCB_STATE_ALLOC state.");
|
||||
@ -235,7 +234,6 @@ dcb_final_free(DCB *dcb)
|
||||
*/
|
||||
MXS_SESSION *local_session = dcb->session;
|
||||
dcb->session = NULL;
|
||||
CHK_SESSION(local_session);
|
||||
if (SESSION_STATE_DUMMY != local_session->state)
|
||||
{
|
||||
if (dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER)
|
||||
@ -577,8 +575,6 @@ int dcb_read(DCB *dcb,
|
||||
return dcb_read_SSL(dcb, head);
|
||||
}
|
||||
|
||||
CHK_DCB(dcb);
|
||||
|
||||
if (dcb->fd <= 0)
|
||||
{
|
||||
MXS_ERROR("Read failed, dcb is closed.");
|
||||
@ -740,8 +736,6 @@ dcb_read_SSL(DCB *dcb, GWBUF **head)
|
||||
int nsingleread = 0, nreadtotal = 0;
|
||||
int start_length = gwbuf_length(*head);
|
||||
|
||||
CHK_DCB(dcb);
|
||||
|
||||
if (dcb->fd <= 0)
|
||||
{
|
||||
MXS_ERROR("Read failed, dcb is closed.");
|
||||
@ -1102,8 +1096,6 @@ static void log_illegal_dcb(DCB *dcb)
|
||||
*/
|
||||
void dcb_close(DCB *dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
|
||||
#if defined(SS_DEBUG)
|
||||
RoutingWorker* current = RoutingWorker::get_current();
|
||||
RoutingWorker* owner = static_cast<RoutingWorker*>(dcb->poll.owner);
|
||||
@ -1314,7 +1306,6 @@ dcb_maybe_add_persistent(DCB *dcb)
|
||||
{
|
||||
MXS_SESSION *local_session = dcb->session;
|
||||
session_set_dummy(dcb);
|
||||
CHK_SESSION(local_session);
|
||||
if (SESSION_STATE_DUMMY != local_session->state)
|
||||
{
|
||||
session_unlink_backend_dcb(local_session, dcb);
|
||||
@ -2047,11 +2038,9 @@ dcb_persistent_clean_count(DCB *dcb, int id, bool cleanall)
|
||||
DCB *persistentdcb, *nextdcb;
|
||||
DCB *disposals = NULL;
|
||||
|
||||
CHK_SERVER(server);
|
||||
persistentdcb = server->persistent[id];
|
||||
while (persistentdcb)
|
||||
{
|
||||
CHK_DCB(persistentdcb);
|
||||
nextdcb = persistentdcb->nextpersistent;
|
||||
if (cleanall
|
||||
|| persistentdcb-> dcb_errhandle_called
|
||||
@ -3000,8 +2989,6 @@ static uint32_t dcb_process_poll_events(DCB *dcb, uint32_t events)
|
||||
ss_dassert(owner == RoutingWorker::get_current() ||
|
||||
dcb->dcb_role == DCB_ROLE_SERVICE_LISTENER);
|
||||
|
||||
CHK_DCB(dcb);
|
||||
|
||||
uint32_t rc = MXS_POLL_NOP;
|
||||
|
||||
/* It isn't obvious that this is impossible */
|
||||
@ -3371,8 +3358,6 @@ dcb_session_check(DCB *dcb, const char *function)
|
||||
/** DCB Sanity checks */
|
||||
static inline void dcb_sanity_check(DCB* dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
|
||||
if (dcb->state == DCB_STATE_DISCONNECTED || dcb->state == DCB_STATE_UNDEFINED)
|
||||
{
|
||||
MXS_ERROR("[poll_add_dcb] Error : existing state of dcb %p "
|
||||
@ -3626,7 +3611,6 @@ int poll_remove_dcb(DCB *dcb)
|
||||
{
|
||||
int dcbfd, rc = 0;
|
||||
struct epoll_event ev;
|
||||
CHK_DCB(dcb);
|
||||
|
||||
/*< It is possible that dcb has already been removed from the set */
|
||||
if (dcb->state == DCB_STATE_NOPOLLING)
|
||||
|
@ -514,7 +514,6 @@ void hashtable_get_stats(void* table,
|
||||
if (table != NULL)
|
||||
{
|
||||
ht = (HASHTABLE *)table;
|
||||
CHK_HASHTABLE(ht);
|
||||
hashtable_read_lock(ht);
|
||||
|
||||
for (i = 0; i < ht->hashsize; i++)
|
||||
|
@ -518,8 +518,6 @@ GWBUF* modutil_get_next_MySQL_packet(GWBUF** p_readbuf)
|
||||
|
||||
if (readbuf)
|
||||
{
|
||||
CHK_GWBUF(readbuf);
|
||||
|
||||
size_t totalbuflen = gwbuf_length(readbuf);
|
||||
if (totalbuflen >= MYSQL_HEADER_LEN)
|
||||
{
|
||||
@ -781,7 +779,6 @@ void modutil_reply_parse_error(DCB* backend_dcb,
|
||||
char* errstr,
|
||||
uint32_t flags)
|
||||
{
|
||||
CHK_DCB(backend_dcb);
|
||||
modutil_reply_routing_error(backend_dcb, 1064, "42000", errstr, flags);
|
||||
}
|
||||
|
||||
@ -798,7 +795,6 @@ void modutil_reply_auth_error(DCB* backend_dcb,
|
||||
char* errstr,
|
||||
uint32_t flags)
|
||||
{
|
||||
CHK_DCB(backend_dcb);
|
||||
modutil_reply_routing_error(backend_dcb, 1045, "28000", errstr, flags);
|
||||
}
|
||||
|
||||
@ -821,7 +817,6 @@ static void modutil_reply_routing_error(DCB* backend_dcb,
|
||||
uint32_t flags)
|
||||
{
|
||||
GWBUF* buf;
|
||||
CHK_DCB(backend_dcb);
|
||||
|
||||
buf = modutil_create_mysql_err_msg(1, 0, error, state, errstr);
|
||||
MXS_FREE(errstr);
|
||||
|
@ -228,7 +228,6 @@ static MXS_SESSION* session_alloc_body(SERVICE* service, DCB* client_dcb,
|
||||
}
|
||||
atomic_add(&service->stats.n_sessions, 1);
|
||||
atomic_add(&service->stats.n_current, 1);
|
||||
CHK_SESSION(session);
|
||||
|
||||
// Store the session in the client DCB even if the session creation fails.
|
||||
// It will be freed later on when the DCB is closed.
|
||||
@ -365,7 +364,6 @@ static void session_free(MXS_SESSION *session)
|
||||
|
||||
static void session_final_free(MXS_SESSION *session)
|
||||
{
|
||||
CHK_SESSION(session);
|
||||
ss_dassert(session->refcount == 0);
|
||||
|
||||
session->state = SESSION_STATE_TO_BE_FREED;
|
||||
|
@ -300,7 +300,6 @@ cdc_auth_set_protocol_data(DCB *dcb, GWBUF *buf)
|
||||
int client_auth_packet_size = 0;
|
||||
|
||||
protocol = DCB_PROTOCOL(dcb, CDC_protocol);
|
||||
CHK_PROTOCOL(protocol);
|
||||
if (dcb->data == NULL)
|
||||
{
|
||||
if (NULL == (client_data = (CDC_session *)MXS_CALLOC(1, sizeof(CDC_session))))
|
||||
|
@ -377,7 +377,6 @@ mysql_auth_set_protocol_data(DCB *dcb, GWBUF *buf)
|
||||
MYSQL_session *client_data = NULL;
|
||||
int client_auth_packet_size = 0;
|
||||
protocol = DCB_PROTOCOL(dcb, MySQLProtocol);
|
||||
CHK_PROTOCOL(protocol);
|
||||
|
||||
client_data = (MYSQL_session *)dcb->data;
|
||||
|
||||
|
@ -395,8 +395,6 @@ cdc_protocol_init(DCB* dcb)
|
||||
/* memory allocation here */
|
||||
p->state = CDC_STATE_WAIT_FOR_AUTH;
|
||||
|
||||
CHK_PROTOCOL(p);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1185,8 +1185,6 @@ newSession(MXS_ROUTER *instance, MXS_SESSION *session)
|
||||
inst->slaves = slave;
|
||||
spinlock_release(&inst->lock);
|
||||
|
||||
CHK_CLIENT_RSES(slave);
|
||||
|
||||
return reinterpret_cast<MXS_ROUTER_SESSION*>(slave);
|
||||
}
|
||||
|
||||
@ -1293,7 +1291,6 @@ closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session)
|
||||
blr_master_reconnect(router);
|
||||
return;
|
||||
}
|
||||
CHK_CLIENT_RSES(slave);
|
||||
|
||||
/**
|
||||
* Lock router client session for secure read and update.
|
||||
@ -2416,8 +2413,6 @@ static bool rses_begin_locked_router_action(ROUTER_SLAVE *rses)
|
||||
{
|
||||
bool succp = false;
|
||||
|
||||
CHK_CLIENT_RSES(rses);
|
||||
|
||||
spinlock_acquire(&rses->rses_lock);
|
||||
succp = true;
|
||||
|
||||
@ -2440,7 +2435,6 @@ static bool rses_begin_locked_router_action(ROUTER_SLAVE *rses)
|
||||
*/
|
||||
static void rses_end_locked_router_action(ROUTER_SLAVE *rses)
|
||||
{
|
||||
CHK_CLIENT_RSES(rses);
|
||||
spinlock_release(&rses->rses_lock);
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,6 @@ static void handleError(MXS_ROUTER *instance,
|
||||
|
||||
if (session->state == SESSION_STATE_ROUTER_READY)
|
||||
{
|
||||
CHK_DCB(client_dcb);
|
||||
client_dcb->func.write(client_dcb, gwbuf_clone(errbuf));
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,6 @@ closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session)
|
||||
*/
|
||||
if (backend_dcb != NULL)
|
||||
{
|
||||
CHK_DCB(backend_dcb);
|
||||
dcb_close(backend_dcb);
|
||||
}
|
||||
}
|
||||
@ -763,8 +762,6 @@ static void handleError(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session
|
||||
|
||||
if (sesstate == SESSION_STATE_ROUTER_READY)
|
||||
{
|
||||
CHK_DCB(client_dcb);
|
||||
|
||||
client_dcb->func.write(client_dcb, gwbuf_clone(errbuf));
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,6 @@ GWBUF* RWSplitSession::discard_master_wait_gtid_result(GWBUF *buffer)
|
||||
SRWBackend& RWSplitSession::get_backend_from_dcb(DCB *dcb)
|
||||
{
|
||||
ss_dassert(dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER);
|
||||
CHK_DCB(dcb);
|
||||
|
||||
for (auto it = m_backends.begin(); it != m_backends.end(); it++)
|
||||
{
|
||||
@ -736,7 +735,6 @@ void RWSplitSession::handleError(GWBUF *errmsgbuf, DCB *problem_dcb,
|
||||
mxs_error_action_t action, bool *succp)
|
||||
{
|
||||
ss_dassert(problem_dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER);
|
||||
CHK_DCB(problem_dcb);
|
||||
MXS_SESSION *session = problem_dcb->session;
|
||||
ss_dassert(session);
|
||||
|
||||
@ -881,7 +879,6 @@ bool RWSplitSession::handle_error_new_connection(DCB *backend_dcb, GWBUF *errmsg
|
||||
SRWBackend& backend = get_backend_from_dcb(backend_dcb);
|
||||
MXS_SESSION* ses = backend_dcb->session;
|
||||
bool route_stored = false;
|
||||
CHK_SESSION(ses);
|
||||
|
||||
if (backend->is_waiting_result())
|
||||
{
|
||||
@ -968,7 +965,6 @@ void RWSplitSession::handle_error_reply_client(DCB *backend_dcb, GWBUF *errmsg)
|
||||
|
||||
if (sesstate == SESSION_STATE_ROUTER_READY)
|
||||
{
|
||||
CHK_DCB(m_client);
|
||||
m_client->func.write(m_client, gwbuf_clone(errmsg));
|
||||
}
|
||||
}
|
||||
|
@ -614,7 +614,6 @@ void SchemaRouterSession::handleError(GWBUF* pMessage,
|
||||
bool* pSuccess)
|
||||
{
|
||||
ss_dassert(pProblem->dcb_role == DCB_ROLE_BACKEND_HANDLER);
|
||||
CHK_DCB(pProblem);
|
||||
SSRBackend bref = get_bref_from_dcb(pProblem);
|
||||
|
||||
if (bref.get() == NULL) // Should never happen
|
||||
@ -824,8 +823,6 @@ bool SchemaRouterSession::have_servers()
|
||||
*/
|
||||
SSRBackend SchemaRouterSession::get_bref_from_dcb(DCB* dcb)
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
|
||||
for (SSRBackendList::iterator it = m_backends.begin(); it != m_backends.end(); it++)
|
||||
{
|
||||
if ((*it)->dcb() == dcb)
|
||||
@ -1804,4 +1801,4 @@ SERVER* SchemaRouterSession::get_ps_target(GWBUF* buffer, uint32_t qtype, qc_que
|
||||
return rval;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user