27 #define __STDC_FORMAT_MACROS 53 #include <sys/timeb.h> 55 #include <sys/types.h> 76 #if defined (SUPPRESS_STRLEN_WARNING) 77 #define strlen(s1) ((int) strlen(s1)) 80 #define DEFAULT_CHECK_PERIOD 300 81 #define MAX_APPL_NUM 100 83 #define FIELD_DELIMITER ' ' 85 #define FIELD_WIDTH_BROKER_NAME 20 86 #define FIELD_WIDTH_AS_ID 10 88 #define BROKER_MONITOR_FLAG_MASK 0x01 89 #define SHARDDB_MONITOR_FLAG_MASK 0x02 90 #define PROXY_MONITOR_FLAG_MASK 0x04 91 #define METADATA_MONITOR_FLAG_MASK 0x08 92 #define CLIENT_MONITOR_FLAG_MASK 0x10 93 #define UNUSABLE_DATABASES_FLAG_MASK 0x20 95 #if defined(WINDOWS) && !defined(PRId64) 198 {
FIELD_TPS, 20,
"TPS", FIELD_RIGHT_ALIGN},
199 {
FIELD_QPS, 20,
"QPS", FIELD_RIGHT_ALIGN},
230 {
FIELD_LQS, 10,
"LQS", FIELD_RIGHT_ALIGN},
321 static void ip2str (
unsigned char *ip,
char *ip_str);
322 static void time2str (
const time_t t,
char *str);
333 static int appl_monitor (
char *br_vector,
double elapsed_time);
337 static void time_format (
int t,
char *time_str);
350 static void move (
int x,
int y);
351 static void refresh ();
352 static void clear ();
353 static void clrtobot ();
354 static void clrtoeol ();
355 static void endwin ();
375 CONSOLE_SCREEN_BUFFER_INFO scr_info;
382 (void) WriteConsole (h_console, msg,
strlen (msg), &size,
NULL);
397 vsprintf (out_buf, fmt, ap);
428 if (shm_br !=
NULL && shm_br->
magic == 0)
453 int num_broker, master_shm_id;
460 time_t time_old, time_cur;
463 if (argc == 2 && strcmp (argv[1],
"--version") == 0)
465 fprintf (stderr,
"VERSION %s\n",
makestring (BUILD_NUMBER));
481 fprintf (stdout,
"master shared memory open error[0x%x]\r\n", master_shm_id);
490 br_vector = (
char *) malloc (shm_br->
num_broker);
491 if (br_vector ==
NULL)
501 if (
get_args (argc, argv, br_vector) < 0)
510 h_console = GetStdHandle (STD_OUTPUT_HANDLE);
511 if (h_console ==
NULL)
515 if (!GetConsoleScreenBufferInfo (h_console, &scr_info))
517 scr_info.dwSize.X = 80;
518 scr_info.dwSize.Y = 50;
528 (void) time (&time_old);
533 (void) time (&time_cur);
534 elapsed_time = difftime (time_cur, time_old);
542 if (shm_br ==
NULL || shm_br->
magic == 0)
589 str_out (
"<SHARD METADATA INFO>");
608 if ((
monitor_flag & ~UNUSABLE_DATABASES_FLAG_MASK) != 0)
631 #if defined (WINDOWS) 632 if (shm_br !=
NULL && shm_br->
magic == 0)
642 else if (in_ch ==
'' || in_ch ==
'\r' || in_ch ==
'\n' || in_ch ==
' ')
650 for (i = 0; i < 10; i++)
652 #if defined (WINDOWS) 653 if (shm_br !=
NULL && shm_br->
magic == 0)
668 if (elapsed_time > 0)
690 printf (
"broker_monitor [-b] [-q] [-t] [-s <sec>] [-S] [-P] [-m] [-c] [-u] [-f] [<expr>]\n");
691 printf (
"\t<expr> part of broker name or SERVICE=[ON|OFF]\n");
692 printf (
"\t-q display job queue\n");
693 printf (
"\t-m display shard statistics information\n");
694 printf (
"\t-c display client information\n");
695 printf (
"\t-u display unusable database server\n");
696 printf (
"\t-b brief mode (show broker info)\n");
697 printf (
"\t-S brief mode (show sharddb info)\n");
698 printf (
"\t-P brief mode (show proxy info)\n");
699 printf (
"\t-s refresh time in sec\n");
700 printf (
"\t-f full info\n");
708 bool br_name_opt_flag =
false;
709 #if !defined(WINDOWS) 713 char optchars[] =
"hbqts:l:fmcSPu";
721 while ((c =
getopt (argc, argv, optchars)) != EOF)
771 if (br_name_opt_flag ==
false)
773 if (strncasecmp (argv[
optind],
"SERVICE=",
strlen (
"SERVICE=")) == 0)
777 if (strcasecmp (value_p,
"ON") == 0)
782 else if (strcasecmp (value_p,
"OFF") == 0)
795 br_name_opt_flag =
true;
796 #if !defined(WINDOWS) 797 if (regcomp (&re, argv[
optind], 0) != 0)
799 fprintf (stderr,
"%s\r\n", argv[optind]);
806 status = (strstr (shm_br->
br_info[j].
name, argv[optind]) !=
NULL) ? 0 : 1;
815 #if !defined(WINDOWS) 820 if (br_name_opt_flag ==
false)
846 sprintf (outbuf,
"%5s %s%9s%13s%13s",
"ID",
"PRIORITY",
"IP",
"TIME",
"REQUEST");
865 sprintf (ip_str,
"%d.%d.%d.%d", (
unsigned char) ip[0], (
unsigned char) ip[1], (
unsigned char) ip[2],
866 (
unsigned char) ip[3]);
874 if (localtime_r (&t, &s_tm) ==
NULL)
879 sprintf (str,
"%02d:%02d:%02d", s_tm.tm_hour, s_tm.tm_min, s_tm.tm_sec);
894 #if !defined (WINDOWS) 897 #if defined (GET_PSINFO) || defined (WINDOWS) 910 as_id = as_index + 1;
934 if (shard_flag ==
ON)
938 if (snprintf (as_id_str,
sizeof (as_id_str),
"%d-%d-%d", proxy_id, shard_id, as_id) < 0)
950 if (elapsed_time > 0)
956 appl_mnt_old->
qps = qps;
957 appl_mnt_old->
lqs = lqs;
961 qps = appl_mnt_old->
qps;
962 lqs = appl_mnt_old->
lqs;
971 if (shm_appl->use_pdh_flag ==
TRUE)
987 time_format (proc_info.cpu_time, time_str);
990 if (shm_appl->use_pdh_flag ==
TRUE)
1028 if (tran_start_time != (time_t) 0)
1052 int i, j, k, appl_offset;
1057 time_t current_time;
1063 if (appl_mnt_olds ==
NULL)
1072 if (appl_mnt_olds ==
NULL)
1081 if (br_vector[i] == 0)
1098 if (shm_appl ==
NULL)
1100 str_out (
"%s",
"shared memory open error");
1107 #if defined (WINDOWS) 1112 current_time = time (
NULL);
1117 for (k = 0; k <
i; k++)
1124 current_time, elapsed_time);
1158 static unsigned int tty_print_header = 0;
1191 char field_title_with_interval[256];
1196 sprintf (field_title_with_interval,
"%d%s",
state_interval,
"s-W");
1198 sprintf (field_title_with_interval,
"%d%s",
state_interval,
"s-B)");
1267 for (i = 0; i < buf_offset; i++)
1288 mnt_item_p = mnt_items;
1293 as_info_p = &(shm_appl->
as_info[
i]);
1297 mnt_item_p = mnt_items + as_info_p->
shard_id;
1301 mnt_item_p = mnt_items + as_info_p->
proxy_id;
1309 time_t cur_time = time (
NULL);
1314 if (as_info_p->
log_msg[0] ==
'\0')
1331 #if defined(WINDOWS) 1332 else if (as_info_p->
uts_status == UTS_STATUS_BUSY_WAIT)
1368 for (i = 0; i < shm_proxy->
num_proxy; i++)
1381 for (i = 0; i < shm_proxy->
num_proxy; i++)
1384 for (j = 0; j < proxy_info_p->
max_shard; j++)
1396 for (i = 0; i < shm_proxy->
num_proxy; i++)
1407 for (j = 0; j < proxy_info_p->
max_shard; j++)
1436 for (i = 0; i < num_mnt_items; i++)
1438 mnt_item_cur_p = &mnt_items_cur[
i];
1439 mnt_item_old_p = &mnt_items_old[
i];
1441 if (elapsed_time > 0)
1443 mnt_item.
tps = (mnt_item_cur_p->
num_tx - mnt_item_old_p->
num_tx) / elapsed_time;
1444 mnt_item.
qps = (mnt_item_cur_p->
num_qx - mnt_item_old_p->
num_qx) / elapsed_time;
1464 mnt_item_cur_p->
tps = mnt_item.
tps;
1465 mnt_item_cur_p->
qps = mnt_item.
qps;
1466 mnt_item_cur_p->
lts = mnt_item.
lts;
1467 mnt_item_cur_p->
lqs = mnt_item.
lqs;
1468 mnt_item_cur_p->
eqs = mnt_item.
eqs;
1470 mnt_item_cur_p->
its = mnt_item.
its;
1474 memcpy (&mnt_item, mnt_item_old_p,
sizeof (mnt_item));
1482 #if defined(WINDOWS) 1483 if (shm_appl->use_pdh_flag ==
TRUE)
1534 time_format (proc_info.
cpu_time, time_str);
1583 float stmt_pool_ratio;
1612 int max_num_mnt_items = 0;
1615 int broker_name_size;
1619 for (br_index = 0; br_index < shm_br->
num_broker; br_index++)
1621 if (br_vector[br_index] == 0)
1627 if (broker_name_size > max_broker_name_size)
1629 max_broker_name_size = broker_name_size;
1643 if (mnt_items_old[mnt_type] ==
NULL)
1646 if (mnt_items_old[mnt_type] ==
NULL)
1652 if (mnt_items_cur_p ==
NULL)
1657 if (mnt_items_cur_p ==
NULL)
1659 str_out (
"%s",
"malloc error");
1665 for (br_index = 0; br_index < shm_br->
num_broker; br_index++)
1669 if (br_vector[br_index] == 0)
1714 if (shm_appl ==
NULL)
1716 str_out (
"%s",
"shared memory open error");
1724 if (shm_proxy_p ==
NULL)
1726 str_out (
"%s",
"shared memory open error");
1734 assert (num_mnt_items > 0);
1738 if (mnt_items_old[mnt_type][br_index] ==
NULL)
1740 mnt_items_old[mnt_type][
br_index] =
1742 if (mnt_items_old[mnt_type][br_index] ==
NULL)
1744 str_out (
"%s",
"malloc error");
1750 mnt_items_old_p = mnt_items_old[mnt_type][
br_index];
1752 set_monitor_items (mnt_items_cur_p, br_info_p, shm_appl, shm_proxy_p, mnt_type);
1754 print_monitor_items (mnt_items_cur_p, mnt_items_old_p, num_mnt_items, elapsed_time, br_info_p, shm_appl,
1756 memcpy (mnt_items_old_p, mnt_items_cur_p,
sizeof (
BR_MONITORING_ITEM) * num_mnt_items);
1788 time_format (
int t,
char *time_str)
1794 sprintf (time_str,
"%d:%02d", min, sec);
1811 #if defined(WINDOWS) 1814 #if defined(WINDOWS) 1815 if (use_pdh_flag ==
true)
1830 if (use_pdh_flag ==
true)
1853 for (i = 0; i < buf_offset; i++)
1865 #if defined(WINDOWS) 1878 SetConsoleCursorPosition (h_console, pos);
1888 FillConsoleOutputCharacter (h_console,
' ', scr_info.dwSize.X * scr_info.dwSize.Y, pos, &size);
1894 CONSOLE_SCREEN_BUFFER_INFO scr_buf_info;
1897 if (!GetConsoleScreenBufferInfo (h_console, &scr_buf_info))
1901 FillConsoleOutputCharacter (h_console,
' ',
1902 (scr_buf_info.dwSize.Y - scr_buf_info.dwCursorPosition.Y) * scr_buf_info.dwSize.X,
1903 scr_buf_info.dwCursorPosition, &size);
1909 CONSOLE_SCREEN_BUFFER_INFO scr_buf_info;
1912 if (!GetConsoleScreenBufferInfo (h_console, &scr_buf_info))
1916 FillConsoleOutputCharacter (h_console,
' ', scr_buf_info.dwSize.X - scr_buf_info.dwCursorPosition.X + 1,
1917 scr_buf_info.dwCursorPosition, &size);
1918 move (scr_buf_info.dwSize.X, scr_buf_info.dwCursorPosition.Y);
1950 INT64 err_queries = 0;
1952 int shard_stat_items_size;
1953 int key_stat_items_size;
1956 static INT64 *err_queries_old =
NULL;
1964 char line_buf[1024];
1966 int proxy_index, shard_index;
1967 int num_proxy, num_shard;
1969 INT64 num_hint_key_qr;
1970 INT64 num_hint_id_qr;
1971 INT64 num_no_hint_qr;
1980 if (err_queries_old ==
NULL)
1982 err_queries_old = (INT64 *) calloc (
sizeof (INT64), shm_br->
num_broker);
1983 if (err_queries_old ==
NULL)
1985 goto free_and_error;
1989 if (shard_stat_items_old ==
NULL)
1992 if (shard_stat_items_old ==
NULL)
1994 goto free_and_error;
1996 memset ((
void *) shard_stat_items_old, 0, shard_stat_items_size * shm_br->
num_broker);
1999 if (key_stat_items_old ==
NULL)
2002 if (key_stat_items_old ==
NULL)
2004 goto free_and_error;
2006 memset ((
void *) key_stat_items_old, 0, key_stat_items_size * shm_br->
num_broker);
2027 if (shm_proxy_p ==
NULL)
2029 str_out (
"%s",
"shared memory open error");
2030 goto free_and_error;
2039 shard_stat_items_old_p = (
SHARD_STAT_ITEM *) (((
char *) shard_stat_items_old) + (shard_stat_items_size *
i));
2040 key_stat_items_old_p = (
KEY_STAT_ITEM *) (((
char *) key_stat_items_old) + (key_stat_items_size * i));
2048 str_out (
"LIBRARY_NAME : %s, ",
2051 str_out (
"FUNCTION_NAME : %s ",
2060 for (j = 0; j < num_shard; j++)
2072 str_out (
"ACTIVE-PROXY : %d, ", num_proxy);
2076 if (shard_stat_items !=
NULL)
2078 free ((
char *) shard_stat_items);
2081 if (shard_stat_items ==
NULL)
2083 str_out (
"%s",
"malloc error");
2084 goto free_and_error;
2089 for (proxy_index = 0; proxy_index < shm_proxy_p->
num_proxy; proxy_index++)
2096 if (shard_stat_p ==
NULL)
2098 str_out (
"%s",
"shard_stat open error");
2099 goto free_and_error;
2109 if (elapsed_time > 0)
2111 num_err_qr = err_queries - err_queries_old[
i];
2113 num_err_qr = num_err_qr / elapsed_time;
2117 num_err_qr = err_queries;
2120 str_out (
"NUM-NO-HINT-ERR-Q : %d", num_err_qr);
2125 str_out (
"SHARD STATISTICS ");
2129 col_len += sprintf (buf + col_len,
"%5s ",
"ID");
2130 col_len += sprintf (buf + col_len,
"%10s ",
"NUM-KEY-Q");
2131 col_len += sprintf (buf + col_len,
"%10s ",
"NUM-ID-Q");
2132 col_len += sprintf (buf + col_len,
"%15s ",
"NUM-NO-HINT-Q");
2133 col_len += sprintf (buf + col_len,
"%15s ",
"SUM");
2135 for (k = 0; k < col_len; k++)
2146 for (j = 0; j < num_shard; j++)
2148 if (elapsed_time > 0)
2159 num_all_qr = num_hint_key_qr + num_hint_id_qr + num_no_hint_qr;
2161 num_hint_key_qr = num_hint_key_qr / elapsed_time;
2162 num_hint_id_qr = num_hint_id_qr / elapsed_time;
2163 num_no_hint_qr = num_no_hint_qr / elapsed_time;
2164 num_all_qr = num_all_qr / elapsed_time;
2171 num_all_qr = num_hint_key_qr + num_hint_id_qr + num_no_hint_qr;
2174 str_out (
"\t%5d %10" PRId64
" %10" PRId64
" %15" PRId64
" %15" PRId64, j, num_hint_key_qr, num_hint_id_qr,
2175 num_no_hint_qr, num_all_qr);
2186 memset (buf,
'\0', 1024);
2187 col_len += sprintf (buf,
"%12s",
"PROXY_ID");
2188 for (j = 0; j < num_proxy; j++)
2190 col_len += sprintf (buf + col_len,
"%7d ", j + 1);
2199 for (k = 0; k < col_len; k++)
2208 for (proxy_index = 0; proxy_index < num_proxy; proxy_index++)
2211 for (shard_index = 0; shard_index < num_shard; shard_index++)
2215 num_shard_q_arr[proxy_index][shard_index] = shard_info_p->
waiter_count;
2219 for (shard_index = 0; shard_index < num_shard; shard_index++)
2221 str_out (
"\t%3d", shard_index);
2224 for (proxy_index = 0; proxy_index < num_proxy; proxy_index++)
2235 if (key_stat_items !=
NULL)
2237 free ((
char *) key_stat_items);
2240 if (key_stat_items ==
NULL)
2242 str_out (
"%s",
"malloc error");
2243 goto free_and_error;
2247 for (proxy_index = 0; proxy_index < num_proxy; proxy_index++)
2252 if (key_stat_p ==
NULL)
2254 str_out (
"%s",
"key_stat open error");
2255 goto free_and_error;
2275 col_len += sprintf (buf + col_len,
"%5s ~ ",
"MIN");
2276 col_len += sprintf (buf + col_len,
"%5s : ",
"MAX");
2277 col_len += sprintf (buf + col_len,
"%10s",
"SHARD");
2278 col_len += sprintf (buf + col_len,
"%10s",
"NUM-Q");
2279 for (k = 0; k < col_len; k++)
2294 if (elapsed_time > 0)
2300 num_range_qr = num_range_qr / elapsed_time;
2307 str_out (
"\t%5d ~ %5d : %10d %9" PRId64, range_p->
min, range_p->
max, range_p->
shard_id, num_range_qr);
2325 err_queries_old[
i] = num_err_qr;
2327 if (shard_stat_items)
2329 memcpy ((
void *) shard_stat_items_old_p, shard_stat_items,
2346 if (shard_stat_items !=
NULL)
2348 free ((
char *) shard_stat_items);
2350 if (key_stat_items !=
NULL)
2352 free ((
char *) key_stat_items);
2354 if (shm_proxy_p !=
NULL)
2367 int i, len, proxy_index, client_index;
2390 if (shm_proxy_p ==
NULL)
2392 str_out (
"%s",
"shared memory open error");
2397 for (proxy_index = 0; proxy_index < shm_proxy_p->
num_proxy; proxy_index++)
2401 str_out (
"%% %s(%d), MAX-CLIENT : %d, CUR-CLIENT : %d", shm_br->
br_info[i].
name, proxy_index,
2407 col_len += sprintf (buf + col_len,
"%10s",
"CLIENT-ID");
2408 col_len += sprintf (buf + col_len,
"%20s",
"CLIENT-IP");
2409 col_len += sprintf (buf + col_len,
"%22s",
"CONN-TIME");
2410 col_len += sprintf (buf + col_len,
"%22s",
"LAST-REQ-TIME");
2411 col_len += sprintf (buf + col_len,
"%22s",
"LAST-RES-TIME");
2412 col_len += sprintf (buf + col_len,
"%15s",
"LAST-REQ-CODE");
2414 for (len = 0; len < col_len; len++)
2415 line_buf[len] =
'-';
2416 line_buf[len] =
'\0';
2424 for (client_index = 0; client_index < proxy_info_p->
max_context; client_index++)
2436 ct1.tm_year += 1900;
2437 str_out (
" %04d/%02d/%02d %02d:%02d:%02d", ct1.tm_year, ct1.tm_mon + 1, ct1.tm_mday, ct1.tm_hour,
2438 ct1.tm_min, ct1.tm_sec);
2441 localtime_r (&client_info_p->
req_time, &ct1);
2442 ct1.tm_year += 1900;
2443 str_out (
" %04d/%02d/%02d %02d:%02d:%02d", ct1.tm_year, ct1.tm_mon + 1, ct1.tm_mday,
2444 ct1.tm_hour, ct1.tm_min, ct1.tm_sec);
2453 localtime_r (&client_info_p->
res_time, &ct1);
2454 ct1.tm_year += 1900;
2455 str_out (
" %04d/%02d/%02d %02d:%02d:%02d", ct1.tm_year, ct1.tm_mon + 1, ct1.tm_mday,
2456 ct1.tm_hour, ct1.tm_min, ct1.tm_sec);
2488 for (i =
strlen (buf); i > 0; i--)
2504 if (shm_appl ==
NULL)
2506 str_out (
"%s",
"shared memory open error");
2540 const char *title_p =
NULL;
2543 assert (buf_offset >= 0);
2545 field_p = &fields[
name];
2547 if (new_title_p !=
NULL)
2549 title_p = new_title_p;
2553 title_p = field_p->
title;
2556 switch (field_p->
name)
2562 buf_offset += sprintf (buf_p + buf_offset,
"%-*s", field_p->
width, title_p);
2566 buf_offset += sprintf (buf_p + buf_offset,
"%*s", field_p->
width, title_p);
2572 buf_offset += sprintf (buf_p + buf_offset,
"%-*s", field_p->
width, title_p);
2576 buf_offset += sprintf (buf_p + buf_offset,
"%*s", field_p->
width, title_p);
2594 field_p = &fields[
name];
2601 str_out (
"%-*d", field_p->
width, *(
const int *) value_p);
2605 str_out (
"%*d", field_p->
width, *(
const int *) value_p);
2611 str_out (
"%-*s", field_p->
width, (
const char *) value_p);
2615 str_out (
"%*s", field_p->
width, (
const char *) value_p);
2621 str_out (
"%-*f", field_p->
width, *(
const float *) value_p);
2625 str_out (
"%*f", field_p->
width, *(
const float *) value_p);
2631 str_out (
"%-*lu", field_p->
width, *(
const UINT64 *) value_p);
2635 str_out (
"%*lu", field_p->
width, *(
const UINT64 *) value_p);
2641 str_out (
"%-*ld", field_p->
width, *(
const INT64 *) value_p);
2645 str_out (
"%*ld", field_p->
width, *(
const INT64 *) value_p);
2649 localtime_r ((
const time_t *) value_p, &cur_tm);
2650 cur_tm.tm_year += 1900;
2651 sprintf (time_buf,
"%02d/%02d/%02d %02d:%02d:%02d", cur_tm.tm_year, cur_tm.tm_mon + 1, cur_tm.tm_mday,
2652 cur_tm.tm_hour, cur_tm.tm_min, cur_tm.tm_sec);
2691 return num_mnt_items;
2720 return (replica_only_flag ?
"RO-REPLICA" :
"RO");
2722 return (replica_only_flag ?
"SO-REPLICA" :
"SO");
2724 return (replica_only_flag ?
"RW-REPLICA" :
"RW");
2741 return "CLOSE_WAIT";
2743 else if (as_info_p->
log_msg[0] ==
'\0')
2745 return "CLIENT_WAIT";
2757 #if defined(WINDOWS) 2758 else if (as_info_p->
uts_status == UTS_STATUS_BUSY_WAIT)
2765 return "INITIALIZE";
2786 sprintf (buf_p,
"%.2f", usage);
2790 sprintf (buf_p,
" - ");
#define SLEEP_MILISEC(sec, msec)
void ut_cd_work_dir(void)
INT64 num_no_hint_queries_requested
char shard_key_library_name[BROKER_INFO_NAME_MAX]
static void print_monitor_items(BR_MONITORING_ITEM *mnt_items_cur, BR_MONITORING_ITEM *mnt_items_old, int num_mnt_items, double elapsed_time, T_BROKER_INFO *br_info_p, T_SHM_APPL_SERVER *shm_appl, MONITOR_TYPE mnt_type)
INT64 num_long_transactions
char database_name[SRV_CON_DBNAME_SIZE]
char database_name[SRV_CON_DBNAME_SIZE]
static void print_job_queue(T_MAX_HEAP_NODE *)
int max_heap_delete(T_MAX_HEAP_NODE *max_heap, T_MAX_HEAP_NODE *ret)
static char service_filter_value
T_MAX_HEAP_NODE job_queue[JOB_QUEUE_MAX_SIZE+1]
#define PRINT_AND_LOG_ERR_MSG(...)
char shard_key_function_name[BROKER_INFO_NAME_MAX]
UINT64 num_client_wait_nsec
T_PROXY_INFO proxy_info[MAX_PROXY_NUM]
T_SHARD_INFO * shard_shm_find_shard_info(T_PROXY_INFO *proxy_info_p, int shard_id)
INT64 num_no_hint_queries_requested
int getopt(int, char *const *, const char *)
#define FIELD_WIDTH_BROKER_NAME
T_SHARD_CONN shard_conn[MAX_SHARD_CONN]
char * ut_get_ipv4_string(char *ip_str, int len, const unsigned char *ip_addr)
T_PROXY_INFO * shard_shm_find_proxy_info(T_SHM_PROXY *proxy_p, int proxy_id)
unsigned char cas_clt_ip[4]
#define JOB_QUEUE_MAX_SIZE
static int print_title(char *buf_p, int buf_offset, FIELD_NAME name, const char *new_title_p)
#define SHARDDB_MONITOR_FLAG_MASK
char broker_name[BROKER_NAME_LEN]
static T_BROKER_INFO * br_info_p
char log_msg[SHM_LOG_MSG_SIZE]
static int last_access_sec
static const char * get_access_mode_string(T_ACCESS_MODE_VALUE mode, int replica_only_flag)
T_SHARD_KEY_RANGE range[SHARD_KEY_RANGE_MAX]
static int brief_monitor(char *br_vector, MONITOR_TYPE mnt_type, double elapsed_time)
static T_SHM_PROXY * shm_proxy_p
int unusable_databases_cnt[PAIR_LIST]
#define UTS_STATUS_RESTART
struct status_field fields[FIELD_LAST+1]
INT64 num_unique_error_queries
static int appl_monitor(char *br_vector, double elapsed_time)
static void appl_info_display(T_SHM_APPL_SERVER *shm_appl, T_APPL_SERVER_INFO *as_info_p, int br_index, int as_index, APPL_MONITORING_ITEM *appl_mnt_old, time_t current_time, double elapsed_time)
INT64 num_queries_processed
T_SHM_SHARD_CONN_STAT * shard_shm_get_shard_stat(T_PROXY_INFO *proxy_info_p, int idx)
T_SHARD_INFO shard_info[SHARD_INFO_SIZE_LIMIT]
T_DB_SERVER unusable_databases[PAIR_LIST][UNUSABLE_DATABASE_MAX]
#define FIELD_WIDTH_AS_ID
static int state_interval
static void print_appl_header(bool use_pdh_flag)
#define PROXY_MONITOR_FLAG_MASK
char db_name[SRV_CON_DBNAME_SIZE]
T_SHM_SHARD_KEY_RANGE_STAT stat[SHARD_KEY_RANGE_MAX]
INT64 num_connect_requests
static void set_monitor_items(BR_MONITORING_ITEM *mnt_items, T_BROKER_INFO *br_info, T_SHM_APPL_SERVER *shm_appl, T_SHM_PROXY *shm_proxy, MONITOR_TYPE mnt_type)
int broker_config_read(const char *conf_file, T_BROKER_INFO *br_info, int *num_broker, int *br_shm_id, char *admin_log_file, char admin_flag, bool *acl_flag, char *acl_file, char *admin_err_msg)
int long_transaction_time
char database_host[CUB_MAXHOSTNAMELEN]
int main(int argc, char **argv)
static void get_cpu_usage_string(char *buf_p, float usage)
INT64 num_range_queries_requested[SHARD_KEY_RANGE_MAX]
unsigned int unusable_databases_seq
static void print_newline()
#define UTS_STATUS_CON_WAIT
static void print_usage(void)
static bool display_job_queue
static void time2str(const time_t t, char *str)
static void print_monitor_header(MONITOR_TYPE mnt_type)
INT64 num_connect_requests
INT64 num_hint_err_queries_processed
static int get_args(int argc, char *argv[], char *br_vector)
void uw_shm_detach(void *p)
T_SHM_SHARD_KEY * shm_key_p
static int unusable_databases_monitor(void)
static enum scanner_mode mode
#define SHARD_KEY_RANGE_MAX
#define SHARD_INFO_SIZE_LIMIT
#define UNUSABLE_DATABASES_FLAG_MASK
enum t_sql_log_mode_value T_SQL_LOG_MODE_VALUE
static void str_to_screen(const char *msg)
time_t transaction_start_time
static int client_monitor(void)
T_SHM_SHARD_USER * shm_user_p
INT64 num_connect_rejected
T_CLIENT_INFO * shard_shm_get_client_info(T_PROXY_INFO *proxy_info_p, int idx)
static int get_char(void)
char db_conn_info[MAX_CONN_INFO_LENGTH]
UINT64 num_connect_reject
#define CLIENT_MONITOR_FLAG_MASK
char script[PRE_SEND_SCRIPT_SIZE]
INT64 num_transactions_processed
static unsigned int monitor_flag
INT64 num_hint_key_queries_requested
static T_SHM_APPL_SERVER * shm_appl
enum t_access_mode_value T_ACCESS_MODE_VALUE
char database_host[CUB_MAXHOSTNAMELEN]
struct timeval tran_start_time
T_PROXY_INFO * proxy_info_p
INT64 num_query_processed
static void error(const char *msg)
char prg_name[PRE_SEND_PRG_NAME_SIZE]
INT64 num_request_stmt_in_pool
#define IS_APPL_SERVER_TYPE_CAS(x)
INT64 num_range_queries_requested
struct key_stat_item KEY_STAT_ITEM
T_SHARD_KEY shard_key[MAX_SHARD_KEY]
INT64 num_requests_received
INT64 num_hint_id_queries_requested
INT64 num_hint_id_queries_requested
T_SHM_SHARD_KEY_STAT * shard_shm_get_key_stat(T_PROXY_INFO *proxy_info_p, int idx)
static void str_out(const char *fmt,...)
T_SHARD_USER shard_user[1]
static void print_value(FIELD_NAME name, const void *value, FIELD_TYPE type)
static int metadata_monitor(double elapsed_time)
char key_column[SHARD_KEY_COLUMN_LEN]
char name[BROKER_NAME_LEN]
static void ip2str(unsigned char *ip, char *ip_str)
int get_psinfo(int pid, T_PSINFO *ps)
static int get_num_monitor_items(MONITOR_TYPE mnt_type, T_SHM_PROXY *shm_proxy_p)
INT64 num_hint_key_queries_requested
char driver_version[SRV_CON_VER_STR_MAX_SIZE]
static const char * get_status_string(T_APPL_SERVER_INFO *as_info_p, char appl_server)
T_APPL_SERVER_INFO as_info[APPL_SERVER_NUM_LIMIT]
static T_SHM_BROKER * shm_br
#define BROKER_MONITOR_FLAG_MASK
INT64 num_proxy_error_processed
#define METADATA_MONITOR_FLAG_MASK
char * ut_uchar2ipstr(unsigned char *ip_addr)
char db_user[SRV_CON_DBUSER_SIZE]
void * uw_shm_open(int shm_key, int which_shm, T_SHM_MODE shm_mode)
static bool full_info_flag
T_SHM_SHARD_CONN * shm_conn_p
UINT64 num_request_stmt_in_pool
UINT64 shard_waiter_count
static const char * get_sql_log_mode_string(T_SQL_LOG_MODE_VALUE mode)
INT64 num_connect_rejected
struct shard_stat_item SHARD_STAT_ITEM
char db_name[MAX_DBNAME_LENGTH]
void clear(cub_regex_object *®ex, char *&pattern)