Fixes for maintainability of dcb.c; error in persistent connections.
This commit is contained in:
@ -1152,8 +1152,12 @@ int below_water;
|
|||||||
if (w < 0)
|
if (w < 0)
|
||||||
{
|
{
|
||||||
dcb_log_write_failure(dcb, queue, errno);
|
dcb_log_write_failure(dcb, queue, errno);
|
||||||
|
/*<
|
||||||
|
* What wasn't successfully written is stored to write queue
|
||||||
|
* for suspended write.
|
||||||
|
*/
|
||||||
atomic_add(&dcb->writeqlen, gwbuf_length(queue));
|
atomic_add(&dcb->writeqlen, gwbuf_length(queue));
|
||||||
dcb->writeq = queue;
|
dcb->writeq = queue;
|
||||||
dcb->stats.n_buffered++;
|
dcb->stats.n_buffered++;
|
||||||
spinlock_release(&dcb->writeqlock);
|
spinlock_release(&dcb->writeqlock);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1173,11 +1177,6 @@ int below_water;
|
|||||||
STRDCBSTATE(dcb->state),
|
STRDCBSTATE(dcb->state),
|
||||||
dcb->fd)));
|
dcb->fd)));
|
||||||
} /*< while (queue != NULL) */
|
} /*< while (queue != NULL) */
|
||||||
/*<
|
|
||||||
* What wasn't successfully written is stored to write queue
|
|
||||||
* for suspended write.
|
|
||||||
*/
|
|
||||||
dcb->writeq = queue;
|
|
||||||
|
|
||||||
} /* if (dcb->writeq) */
|
} /* if (dcb->writeq) */
|
||||||
|
|
||||||
@ -1188,11 +1187,10 @@ int below_water;
|
|||||||
|
|
||||||
#if defined(FAKE_CODE)
|
#if defined(FAKE_CODE)
|
||||||
/**
|
/**
|
||||||
* Check the parameters for dcb_write
|
* Fake code for dcb_write
|
||||||
|
* (Should have fuller description)
|
||||||
*
|
*
|
||||||
* @param dcb The DCB of the client
|
* @param dcb The DCB of the client
|
||||||
* @param queue Queue of buffers to write
|
|
||||||
* @return true if parameters acceptable, false otherwise
|
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
dcb_write_fake_code(DCB *dcb)
|
dcb_write_fake_code(DCB *dcb)
|
||||||
@ -1227,17 +1225,18 @@ dcb_write_fake_code(DCB *dcb)
|
|||||||
static inline bool
|
static inline bool
|
||||||
dcb_write_parameter_check(DCB *dcb, GWBUF *queue)
|
dcb_write_parameter_check(DCB *dcb, GWBUF *queue)
|
||||||
{
|
{
|
||||||
|
if (queue == NULL) return false;
|
||||||
|
|
||||||
if (dcb->fd <= 0)
|
if (dcb->fd <= 0)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Write failed, dcb is %s.",
|
"Error : Write failed, dcb is %s.",
|
||||||
dcb->fd == DCBFD_CLOSED ? "closed" : "cloned, not writable")));
|
dcb->fd == DCBFD_CLOSED ? "closed" : "cloned, not writable")));
|
||||||
return false;
|
gwbuf_free(queue);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queue == NULL) return false;
|
|
||||||
|
|
||||||
if (dcb->session == NULL || dcb->session->state != SESSION_STATE_STOPPING)
|
if (dcb->session == NULL || dcb->session->state != SESSION_STATE_STOPPING)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -1265,7 +1264,7 @@ dcb_write_parameter_check(DCB *dcb, GWBUF *queue)
|
|||||||
dcb,
|
dcb,
|
||||||
STRDCBSTATE(dcb->state),
|
STRDCBSTATE(dcb->state),
|
||||||
dcb->fd)));
|
dcb->fd)));
|
||||||
//ss_dassert(false);
|
gwbuf_free(queue);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1309,7 +1308,7 @@ dcb_write_when_already_queued(DCB *dcb, GWBUF *queue)
|
|||||||
*
|
*
|
||||||
* @param dcb The DCB of the client
|
* @param dcb The DCB of the client
|
||||||
* @param queue Queue of buffers to write
|
* @param queue Queue of buffers to write
|
||||||
* @return 0 on failure, 1 on success
|
* @param eno Error number for logging
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
||||||
@ -1385,7 +1384,7 @@ dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle writing when there is already queued data
|
* Last few things to do at end of a write
|
||||||
*
|
*
|
||||||
* @param dcb The DCB of the client
|
* @param dcb The DCB of the client
|
||||||
* @param below_water A boolean
|
* @param below_water A boolean
|
||||||
|
@ -1115,7 +1115,9 @@ int gw_read_client_event(
|
|||||||
* send redundant COM_QUIT.
|
* send redundant COM_QUIT.
|
||||||
*/
|
*/
|
||||||
/* Temporarily suppressed: SESSION_ROUTE_QUERY(session, read_buffer); */
|
/* Temporarily suppressed: SESSION_ROUTE_QUERY(session, read_buffer); */
|
||||||
/**
|
/* Replaced with freeing the read buffer. */
|
||||||
|
gwbuf_free(read_buffer);
|
||||||
|
/**
|
||||||
* Close router session which causes closing of backends.
|
* Close router session which causes closing of backends.
|
||||||
*/
|
*/
|
||||||
dcb_close(dcb);
|
dcb_close(dcb);
|
||||||
|
Reference in New Issue
Block a user