Added the backend delayq: this will assure incoming data are queued before mysql backend connection is complete
After connection data will be written to backend
This commit is contained in:
@ -132,6 +132,8 @@ typedef struct dcb {
|
|||||||
|
|
||||||
SPINLOCK writeqlock; /**< Write Queue spinlock */
|
SPINLOCK writeqlock; /**< Write Queue spinlock */
|
||||||
GWBUF *writeq; /**< Write Data Queue */
|
GWBUF *writeq; /**< Write Data Queue */
|
||||||
|
SPINLOCK delayqlock; /**< Delay Backend Write Queue spinlock */
|
||||||
|
GWBUF *delayq; /**< Delay Backend Write Data Queue */
|
||||||
|
|
||||||
DCBSTATS stats; /**< DCB related statistics */
|
DCBSTATS stats; /**< DCB related statistics */
|
||||||
|
|
||||||
|
@ -704,3 +704,25 @@ int gw_mysql_connect(char *host, int port, char *dbname, char *user, uint8_t *pa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine writes the delayq via dcb_write
|
||||||
|
* The dcb->delayq contains data received from the client before
|
||||||
|
* mysql backend authentication succeded
|
||||||
|
*
|
||||||
|
* @param dcb The current backend DCB
|
||||||
|
* @return The dcb_write status
|
||||||
|
*/
|
||||||
|
static int backend_write_delayqueue(DCB *dcb)
|
||||||
|
{
|
||||||
|
GWBUF *localq = NULL;
|
||||||
|
|
||||||
|
spinlock_acquire(&dcb->delayqlock);
|
||||||
|
|
||||||
|
localq = dcb->delayq;
|
||||||
|
dcb->delayq = NULL;
|
||||||
|
|
||||||
|
spinlock_release(&dcb->delayqlock);
|
||||||
|
|
||||||
|
return dcb_write(dcb, localq);
|
||||||
|
}
|
||||||
|
/////
|
||||||
|
Reference in New Issue
Block a user