Add debug assertions into the core
The assertions make sure DCB writes and reads are only done by the thread that owns them.
This commit is contained in:
@ -565,6 +565,7 @@ int dcb_read(DCB* dcb,
|
|||||||
GWBUF** head,
|
GWBUF** head,
|
||||||
int maxbytes)
|
int maxbytes)
|
||||||
{
|
{
|
||||||
|
mxb_assert(dcb->poll.owner == RoutingWorker::get_current());
|
||||||
int nsingleread = 0;
|
int nsingleread = 0;
|
||||||
int nreadtotal = 0;
|
int nreadtotal = 0;
|
||||||
|
|
||||||
@ -904,6 +905,7 @@ static int dcb_log_errors_SSL(DCB* dcb, int ret)
|
|||||||
*/
|
*/
|
||||||
int dcb_write(DCB* dcb, GWBUF* queue)
|
int dcb_write(DCB* dcb, GWBUF* queue)
|
||||||
{
|
{
|
||||||
|
mxb_assert(dcb->poll.owner == RoutingWorker::get_current());
|
||||||
dcb->writeqlen += gwbuf_length(queue);
|
dcb->writeqlen += gwbuf_length(queue);
|
||||||
// The following guarantees that queue is not NULL
|
// The following guarantees that queue is not NULL
|
||||||
if (!dcb_write_parameter_check(dcb, queue))
|
if (!dcb_write_parameter_check(dcb, queue))
|
||||||
@ -3301,6 +3303,7 @@ public:
|
|||||||
RoutingWorker& rworker = static_cast<RoutingWorker&>(worker);
|
RoutingWorker& rworker = static_cast<RoutingWorker&>(worker);
|
||||||
if (dcb_is_still_valid(m_dcb, rworker.id()) && m_dcb->m_uid == m_uid)
|
if (dcb_is_still_valid(m_dcb, rworker.id()) && m_dcb->m_uid == m_uid)
|
||||||
{
|
{
|
||||||
|
mxb_assert(m_dcb->poll.owner == RoutingWorker::get_current());
|
||||||
m_dcb->fakeq = m_buffer;
|
m_dcb->fakeq = m_buffer;
|
||||||
dcb_handler(m_dcb, m_ev);
|
dcb_handler(m_dcb, m_ev);
|
||||||
}
|
}
|
||||||
@ -3321,6 +3324,7 @@ static void poll_add_event_to_dcb(DCB* dcb, GWBUF* buf, uint32_t ev)
|
|||||||
{
|
{
|
||||||
if (dcb == this_thread.current_dcb)
|
if (dcb == this_thread.current_dcb)
|
||||||
{
|
{
|
||||||
|
mxb_assert(dcb->poll.owner == RoutingWorker::get_current());
|
||||||
// If the fake event is added to the current DCB, we arrange for
|
// If the fake event is added to the current DCB, we arrange for
|
||||||
// it to be handled immediately in dcb_handler() when the handling
|
// it to be handled immediately in dcb_handler() when the handling
|
||||||
// of the current events are done...
|
// of the current events are done...
|
||||||
|
|||||||
Reference in New Issue
Block a user