Skip to content

Commit 37a5cbf

Browse files
committed
Cache the Orders tablespace
1 parent a3b09ce commit 37a5cbf

File tree

9 files changed

+113
-20
lines changed

9 files changed

+113
-20
lines changed

storage/innobase/buf/.buf0flu.cc.swp

-16 KB
Binary file not shown.

storage/innobase/buf/buf0buf.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,8 +2051,8 @@ nvdimm_buf_pool_init(
20512051
}
20522052
}
20532053

2054-
//nvdimm_buf_LRU_old_ratio_update(95, FALSE);
20552054
nvdimm_buf_LRU_old_ratio_update(100 * 3 / 8, FALSE);
2055+
//nvdimm_buf_LRU_old_ratio_update(100 * 3 / 8, FALSE);
20562056

20572057
return(DB_SUCCESS);
20582058
}
@@ -5362,7 +5362,7 @@ buf_page_init_for_read(
53625362

53635363
#ifdef UNIV_NVDIMM_CACHE
53645364
if (mode == BUF_MOVE_TO_NVDIMM) {
5365-
if (page_id.space() == 30) {
5365+
if (page_id.space() == 30 || page_id.space() == 29) {
53665366
buf_pool = &nvdimm_buf_pool_ptr[0];
53675367
}
53685368
#ifdef UNIV_NVDIMM_CACHE_ST
@@ -6133,6 +6133,8 @@ buf_page_io_complete(
61336133
#ifdef UNIV_NVDIMM_CACHE_OL
61346134
if (bpage->id.space() == 30) {
61356135
srv_stats.nvdimm_pages_read_ol.inc();
6136+
} else if (bpage->id.space() == 29) {
6137+
srv_stats.nvdimm_pages_read_od.inc();
61366138
}
61376139
#endif /* UNIV_NVDIMM_CACHE_OL */
61386140
#ifdef UNIV_NVDIMM_CACHE_ST
@@ -6188,6 +6190,8 @@ buf_page_io_complete(
61886190
#ifdef UNIV_NVDIMM_CACHE_OL
61896191
if (bpage->id.space() == 30) {
61906192
srv_stats.nvdimm_pages_written_ol.inc();
6193+
} else if (bpage->id.space() == 29) {
6194+
srv_stats.nvdimm_pages_written_od.inc();
61916195
}
61926196
#endif /* UNIV_NVDIMM_CACHE_OL */
61936197
#ifdef UNIV_NVDIMM_CACHE_ST
@@ -7168,9 +7172,12 @@ buf_print_nvdimm_instance(
71687172
"\n"
71697173
"Order-Line " ULINTPF
71707174
"\n"
7175+
"Orders " ULINTPF
7176+
"\n"
71717177
"Stock " ULINTPF "\n",
71727178
(ulint)srv_stats.nvdimm_pages_stored_no,
71737179
(ulint)srv_stats.nvdimm_pages_stored_ol,
7180+
(ulint)srv_stats.nvdimm_pages_stored_od,
71747181
(ulint)srv_stats.nvdimm_pages_stored_st);
71757182

71767183
fprintf(file,
@@ -7179,9 +7186,12 @@ buf_print_nvdimm_instance(
71797186
"\n"
71807187
"Order-Line " ULINTPF
71817188
"\n"
7189+
"Orders " ULINTPF
7190+
"\n"
71827191
"Stock " ULINTPF "\n",
71837192
(ulint)srv_stats.nvdimm_pages_read_no,
71847193
(ulint)srv_stats.nvdimm_pages_read_ol,
7194+
(ulint)srv_stats.nvdimm_pages_read_od,
71857195
(ulint)srv_stats.nvdimm_pages_read_st);
71867196

71877197
fprintf(file,
@@ -7190,9 +7200,12 @@ buf_print_nvdimm_instance(
71907200
"\n"
71917201
"Order-Line " ULINTPF
71927202
"\n"
7203+
"Orders " ULINTPF
7204+
"\n"
71937205
"Stock " ULINTPF "\n",
71947206
(ulint)srv_stats.nvdimm_pages_written_no,
71957207
(ulint)srv_stats.nvdimm_pages_written_ol,
7208+
(ulint)srv_stats.nvdimm_pages_written_od,
71967209
(ulint)srv_stats.nvdimm_pages_written_st);
71977210

71987211
fprintf(file, "Total number of page gets performed = " ULINTPF "\n", pool_info->n_page_gets);

storage/innobase/buf/buf0flu.cc

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,18 @@ buf_flush_write_block_low(
11351135
ulint type = IORequest::WRITE | IORequest::DO_NOT_WAKE;
11361136

11371137
IORequest request(type);
1138-
1138+
1139+
lsn_t lsn_gap = bpage->newest_modification - bpage->oldest_modification;
1140+
1141+
/*ib::info() << bpage->id.space() << " " << bpage->id.page_no()
1142+
<< " is batch written. cached? " << bpage->cached_in_nvdimm
1143+
<< " moved? " << bpage->moved_to_nvdimm
1144+
<< " flush-type: " << flush_type
1145+
<< " buf-fix: " << bpage->buf_fix_count
1146+
<< " with oldest: " << bpage->oldest_modification
1147+
<< " newest: " << bpage->newest_modification
1148+
<< " lsn-gap: " << lsn_gap;*/
1149+
11391150
fil_io(request,
11401151
sync, bpage->id, bpage->size, 0, bpage->size.physical(),
11411152
frame, bpage);
@@ -1294,11 +1305,29 @@ buf_flush_page(
12941305

12951306
if ((page_type == FIL_PAGE_INDEX || page_type == FIL_PAGE_RTREE) /* Index page */
12961307
&& page_is_leaf(frame) /* Leaf page */) {
1297-
/* ib::info() << bpage->id.space() << " " << bpage->id.page_no() << " ready to move nvdimm.. " << bpage->flush_type;*/
1308+
//ib::info() << bpage->id.space() << " " << bpage->id.page_no() << " ol " << bpage->flush_type;
12981309
bpage->moved_to_nvdimm = true;
12991310
srv_stats.nvdimm_pages_stored_ol.inc();
13001311
}
13011312
}
1313+
1314+
/* Separate Orders leaf page from the other pages. */
1315+
if (bpage->id.space() == 29 /* Order-Line tablespace */
1316+
&& bpage->buf_fix_count == 0 /* Not fixed */
1317+
&& !bpage->cached_in_nvdimm) { /* Not cached in NVDIMM */
1318+
1319+
const byte *frame =
1320+
bpage->zip.data != NULL ? bpage->zip.data : ((buf_block_t *)bpage)->frame;
1321+
1322+
const ulint page_type = fil_page_get_type(frame);
1323+
1324+
if ((page_type == FIL_PAGE_INDEX || page_type == FIL_PAGE_RTREE) /* Index page */
1325+
&& page_is_leaf(frame) /* Leaf page */) {
1326+
//ib::info() << bpage->id.space() << " " << bpage->id.page_no() << " od " << bpage->flush_type;
1327+
bpage->moved_to_nvdimm = true;
1328+
srv_stats.nvdimm_pages_stored_od.inc();
1329+
}
1330+
}
13021331
#endif /* UNIV_NVDIMM_CACHE_OL */
13031332
#ifdef UNIV_NVDIMM_CACHE_ST
13041333
if (bpage->id.space() == 32 /* Stock tablespace */
@@ -1308,10 +1337,10 @@ buf_flush_page(
13081337
lsn_t lsn_gap = bpage->oldest_modification - before_lsn;
13091338

13101339
/* FIXME: Ad-hoc method */
1311-
if (0 < lsn_gap && lsn_gap < 10000000000) {
1340+
if (0 < lsn_gap && lsn_gap < 15000000000) {
13121341
//if (0 < lsn_gap && lsn_gap < 500000000) {
1313-
//ib::info() << "stock in " << bpage->id.space()
1314-
// << " " << bpage->id.page_no() << " " << bpage->flush_type << " " << lsn_gap;
1342+
//ib::info() << bpage->id.space() << " " << bpage->id.page_no()
1343+
// << " st " << bpage->flush_type << " " << lsn_gap;
13151344
bpage->moved_to_nvdimm = true;
13161345
srv_stats.nvdimm_pages_stored_st.inc();
13171346
}
@@ -1354,18 +1383,14 @@ buf_flush_page(
13541383
oldest_modification != 0. Thus, it cannot be relocated in the
13551384
buffer pool or removed from flush_list or LRU_list. */
13561385

1357-
/*if (bpage->id.space() == 32) {
1358-
lsn_t before_lsn = mach_read_from_8(reinterpret_cast<const buf_block_t *>(bpage)->frame + FIL_PAGE_LSN);
1359-
lsn_t lsn_gap = bpage->oldest_modification - before_lsn;
1386+
/*
1387+
lsn_t before_lsn = mach_read_from_8(reinterpret_cast<const buf_block_t *>(bpage)->frame + FIL_PAGE_LSN);
1388+
lsn_t lsn_gap = bpage->oldest_modification - before_lsn;
13601389
1361-
ib::info() << bpage->id.space() << " " << bpage->id.page_no()
1362-
<< " is written with flush-type: " << flush_type
1363-
<< " with oldest: " << bpage->oldest_modification
1364-
<< " newest: " << bpage->newest_modification
1365-
<< " lsn-gap: " << lsn_gap
1366-
<< " fix-count: " << bpage->buf_fix_count
1367-
<< " moved? " << bpage->moved_to_nvdimm;
1368-
}*/
1390+
ib::info() << bpage->id.space() << " " << bpage->id.page_no()
1391+
<< " is written with flush-type: " << flush_type
1392+
<< " lsn-gap: " << lsn_gap
1393+
<< " fix-count: " << bpage->buf_fix_count;*/
13691394
buf_flush_write_block_low(bpage, flush_type, sync);
13701395
}
13711396

storage/innobase/buf/buf0lru.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2561,7 +2561,7 @@ nvdimm_buf_LRU_old_ratio_update(
25612561
#ifdef UNIV_NVDIMM_CACHE_ST
25622562
buf_pool = &nvdimm_buf_pool_ptr[1];
25632563
new_ratio = buf_LRU_old_ratio_update_instance(
2564-
buf_pool, 100 * 3 / 8, adjust);
2564+
buf_pool, old_pct, adjust);
25652565
#endif /* UNIV_NVDIMM_CACHE_ST */
25662566

25672567
return(new_ratio);

storage/innobase/include/buf0buf.ic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ buf_pool_get(
10341034
return(&nvdimm_buf_pool_ptr[0]);
10351035
}
10361036
#ifdef UNIV_NVDIMM_CACHE_OL
1037-
if (page_id.space() == 30
1037+
if ((page_id.space() == 30 || page_id.space() == 29)
10381038
&& buf_page_hash_get_low(&nvdimm_buf_pool_ptr[0], page_id)) {
10391039
return(&nvdimm_buf_pool_ptr[0]);
10401040
}

storage/innobase/include/srv0mon.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,15 @@ enum monitor_id_t {
387387
#ifdef UNIV_NVDIMM_CACHE
388388
MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_ST,
389389
MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OL,
390+
MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OD,
390391
MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_NO,
391392
MONITOR_OVLD_SRV_NVDIMM_PAGES_READ_ST,
392393
MONITOR_OVLD_SRV_NVDIMM_PAGES_READ_OL,
394+
MONITOR_OVLD_SRV_NVDIMM_PAGES_READ_OD,
393395
MONITOR_OVLD_SRV_NVDIMM_PAGES_READ_NO,
394396
MONITOR_OVLD_SRV_NVDIMM_PAGES_WRITTEN_ST,
395397
MONITOR_OVLD_SRV_NVDIMM_PAGES_WRITTEN_OL,
398+
MONITOR_OVLD_SRV_NVDIMM_PAGES_WRITTEN_OD,
396399
MONITOR_OVLD_SRV_NVDIMM_PAGES_WRITTEN_NO,
397400
#endif /* UNIV_NVDIMM_CACHE */
398401
MONITOR_OVLD_SRV_PAGE_SIZE,

storage/innobase/include/srv0srv.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ struct srv_stats_t {
105105
stored in the NVDIMM buffer */
106106
ulint_ctr_1_t nvdimm_pages_stored_ol;
107107

108+
/** Store the number of Orders pages that currently been
109+
stored in the NVDIMM buffer */
110+
ulint_ctr_1_t nvdimm_pages_stored_od;
111+
108112
/** Store the number of New-Orders pages that currently
109113
been stored in the NVDIMM buffer */
110114
ulint_ctr_1_t nvdimm_pages_stored_no;
@@ -115,6 +119,9 @@ struct srv_stats_t {
115119
/** Store the number of Order-Line pages that been read */
116120
ulint_ctr_1_t nvdimm_pages_read_ol;
117121

122+
/** Store the number of Orders pages that been read */
123+
ulint_ctr_1_t nvdimm_pages_read_od;
124+
118125
/** Store the number of New-Orders pages that been read */
119126
ulint_ctr_1_t nvdimm_pages_read_no;
120127

@@ -124,6 +131,9 @@ struct srv_stats_t {
124131
/** Store the number of Order-Line pages that been written */
125132
ulint_ctr_1_t nvdimm_pages_written_ol;
126133

134+
/** Store the number of Orders pages that been written */
135+
ulint_ctr_1_t nvdimm_pages_written_od;
136+
127137
/** Store the number of New-Orders pages that been written */
128138
ulint_ctr_1_t nvdimm_pages_written_no;
129139
#endif /* UNIV_NVDIMM_CACHE */
@@ -951,12 +961,15 @@ struct export_var_t{
951961
#ifdef UNIV_NVDIMM_CACHE
952962
ulint innodb_nvdimm_pages_stored_st; /*!< srv_nvdimm_pages_stored_st */
953963
ulint innodb_nvdimm_pages_stored_ol; /*!< srv_nvdimm_pages_stored_ol */
964+
ulint innodb_nvdimm_pages_stored_od; /*!< srv_nvdimm_pages_stored_od */
954965
ulint innodb_nvdimm_pages_stored_no; /*!< srv_nvdimm_pages_stored_no */
955966
ulint innodb_nvdimm_pages_read_st; /*!< srv_nvdimm_pages_read_st */
956967
ulint innodb_nvdimm_pages_read_ol; /*!< srv_nvdimm_pages_read_ol */
968+
ulint innodb_nvdimm_pages_read_od; /*!< srv_nvdimm_pages_read_od */
957969
ulint innodb_nvdimm_pages_read_no; /*!< srv_nvdimm_pages_read_no */
958970
ulint innodb_nvdimm_pages_written_st; /*!< srv_nvdimm_pages_written_st */
959971
ulint innodb_nvdimm_pages_written_ol; /*!< srv_nvdimm_pages_written_ol */
972+
ulint innodb_nvdimm_pages_written_od; /*!< srv_nvdimm_pages_written_od */
960973
ulint innodb_nvdimm_pages_written_no; /*!< srv_nvdimm_pages_written_no */
961974
#endif /* UNIV_NVDIMM_CACHE */
962975
ulint innodb_log_waits; /*!< srv_log_waits */

storage/innobase/srv/srv0mon.cc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,12 @@ static monitor_info_t innodb_counter_info[] =
11931193
static_cast<monitor_type_t>(MONITOR_EXISTING | MONITOR_DEFAULT_ON),
11941194
MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OL},
11951195

1196+
{"innodb_nvdimm_pages_stored_od", "server",
1197+
"Number of orders pages that currently been stored in NVDIMM buffer"
1198+
" (innodb_nvdimm_pages_stored_od)",
1199+
static_cast<monitor_type_t>(MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1200+
MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OD},
1201+
11961202
{"innodb_nvdimm_pages_stored_no", "server",
11971203
"Number of new-orders pages that currently been stored in NVDIMM buffer"
11981204
" (innodb_nvdimm_pages_stored_no)",
@@ -1211,6 +1217,12 @@ static monitor_info_t innodb_counter_info[] =
12111217
static_cast<monitor_type_t>(MONITOR_EXISTING | MONITOR_DEFAULT_ON),
12121218
MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OL},
12131219

1220+
{"innodb_nvdimm_pages_read_od", "server",
1221+
"Number of orders pages that been read"
1222+
" (innodb_nvdimm_pages_read_od)",
1223+
static_cast<monitor_type_t>(MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1224+
MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OD},
1225+
12141226
{"innodb_nvdimm_pages_read_no", "server",
12151227
"Number of new-orders pages that been read"
12161228
" (innodb_nvdimm_pages_read_no)",
@@ -1229,6 +1241,12 @@ static monitor_info_t innodb_counter_info[] =
12291241
static_cast<monitor_type_t>(MONITOR_EXISTING | MONITOR_DEFAULT_ON),
12301242
MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OL},
12311243

1244+
{"innodb_nvdimm_pages_written_od", "server",
1245+
"Number of orders pages that been written"
1246+
" (innodb_nvdimm_pages_written_od)",
1247+
static_cast<monitor_type_t>(MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1248+
MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OD},
1249+
12321250
{"innodb_nvdimm_pages_written_no", "server",
12331251
"Number of new-orders pages that been written"
12341252
" (innodb_nvdimm_pages_written_no)",
@@ -1788,6 +1806,11 @@ srv_mon_process_existing_counter(
17881806
value = srv_stats.nvdimm_pages_stored_ol;
17891807
break;
17901808

1809+
/* innodb_nvdimm_pages_stored_od */
1810+
case MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_OD:
1811+
value = srv_stats.nvdimm_pages_stored_od;
1812+
break;
1813+
17911814
/* innodb_nvdimm_pages_stored_no */
17921815
case MONITOR_OVLD_SRV_NVDIMM_PAGES_STORED_NO:
17931816
value = srv_stats.nvdimm_pages_stored_no;
@@ -1803,6 +1826,11 @@ srv_mon_process_existing_counter(
18031826
value = srv_stats.nvdimm_pages_read_ol;
18041827
break;
18051828

1829+
/* innodb_nvdimm_pages_read_od */
1830+
case MONITOR_OVLD_SRV_NVDIMM_PAGES_READ_OD:
1831+
value = srv_stats.nvdimm_pages_read_od;
1832+
break;
1833+
18061834
/* innodb_nvdimm_pages_read_no */
18071835
case MONITOR_OVLD_SRV_NVDIMM_PAGES_READ_NO:
18081836
value = srv_stats.nvdimm_pages_read_no;
@@ -1818,6 +1846,11 @@ srv_mon_process_existing_counter(
18181846
value = srv_stats.nvdimm_pages_written_ol;
18191847
break;
18201848

1849+
/* innodb_nvdimm_pages_written_od */
1850+
case MONITOR_OVLD_SRV_NVDIMM_PAGES_WRITTEN_OD:
1851+
value = srv_stats.nvdimm_pages_written_od;
1852+
break;
1853+
18211854
/* innodb_nvdimm_pages_written_no */
18221855
case MONITOR_OVLD_SRV_NVDIMM_PAGES_WRITTEN_NO:
18231856
value = srv_stats.nvdimm_pages_written_no;

storage/innobase/srv/srv0srv.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,18 +1495,24 @@ srv_export_innodb_status(void)
14951495
export_vars.innodb_nvdimm_pages_stored_st = srv_stats.nvdimm_pages_stored_st;
14961496

14971497
export_vars.innodb_nvdimm_pages_stored_ol = srv_stats.nvdimm_pages_stored_ol;
1498+
1499+
export_vars.innodb_nvdimm_pages_stored_od = srv_stats.nvdimm_pages_stored_od;
14981500

14991501
export_vars.innodb_nvdimm_pages_stored_no = srv_stats.nvdimm_pages_stored_no;
15001502

15011503
export_vars.innodb_nvdimm_pages_read_st = srv_stats.nvdimm_pages_read_st;
15021504

15031505
export_vars.innodb_nvdimm_pages_read_ol = srv_stats.nvdimm_pages_read_ol;
1506+
1507+
export_vars.innodb_nvdimm_pages_read_od = srv_stats.nvdimm_pages_read_od;
15041508

15051509
export_vars.innodb_nvdimm_pages_read_no = srv_stats.nvdimm_pages_read_no;
15061510

15071511
export_vars.innodb_nvdimm_pages_written_st = srv_stats.nvdimm_pages_written_st;
15081512

15091513
export_vars.innodb_nvdimm_pages_written_ol = srv_stats.nvdimm_pages_written_ol;
1514+
1515+
export_vars.innodb_nvdimm_pages_written_od = srv_stats.nvdimm_pages_written_od;
15101516

15111517
export_vars.innodb_nvdimm_pages_written_no = srv_stats.nvdimm_pages_written_no;
15121518
#endif /* UNIV_NVDIMM_CACHE */

0 commit comments

Comments
 (0)