Name read/fake queue consistently

Now dcb_readqueue and dvb_fakequeue are named readq and fakeq
respectively, to be consistent with the naming of the write
and delay queue.
This commit is contained in:
Johan Wikman
2017-09-06 11:30:24 +03:00
parent 84300c6d97
commit 3770b4da95
2 changed files with 27 additions and 27 deletions

View File

@ -154,8 +154,8 @@ typedef struct dcb
int writeqlen; /**< Current number of byes in the write queue */ int writeqlen; /**< Current number of byes in the write queue */
GWBUF *writeq; /**< Write Data Queue */ GWBUF *writeq; /**< Write Data Queue */
GWBUF *delayq; /**< Delay Backend Write Data Queue */ GWBUF *delayq; /**< Delay Backend Write Data Queue */
GWBUF *dcb_readqueue; /**< Read queue for storing incomplete reads */ GWBUF *readq; /**< Read queue for storing incomplete reads */
GWBUF *dcb_fakequeue; /**< Fake event queue for generated events */ GWBUF *fakeq; /**< Fake event queue for generated events */
DCBSTATS stats; /**< DCB related statistics */ DCBSTATS stats; /**< DCB related statistics */
struct dcb *nextpersistent; /**< Next DCB in the persistent pool for SERVER */ struct dcb *nextpersistent; /**< Next DCB in the persistent pool for SERVER */
@ -275,7 +275,7 @@ void dcb_process_idle_sessions(int thr);
*/ */
static inline void dcb_readq_append(DCB *dcb, GWBUF *buffer) static inline void dcb_readq_append(DCB *dcb, GWBUF *buffer)
{ {
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, buffer); dcb->readq = gwbuf_append(dcb->readq, buffer);
} }
/** /**
@ -287,7 +287,7 @@ static inline void dcb_readq_append(DCB *dcb, GWBUF *buffer)
*/ */
static GWBUF* dcb_readq_get(DCB* dcb) static GWBUF* dcb_readq_get(DCB* dcb)
{ {
return dcb->dcb_readqueue; return dcb->readq;
} }
/** /**
@ -297,7 +297,7 @@ static GWBUF* dcb_readq_get(DCB* dcb)
*/ */
static inline bool dcb_readq_has(DCB* dcb) static inline bool dcb_readq_has(DCB* dcb)
{ {
return dcb->dcb_readqueue != NULL; return dcb->readq != NULL;
} }
/** /**
@ -307,7 +307,7 @@ static inline bool dcb_readq_has(DCB* dcb)
*/ */
static unsigned int dcb_readq_length(DCB* dcb) static unsigned int dcb_readq_length(DCB* dcb)
{ {
return dcb->dcb_readqueue ? gwbuf_length(dcb->dcb_readqueue) : 0; return dcb->readq ? gwbuf_length(dcb->readq) : 0;
} }
/** /**
@ -318,7 +318,7 @@ static unsigned int dcb_readq_length(DCB* dcb)
*/ */
static inline void dcb_readq_prepend(DCB *dcb, GWBUF *buffer) static inline void dcb_readq_prepend(DCB *dcb, GWBUF *buffer)
{ {
dcb->dcb_readqueue = gwbuf_append(buffer, dcb->dcb_readqueue); dcb->readq = gwbuf_append(buffer, dcb->readq);
} }
/** /**
@ -330,9 +330,9 @@ static inline void dcb_readq_prepend(DCB *dcb, GWBUF *buffer)
*/ */
static GWBUF* dcb_readq_release(DCB* dcb) static GWBUF* dcb_readq_release(DCB* dcb)
{ {
GWBUF* dcb_readqueue = dcb->dcb_readqueue; GWBUF* readq = dcb->readq;
dcb->dcb_readqueue = NULL; dcb->readq = NULL;
return dcb_readqueue; return readq;
} }
/** /**
@ -346,17 +346,17 @@ static GWBUF* dcb_readq_release(DCB* dcb)
*/ */
static inline void dcb_readq_set(DCB *dcb, GWBUF *buffer) static inline void dcb_readq_set(DCB *dcb, GWBUF *buffer)
{ {
if (dcb->dcb_readqueue) if (dcb->readq)
{ {
MXS_ERROR("Read-queue set when there already is a read-queue."); MXS_ERROR("Read-queue set when there already is a read-queue.");
// TODO: Conceptually this should be freed here. However, currently // TODO: Conceptually this should be freed here. However, currently
// TODO: the code just assigns without checking, so we do the same // TODO: the code just assigns without checking, so we do the same
// TODO: for now. If this is not set to NULL when it has been consumed, // TODO: for now. If this is not set to NULL when it has been consumed,
// TODO: we would get a double free. // TODO: we would get a double free.
// TODO: gwbuf_free(dcb->dcb_readqueue); // TODO: gwbuf_free(dcb->readq);
dcb->dcb_readqueue = NULL; dcb->readq = NULL;
} }
dcb->dcb_readqueue = buffer; dcb->readq = buffer;
} }
/** /**

View File

@ -306,15 +306,15 @@ dcb_free_all_memory(DCB *dcb)
gwbuf_free(dcb->writeq); gwbuf_free(dcb->writeq);
dcb->writeq = NULL; dcb->writeq = NULL;
} }
if (dcb->dcb_readqueue) if (dcb->readq)
{ {
gwbuf_free(dcb->dcb_readqueue); gwbuf_free(dcb->readq);
dcb->dcb_readqueue = NULL; dcb->readq = NULL;
} }
if (dcb->dcb_fakequeue) if (dcb->fakeq)
{ {
gwbuf_free(dcb->dcb_fakequeue); gwbuf_free(dcb->fakeq);
dcb->dcb_fakequeue = NULL; dcb->fakeq = NULL;
} }
while ((cb_dcb = dcb->callbacks) != NULL) while ((cb_dcb = dcb->callbacks) != NULL)
@ -523,16 +523,16 @@ int dcb_read(DCB *dcb,
int nsingleread = 0; int nsingleread = 0;
int nreadtotal = 0; int nreadtotal = 0;
if (dcb->dcb_readqueue) if (dcb->readq)
{ {
*head = gwbuf_append(*head, dcb->dcb_readqueue); *head = gwbuf_append(*head, dcb->readq);
dcb->dcb_readqueue = NULL; dcb->readq = NULL;
nreadtotal = gwbuf_length(*head); nreadtotal = gwbuf_length(*head);
} }
else if (dcb->dcb_fakequeue) else if (dcb->fakeq)
{ {
*head = gwbuf_append(*head, dcb->dcb_fakequeue); *head = gwbuf_append(*head, dcb->fakeq);
dcb->dcb_fakequeue = NULL; dcb->fakeq = NULL;
nreadtotal = gwbuf_length(*head); nreadtotal = gwbuf_length(*head);
} }
@ -3171,7 +3171,7 @@ public:
void execute(Worker& worker) void execute(Worker& worker)
{ {
m_dcb->dcb_fakequeue = m_buffer; m_dcb->fakeq = m_buffer;
dcb_handler(m_dcb, m_ev); dcb_handler(m_dcb, m_ev);
} }