Add "show persistent {server}"
This commit is contained in:
@ -199,7 +199,7 @@ char c;
|
|||||||
for (i = optind +1; i < argc; i++)
|
for (i = optind +1; i < argc; i++)
|
||||||
{
|
{
|
||||||
strcat(cmd, " ");
|
strcat(cmd, " ");
|
||||||
/* Arguments after the seconf are quoted to allow for names
|
/* Arguments after the second are quoted to allow for names
|
||||||
* that contain white space
|
* that contain white space
|
||||||
*/
|
*/
|
||||||
if (i - optind > 1)
|
if (i - optind > 1)
|
||||||
|
|||||||
@ -642,7 +642,7 @@ char *user;
|
|||||||
{
|
{
|
||||||
LOGIF(LD, (skygw_log_write(
|
LOGIF(LD, (skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"%lu [dcb_connect] Looking for persistent connection DCB user %s protocol %s\n", user, protocol)));
|
"%lu [dcb_connect] Looking for persistent connection DCB user %s protocol %s\n", pthread_self(), user, protocol)));
|
||||||
dcb = server_get_persistent(server, user, protocol);
|
dcb = server_get_persistent(server, user, protocol);
|
||||||
if (dcb)
|
if (dcb)
|
||||||
{
|
{
|
||||||
@ -662,7 +662,7 @@ char *user;
|
|||||||
dcb->dcb_server_status = server->status;
|
dcb->dcb_server_status = server->status;
|
||||||
LOGIF(LD, (skygw_log_write(
|
LOGIF(LD, (skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"%lu [dcb_connect] Reusing a persistent connection, dcb %p\n", dcb)));
|
"%lu [dcb_connect] Reusing a persistent connection, dcb %p\n", pthread_self(), dcb)));
|
||||||
return dcb;
|
return dcb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1474,6 +1474,67 @@ DCB *dcb;
|
|||||||
spinlock_release(&dcbspin);
|
spinlock_release(&dcbspin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Diagnostic to print all DCBs in persistent pool for a server
|
||||||
|
*
|
||||||
|
* @param pdcb DCB to print results to
|
||||||
|
* @param server SERVER for which DCBs are to be printed
|
||||||
|
*/
|
||||||
|
void dprintPersistentDCBs(DCB *pdcb, SERVER *server)
|
||||||
|
{
|
||||||
|
DCB *dcb;
|
||||||
|
|
||||||
|
spinlock_acquire(&server->persistlock);
|
||||||
|
#if SPINLOCK_PROFILE
|
||||||
|
dcb_printf(pdcb, "DCB List Spinlock Statistics:\n");
|
||||||
|
spinlock_stats(&dcbspin, spin_reporter, pdcb);
|
||||||
|
dcb_printf(pdcb, "Zombie Queue Lock Statistics:\n");
|
||||||
|
spinlock_stats(&zombiespin, spin_reporter, pdcb);
|
||||||
|
#endif
|
||||||
|
dcb = server->persistent;
|
||||||
|
while (dcb)
|
||||||
|
{
|
||||||
|
dcb_printf(pdcb, "DCB: %p\n", (void *)dcb);
|
||||||
|
dcb_printf(pdcb, "\tDCB state: %s\n",
|
||||||
|
gw_dcb_state2string(dcb->state));
|
||||||
|
if (dcb->session && dcb->session->service)
|
||||||
|
dcb_printf(pdcb, "\tService: %s\n",
|
||||||
|
dcb->session->service->name);
|
||||||
|
if (dcb->remote)
|
||||||
|
dcb_printf(pdcb, "\tConnected to: %s\n",
|
||||||
|
dcb->remote);
|
||||||
|
if (dcb->user)
|
||||||
|
dcb_printf(pdcb, "\tUsername: %s\n",
|
||||||
|
dcb->user);
|
||||||
|
if (dcb->writeq)
|
||||||
|
dcb_printf(pdcb, "\tQueued write data: %d\n",
|
||||||
|
gwbuf_length(dcb->writeq));
|
||||||
|
char *statusname = server_status(dcb->server);
|
||||||
|
if (statusname)
|
||||||
|
{
|
||||||
|
dcb_printf(pdcb, "\tServer status: %s\n", statusname);
|
||||||
|
free(statusname);
|
||||||
|
}
|
||||||
|
char *rolename = dcb_role_name(dcb);
|
||||||
|
if (rolename)
|
||||||
|
{
|
||||||
|
dcb_printf(pdcb, "\tRole: %s\n", rolename);
|
||||||
|
free(rolename);
|
||||||
|
}
|
||||||
|
dcb_printf(pdcb, "\tStatistics:\n");
|
||||||
|
dcb_printf(pdcb, "\t\tNo. of Reads: %d\n", dcb->stats.n_reads);
|
||||||
|
dcb_printf(pdcb, "\t\tNo. of Writes: %d\n", dcb->stats.n_writes);
|
||||||
|
dcb_printf(pdcb, "\t\tNo. of Buffered Writes: %d\n", dcb->stats.n_buffered);
|
||||||
|
dcb_printf(pdcb, "\t\tNo. of Accepts: %d\n", dcb->stats.n_accepts);
|
||||||
|
dcb_printf(pdcb, "\t\tNo. of High Water Events: %d\n", dcb->stats.n_high_water);
|
||||||
|
dcb_printf(pdcb, "\t\tNo. of Low Water Events: %d\n", dcb->stats.n_low_water);
|
||||||
|
if (dcb->flags & DCBF_CLONE)
|
||||||
|
dcb_printf(pdcb, "\t\tDCB is a clone.\n");
|
||||||
|
dcb = dcb->nextpersistent;
|
||||||
|
}
|
||||||
|
spinlock_release(&server->persistlock);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Diagnotic routine to print DCB data in a tabular form.
|
* Diagnotic routine to print DCB data in a tabular form.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
* 29/05/14 Mark Riddoch Add Filter support
|
* 29/05/14 Mark Riddoch Add Filter support
|
||||||
* 16/10/14 Mark Riddoch Add show eventq
|
* 16/10/14 Mark Riddoch Add show eventq
|
||||||
* 05/03/15 Massimiliano Pinto Added enable/disable feedback
|
* 05/03/15 Massimiliano Pinto Added enable/disable feedback
|
||||||
|
* 27/05/15 Martin Brampton Add show persistent [server]
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -154,6 +155,10 @@ struct subcommand showoptions[] = {
|
|||||||
"Show the monitors that are configured",
|
"Show the monitors that are configured",
|
||||||
"Show the monitors that are configured",
|
"Show the monitors that are configured",
|
||||||
{0, 0, 0} },
|
{0, 0, 0} },
|
||||||
|
{ "persistent", 1, dprintPersistentDCBs,
|
||||||
|
"Show persistent pool for a named server, e.g. show persistent dbnode1",
|
||||||
|
"Show persistent pool for a server, e.g. show persistent 0x485390. The address may also be replaced with the server name from the configuration file",
|
||||||
|
{ARG_TYPE_SERVER, 0, 0} },
|
||||||
{ "server", 1, dprintServer,
|
{ "server", 1, dprintServer,
|
||||||
"Show details for a named server, e.g. show server dbnode1",
|
"Show details for a named server, e.g. show server dbnode1",
|
||||||
"Show details for a server, e.g. show server 0x485390. The address may also be repalced with the server name from the configuration file",
|
"Show details for a server, e.g. show server 0x485390. The address may also be repalced with the server name from the configuration file",
|
||||||
|
|||||||
Reference in New Issue
Block a user