gwbuf_consume is protected by spinlock
This commit is contained in:
@ -760,7 +760,6 @@ dcb_write(DCB *dcb, GWBUF *queue)
|
|||||||
dcb->stats.n_buffered++;
|
dcb->stats.n_buffered++;
|
||||||
}
|
}
|
||||||
} /* if (dcb->writeq) */
|
} /* if (dcb->writeq) */
|
||||||
spinlock_release(&dcb->writeqlock);
|
|
||||||
|
|
||||||
if (saved_errno != 0 &&
|
if (saved_errno != 0 &&
|
||||||
queue != NULL &&
|
queue != NULL &&
|
||||||
@ -774,8 +773,11 @@ dcb_write(DCB *dcb, GWBUF *queue)
|
|||||||
dcb_isclient(dcb) ? "client" : "backend server",
|
dcb_isclient(dcb) ? "client" : "backend server",
|
||||||
saved_errno,
|
saved_errno,
|
||||||
strerror(saved_errno));
|
strerror(saved_errno));
|
||||||
|
|
||||||
|
spinlock_release(&dcb->writeqlock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
spinlock_release(&dcb->writeqlock);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -258,7 +258,8 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
|
|
||||||
if (backend_protocol->state == MYSQL_AUTH_FAILED) {
|
if (backend_protocol->state == MYSQL_AUTH_FAILED) {
|
||||||
/* check the delayq before the reply */
|
/* check the delayq before the reply */
|
||||||
if (dcb->delayq) {
|
spinlock_acquire(&dcb->authlock);
|
||||||
|
if (dcb->delayq != NULL) {
|
||||||
/* send an error to the client */
|
/* send an error to the client */
|
||||||
mysql_send_custom_error(
|
mysql_send_custom_error(
|
||||||
dcb->session->client,
|
dcb->session->client,
|
||||||
@ -268,6 +269,8 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
// consume all the delay queue
|
// consume all the delay queue
|
||||||
dcb->delayq = gwbuf_consume(dcb->delayq, gwbuf_length(dcb->delayq));
|
dcb->delayq = gwbuf_consume(dcb->delayq, gwbuf_length(dcb->delayq));
|
||||||
}
|
}
|
||||||
|
spinlock_release(&dcb->authlock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protect call of closeSession.
|
* Protect call of closeSession.
|
||||||
*/
|
*/
|
||||||
@ -473,6 +476,7 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
|||||||
/**
|
/**
|
||||||
* Don't write to backend if backend_dcb is not in poll set anymore.
|
* Don't write to backend if backend_dcb is not in poll set anymore.
|
||||||
*/
|
*/
|
||||||
|
spinlock_acquire(&dcb->authlock);
|
||||||
if (dcb->state != DCB_STATE_POLLING) {
|
if (dcb->state != DCB_STATE_POLLING) {
|
||||||
/** Free buffer memory */
|
/** Free buffer memory */
|
||||||
gwbuf_consume(queue, GWBUF_LENGTH(queue));
|
gwbuf_consume(queue, GWBUF_LENGTH(queue));
|
||||||
@ -485,9 +489,11 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
|||||||
dcb,
|
dcb,
|
||||||
dcb->fd,
|
dcb->fd,
|
||||||
STRDCBSTATE(dcb->state));
|
STRDCBSTATE(dcb->state));
|
||||||
|
|
||||||
|
spinlock_release(&dcb->authlock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
spinlock_acquire(&dcb->authlock);
|
|
||||||
/**
|
/**
|
||||||
* Now put the incoming data to the delay queue unless backend is
|
* Now put the incoming data to the delay queue unless backend is
|
||||||
* connected with auth ok
|
* connected with auth ok
|
||||||
@ -849,9 +855,14 @@ static int gw_change_user(DCB *backend, SERVER *server, SESSION *in_session, GWB
|
|||||||
}
|
}
|
||||||
|
|
||||||
// consume all the data received from client
|
// consume all the data received from client
|
||||||
|
|
||||||
|
spinlock_acquire(&backend->writeqlock);
|
||||||
|
|
||||||
len = gwbuf_length(queue);
|
len = gwbuf_length(queue);
|
||||||
queue = gwbuf_consume(queue, len);
|
queue = gwbuf_consume(queue, len);
|
||||||
|
|
||||||
|
spinlock_release(&backend->writeqlock);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user