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:
Massimiliano Pinto 2013-07-03 09:34:22 +02:00
parent 24079799fa
commit 903b906044
2 changed files with 24 additions and 0 deletions

View File

@ -132,6 +132,8 @@ typedef struct dcb {
SPINLOCK writeqlock; /**< Write Queue spinlock */
GWBUF *writeq; /**< Write Data Queue */
SPINLOCK delayqlock; /**< Delay Backend Write Queue spinlock */
GWBUF *delayq; /**< Delay Backend Write Data Queue */
DCBSTATS stats; /**< DCB related statistics */

View File

@ -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);
}
/////