Fixed bugs by moving setting of thread bit mask from polling to DCB closing, fixed other mistakes.

This commit is contained in:
counterpoint
2015-08-25 11:46:25 +01:00
parent ea09918312
commit 8425deab18
2 changed files with 6 additions and 6 deletions

View File

@ -560,6 +560,7 @@ dcb_process_victim_queue(DCB *listofdcb)
if (dcb_maybe_add_persistent(dcb)) if (dcb_maybe_add_persistent(dcb))
{ {
/* Have taken DCB into persistent pool, no further killing */ /* Have taken DCB into persistent pool, no further killing */
dcb = dcb->memdata.next;
continue; continue;
} }
} }
@ -1858,6 +1859,10 @@ dcb_close(DCB *dcb)
dcb->dcb_is_zombie = true; dcb->dcb_is_zombie = true;
dcb->memdata.next = zombies; dcb->memdata.next = zombies;
zombies = dcb; zombies = dcb;
/*< Set bit for each maxscale thread. This should be done before
* the state is changed, so as to protect the DCB from premature
* destruction. */
bitmask_copy(&dcb->memdata.bitmask, poll_bitmask());
} }
spinlock_release(&zombiespin); spinlock_release(&zombiespin);
} }
@ -1873,7 +1878,7 @@ static bool
dcb_maybe_add_persistent(DCB *dcb) dcb_maybe_add_persistent(DCB *dcb)
{ {
int poolcount = -1; int poolcount = -1;
if (dcb->user if (dcb->user != NULL
&& strlen(dcb->user) && strlen(dcb->user)
&& dcb->server && dcb->server
&& dcb->server->persistpoolmax && dcb->server->persistpoolmax
@ -1888,7 +1893,6 @@ dcb_maybe_add_persistent(DCB *dcb)
dcb->user))); dcb->user)));
dcb->dcb_is_zombie = false; dcb->dcb_is_zombie = false;
dcb->persistentstart = time(NULL); dcb->persistentstart = time(NULL);
session_unlink_dcb(dcb->session, dcb);
spinlock_acquire(&dcb->server->persistlock); spinlock_acquire(&dcb->server->persistlock);
dcb->nextpersistent = dcb->server->persistent; dcb->nextpersistent = dcb->server->persistent;
dcb->server->persistent = dcb; dcb->server->persistent = dcb;

View File

@ -368,10 +368,6 @@ poll_remove_dcb(DCB *dcb)
dcb, dcb,
STRDCBSTATE(dcb->state)))); STRDCBSTATE(dcb->state))));
} }
/*< Set bit for each maxscale thread. This should be done before
* the state is changed, so as to protect the DCB from premature
* destruction. */
bitmask_copy(&dcb->memdata.bitmask, poll_bitmask());
/*< /*<
* Set state to NOPOLLING and remove dcb from poll set. * Set state to NOPOLLING and remove dcb from poll set.
*/ */