Merge branch '2.1' into develop

This commit is contained in:
Markus Mäkelä
2017-02-08 09:32:18 +02:00
16 changed files with 120 additions and 179 deletions

View File

@ -1915,14 +1915,11 @@ dprintOneDCB(DCB *pdcb, DCB *dcb)
}
}
/*
* @brief Print DCB list statistics
*
* @param pdcb DCB to print results to
*/
void
dprintDCBList(DCB *pdcb)
static bool dprint_all_dcbs_cb(DCB *dcb, void *data)
{
DCB *pdcb = (DCB*)data;
dprintOneDCB(pdcb, dcb);
return true;
}
/**
@ -1930,23 +1927,19 @@ dprintDCBList(DCB *pdcb)
*
* @param pdcb DCB to print results to
*/
void
dprintAllDCBs(DCB *pdcb)
void dprintAllDCBs(DCB *pdcb)
{
dcb_foreach(dprint_all_dcbs_cb, pdcb);
}
int nthr = config_threadcount();
for (int i = 0; i < nthr; i++)
{
spinlock_acquire(&all_dcbs_lock[i]);
for (DCB *dcb = all_dcbs[i]; dcb; dcb = dcb->thread.next)
{
dprintOneDCB(pdcb, dcb);
}
spinlock_release(&all_dcbs_lock[i]);
}
static bool dlist_dcbs_cb(DCB *dcb, void *data)
{
DCB *pdcb = (DCB*)data;
dcb_printf(pdcb, " %-16p | %-26s | %-18s | %s\n",
dcb, gw_dcb_state2string(dcb->state),
((dcb->session && dcb->session->service) ? dcb->session->service->name : ""),
(dcb->remote ? dcb->remote : ""));
return true;
}
/**
@ -1962,24 +1955,24 @@ dListDCBs(DCB *pdcb)
dcb_printf(pdcb, " %-16s | %-26s | %-18s | %s\n",
"DCB", "State", "Service", "Remote");
dcb_printf(pdcb, "------------------+----------------------------+--------------------+----------\n");
dcb_foreach(dlist_dcbs_cb, pdcb);
dcb_printf(pdcb, "------------------+----------------------------+--------------------+----------\n\n");
}
int nthr = config_threadcount();
static bool dlist_clients_cb(DCB *dcb, void *data)
{
DCB *pdcb = (DCB*)data;
for (int i = 0; i < nthr; i++)
if (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER)
{
spinlock_acquire(&all_dcbs_lock[i]);
for (DCB *dcb = all_dcbs[i]; dcb; dcb = dcb->thread.next)
{
dcb_printf(pdcb, " %-16p | %-26s | %-18s | %s\n",
dcb, gw_dcb_state2string(dcb->state),
((dcb->session && dcb->session->service) ? dcb->session->service->name : ""),
(dcb->remote ? dcb->remote : ""));
}
spinlock_release(&all_dcbs_lock[i]);
dcb_printf(pdcb, " %-15s | %16p | %-20s | %10p\n",
(dcb->remote ? dcb->remote : ""),
dcb, (dcb->session->service ?
dcb->session->service->name : ""),
dcb->session);
}
dcb_printf(pdcb, "------------------+----------------------------+--------------------+----------\n\n");
return true;
}
/**
@ -1995,27 +1988,7 @@ dListClients(DCB *pdcb)
dcb_printf(pdcb, " %-15s | %-16s | %-20s | %s\n",
"Client", "DCB", "Service", "Session");
dcb_printf(pdcb, "-----------------+------------------+----------------------+------------\n");
int nthr = config_threadcount();
for (int i = 0; i < nthr; i++)
{
spinlock_acquire(&all_dcbs_lock[i]);
for (DCB *dcb = all_dcbs[i]; dcb; dcb = dcb->thread.next)
{
if (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER)
{
dcb_printf(pdcb, " %-15s | %16p | %-20s | %10p\n",
(dcb->remote ? dcb->remote : ""),
dcb, (dcb->session->service ?
dcb->session->service->name : ""),
dcb->session);
}
}
spinlock_release(&all_dcbs_lock[i]);
}
dcb_foreach(dlist_clients_cb, pdcb);
dcb_printf(pdcb, "-----------------+------------------+----------------------+------------\n\n");
}
@ -3512,7 +3485,9 @@ void dcb_process_idle_sessions(int thr)
{
MXS_SESSION *session = dcb->session;
if (session->service && session->client_dcb && session->client_dcb->state == DCB_STATE_POLLING &&
if (session->service && session->client_dcb &&
session->client_dcb->state == DCB_STATE_POLLING &&
session->service->conn_idle_timeout &&
hkheartbeat - session->client_dcb->last_read > session->service->conn_idle_timeout * 10)
{
poll_fake_hangup_event(dcb);

View File

@ -1522,17 +1522,6 @@ void poll_fake_hangup_event(DCB *dcb)
poll_add_event_to_dcb(dcb, NULL, ev);
}
/**
* Print the event queue contents
*
* @param pdcb The DCB to print the event queue to
*/
void
dShowEventQ(DCB *pdcb)
{
}
/**
* Print the event queue statistics
*

View File

@ -597,7 +597,7 @@ spin_reporter(void *dcb, char *desc, int value)
}
/**
* Diagnostic to print all DCBs in persistent pool for a server
* Diagnostic to print number of DCBs in persistent pool for a server
*
* @param pdcb DCB to print results to
* @param server SERVER for which DCBs are to be printed
@ -605,22 +605,7 @@ spin_reporter(void *dcb, char *desc, int value)
void
dprintPersistentDCBs(DCB *pdcb, const SERVER *server)
{
DCB *dcb;
int nthr = config_threadcount();
for (int i = 0; i < nthr; i++)
{
#if SPINLOCK_PROFILE
dcb_printf(pdcb, "DCB List Spinlock Statistics:\n");
spinlock_stats(&server->persistlock, spin_reporter, pdcb);
#endif
dcb = server->persistent[i];
while (dcb)
{
dprintOneDCB(pdcb, dcb);
dcb = dcb->nextpersistent;
}
}
dcb_printf(pdcb, "Number of persistent DCBs: %d\n", server->stats.n_persistent);
}
/**

View File

@ -460,16 +460,6 @@ printAllSessions()
dcb_foreach(printAllSessions_cb, NULL);
}
/*
* @brief Print session list statistics
*
* @param pdcb DCB to print results to
*/
void
dprintSessionList(DCB *pdcb)
{
}
/** Callback for dprintAllSessions */
bool dprintAllSessions_cb(DCB *dcb, void *data)
{