Skip to content

Commit 3ed384b

Browse files
author
Jan Lindström
committed
Merge pull request #94 from ericherman/evict_table_metric
Evict table metric
2 parents cf154cc + f66ef6a commit 3ed384b

File tree

6 files changed

+40
-4
lines changed

6 files changed

+40
-4
lines changed

storage/innobase/include/srv0mon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ enum monitor_id_t {
378378
MONITOR_SRV_MEM_VALIDATE_MICROSECOND,
379379
MONITOR_SRV_PURGE_MICROSECOND,
380380
MONITOR_SRV_DICT_LRU_MICROSECOND,
381+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE,
382+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE,
381383
MONITOR_SRV_CHECKPOINT_MICROSECOND,
382384
MONITOR_OVLD_SRV_DBLWR_WRITES,
383385
MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN,

storage/innobase/srv/srv0mon.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,16 @@ static monitor_info_t innodb_counter_info[] =
11961196
MONITOR_NONE,
11971197
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_MICROSECOND},
11981198

1199+
{"innodb_dict_lru_count_active", "server",
1200+
"Number of tables evicted from DICT LRU list in the active loop",
1201+
MONITOR_NONE,
1202+
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE},
1203+
1204+
{"innodb_dict_lru_count_idle", "server",
1205+
"Number of tables evicted from DICT LRU list in the idle loop",
1206+
MONITOR_NONE,
1207+
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE},
1208+
11991209
{"innodb_checkpoint_usec", "server",
12001210
"Time (in microseconds) spent by master thread to do checkpoint",
12011211
MONITOR_NONE,

storage/innobase/srv/srv0srv.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,6 +2274,7 @@ srv_master_do_active_tasks(void)
22742274
{
22752275
ib_time_t cur_time = ut_time();
22762276
ullint counter_time = ut_time_us(NULL);
2277+
ulint n_evicted = 0;
22772278

22782279
/* First do the tasks that we are suppose to do at each
22792280
invocation of this function. */
@@ -2334,7 +2335,9 @@ srv_master_do_active_tasks(void)
23342335

23352336
if (cur_time % SRV_MASTER_DICT_LRU_INTERVAL == 0) {
23362337
srv_main_thread_op_info = "enforcing dict cache limit";
2337-
srv_master_evict_from_table_cache(50);
2338+
n_evicted = srv_master_evict_from_table_cache(50);
2339+
MONITOR_INC_VALUE(
2340+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE, n_evicted);
23382341
MONITOR_INC_TIME_IN_MICRO_SECS(
23392342
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
23402343
}
@@ -2366,6 +2369,7 @@ srv_master_do_idle_tasks(void)
23662369
/*==========================*/
23672370
{
23682371
ullint counter_time;
2372+
ulint n_evicted = 0;
23692373

23702374
++srv_main_idle_loops;
23712375

@@ -2403,7 +2407,9 @@ srv_master_do_idle_tasks(void)
24032407
}
24042408

24052409
srv_main_thread_op_info = "enforcing dict cache limit";
2406-
srv_master_evict_from_table_cache(100);
2410+
n_evicted = srv_master_evict_from_table_cache(100);
2411+
MONITOR_INC_VALUE(
2412+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE, n_evicted);
24072413
MONITOR_INC_TIME_IN_MICRO_SECS(
24082414
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
24092415

storage/xtradb/include/srv0mon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ enum monitor_id_t {
379379
MONITOR_SRV_MEM_VALIDATE_MICROSECOND,
380380
MONITOR_SRV_PURGE_MICROSECOND,
381381
MONITOR_SRV_DICT_LRU_MICROSECOND,
382+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE,
383+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE,
382384
MONITOR_SRV_CHECKPOINT_MICROSECOND,
383385
MONITOR_OVLD_SRV_DBLWR_WRITES,
384386
MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN,

storage/xtradb/srv/srv0mon.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,16 @@ static monitor_info_t innodb_counter_info[] =
11961196
MONITOR_NONE,
11971197
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_MICROSECOND},
11981198

1199+
{"innodb_dict_lru_count_active", "server",
1200+
"Number of tables evicted from DICT LRU list in the active loop",
1201+
MONITOR_NONE,
1202+
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE},
1203+
1204+
{"innodb_dict_lru_count_idle", "server",
1205+
"Number of tables evicted from DICT LRU list in the idle loop",
1206+
MONITOR_NONE,
1207+
MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE},
1208+
11991209
{"innodb_checkpoint_usec", "server",
12001210
"Time (in microseconds) spent by master thread to do checkpoint",
12011211
MONITOR_NONE,

storage/xtradb/srv/srv0srv.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,6 +2881,7 @@ srv_master_do_active_tasks(void)
28812881
{
28822882
ib_time_t cur_time = ut_time();
28832883
ullint counter_time = ut_time_us(NULL);
2884+
ulint n_evicted = 0;
28842885

28852886
/* First do the tasks that we are suppose to do at each
28862887
invocation of this function. */
@@ -2941,7 +2942,9 @@ srv_master_do_active_tasks(void)
29412942

29422943
if (cur_time % SRV_MASTER_DICT_LRU_INTERVAL == 0) {
29432944
srv_main_thread_op_info = "enforcing dict cache limit";
2944-
srv_master_evict_from_table_cache(50);
2945+
n_evicted = srv_master_evict_from_table_cache(50);
2946+
MONITOR_INC_VALUE(
2947+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE, n_evicted);
29452948
MONITOR_INC_TIME_IN_MICRO_SECS(
29462949
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
29472950
}
@@ -2973,6 +2976,7 @@ srv_master_do_idle_tasks(void)
29732976
/*==========================*/
29742977
{
29752978
ullint counter_time;
2979+
ulint n_evicted = 0;
29762980

29772981
++srv_main_idle_loops;
29782982

@@ -3010,7 +3014,9 @@ srv_master_do_idle_tasks(void)
30103014
}
30113015

30123016
srv_main_thread_op_info = "enforcing dict cache limit";
3013-
srv_master_evict_from_table_cache(100);
3017+
n_evicted = srv_master_evict_from_table_cache(100);
3018+
MONITOR_INC_VALUE(
3019+
MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE, n_evicted);
30143020
MONITOR_INC_TIME_IN_MICRO_SECS(
30153021
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
30163022

0 commit comments

Comments
 (0)