Try different code, continue polling while not in use.

This commit is contained in:
counterpoint
2015-05-26 16:31:52 +01:00
parent 44fc324329
commit d90ea82aaa
2 changed files with 29 additions and 31 deletions

View File

@ -281,20 +281,6 @@ dcb_add_to_zombieslist(DCB *dcb)
return; return;
} }
char *user;
user = session_getUser(dcb->session);
if (user && dcb->server)
{
dcb->user = strdup(user);
spinlock_acquire(&dcb->server->persistlock);
dcb->nextpersistent = dcb->server->persistent;
dcb->server->persistent = dcb;
spinlock_release(&dcb->server->persistlock);
atomic_add(&dcb->server->stats.n_persistent, 1);
}
else
{
/*< /*<
* Add closing dcb to the top of the list. * Add closing dcb to the top of the list.
*/ */
@ -306,7 +292,6 @@ dcb_add_to_zombieslist(DCB *dcb)
*/ */
succp = dcb_set_state(dcb, DCB_STATE_ZOMBIE, &prev_state); succp = dcb_set_state(dcb, DCB_STATE_ZOMBIE, &prev_state);
ss_info_dassert(succp, "Failed to set DCB_STATE_ZOMBIE"); ss_info_dassert(succp, "Failed to set DCB_STATE_ZOMBIE");
}
spinlock_release(&zombiespin); spinlock_release(&zombiespin);
} }
@ -1300,6 +1285,19 @@ dcb_close(DCB *dcb)
*/ */
if (dcb->state == DCB_STATE_POLLING) if (dcb->state == DCB_STATE_POLLING)
{ {
char *user;
user = session_getUser(dcb->session);
if (user && dcb->server)
{
dcb->user = strdup(user);
spinlock_acquire(&dcb->server->persistlock);
dcb->nextpersistent = dcb->server->persistent;
dcb->server->persistent = dcb;
spinlock_release(&dcb->server->persistlock);
atomic_add(&dcb->server->stats.n_persistent, 1);
return;
}
rc = poll_remove_dcb(dcb); rc = poll_remove_dcb(dcb);
if (rc == 0) { if (rc == 0) {
@ -1358,7 +1356,7 @@ printDCB(DCB *dcb)
printf("\tUsername to: %s\n", dcb->user); printf("\tUsername to: %s\n", dcb->user);
if (dcb->writeq) if (dcb->writeq)
printf("\tQueued write data: %d\n",gwbuf_length(dcb->writeq)); printf("\tQueued write data: %d\n",gwbuf_length(dcb->writeq));
char *statusname = server_status(dcb->dcb_server_status); char *statusname = server_status(dcb->server);
if (statusname) if (statusname)
{ {
printf("\tServer status: %s\n", statusname); printf("\tServer status: %s\n", statusname);
@ -1450,7 +1448,7 @@ DCB *dcb;
if (dcb->writeq) if (dcb->writeq)
dcb_printf(pdcb, "\tQueued write data: %d\n", dcb_printf(pdcb, "\tQueued write data: %d\n",
gwbuf_length(dcb->writeq)); gwbuf_length(dcb->writeq));
char *statusname = server_status(dcb->dcb_server_status); char *statusname = server_status(dcb->server);
if (statusname) if (statusname)
{ {
dcb_printf(pdcb, "\tServer status: %s\n", statusname); dcb_printf(pdcb, "\tServer status: %s\n", statusname);
@ -1565,7 +1563,7 @@ dprintDCB(DCB *pdcb, DCB *dcb)
dcb_printf(pdcb, "\tQueued write data: %d\n", gwbuf_length(dcb->writeq)); dcb_printf(pdcb, "\tQueued write data: %d\n", gwbuf_length(dcb->writeq));
if (dcb->delayq) if (dcb->delayq)
dcb_printf(pdcb, "\tDelayed write data: %d\n", gwbuf_length(dcb->delayq)); dcb_printf(pdcb, "\tDelayed write data: %d\n", gwbuf_length(dcb->delayq));
char *statusname = server_status(dcb->dcb_server_status); char *statusname = server_status(dcb->server);
if (statusname) if (statusname)
{ {
dcb_printf(pdcb, "\tServer status: %s\n", statusname); dcb_printf(pdcb, "\tServer status: %s\n", statusname);

View File

@ -547,7 +547,7 @@ server_status(SERVER *server)
{ {
char *status = NULL; char *status = NULL;
if ((status = (char *)malloc(256)) == NULL) if (NULL == server || (status = (char *)malloc(256)) == NULL)
return NULL; return NULL;
status[0] = 0; status[0] = 0;
if (server->status & SERVER_MAINT) if (server->status & SERVER_MAINT)