Skip to content

Commit 1ff12de

Browse files
committed
implement extendable PPL log block lines, TT lines
1 parent 4e4cbf3 commit 1ff12de

File tree

12 files changed

+465
-183
lines changed

12 files changed

+465
-183
lines changed

build_mysql.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
MYSQL_HOME=/home/vldb/mysql-plnvm
33

44
#debug mode
5-
IS_DEBUG=0
6-
#IS_DEBUG=1
5+
#IS_DEBUG=0
6+
IS_DEBUG=1
77

88
#BUILD_NAME="-DUNIV_TRACE_FLUSH_TIME"
99
#BUILD_NAME="-DUNIV_TRACE_FLUSH_TIME -DUNIV_SKIPLOG"

storage/innobase/btr/btr0btr.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,6 @@ btr_page_free_low(
617617
}
618618
#endif
619619

620-
#if defined (UNIV_PMEMOBJ_PART_PL)
621-
printf("====> PMEM_DEBUG: btr_page_free_low() free page(%zu, %zu)\n", block->page.id.space(), block->page.id.page_no());
622-
#endif
623620
fseg_free_page(seg_header,
624621
block->page.id.space(),
625622
block->page.id.page_no(),

storage/innobase/buf/buf0lru.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,10 +2142,10 @@ buf_LRU_block_free_non_file_page(
21422142
/* Wipe page_no and space_id */
21432143
memset(block->frame + FIL_PAGE_OFFSET, 0xfe, 4);
21442144
memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xfe, 4);
2145-
#if defined (UNIV_PMEMOBJ_PART_PL)
2146-
printf("PMEM_DEBUG: buf_LRU_block_free_non_file_page() page (%zu, %zu)\n",
2147-
bpage->id.space(), bpage->id.page_no());
2148-
#endif
2145+
//#if defined (UNIV_PMEMOBJ_PART_PL)
2146+
// printf("PMEM_DEBUG: buf_LRU_block_free_non_file_page() page (%zu, %zu)\n",
2147+
// bpage->id.space(), bpage->id.page_no());
2148+
//#endif
21492149
#endif /* UNIV_DEBUG */
21502150
data = block->page.zip.data;
21512151

storage/innobase/fil/fil0fil.cc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5948,8 +5948,8 @@ pm_ppl_test_write_rseg(
59485948
//get the pointer to the UNDO seg header page
59495949
buf_pool_t* buf_pool = buf_pool_get(page_id);
59505950
block = (buf_block_t*) buf_page_hash_get_low(buf_pool, page_id_t(page_id.space(), p1));
5951-
printf("///////////////////////\n");
5952-
printf("===>> IS_WRITE %zu FIL_IO: is in BP check RSEG page %zu header UNDO page (%zu, %zu) \n", req_type.is_write(), page_id.page_no(), p1, (block!=NULL));
5951+
//printf("///////////////////////\n");
5952+
//printf("===>> IS_WRITE %zu FIL_IO: is in BP check RSEG page %zu header UNDO page (%zu, %zu) \n", req_type.is_write(), page_id.page_no(), p1, (block!=NULL));
59535953

59545954
if (block == NULL) {
59555955
printf("///////////////////////\n");
@@ -8760,8 +8760,6 @@ pm_log_fil_io(
87608760

87618761
ulint start_offset;
87628762
ulint end_offset;
8763-
ulint area_start;
8764-
ulint area_end;
87658763

87668764
ulint next_offset;
87678765
ulint write_offset;
@@ -8784,14 +8782,10 @@ pm_log_fil_io(
87848782
log_src = pdata + plogbuf->pmemaddr;
87858783

87868784
start_offset = 0;
8787-
//end_offset = plogbuf->cur_off;
87888785
end_offset = plogbuf->size;
87898786

87908787
//(1) Align the offset with the page size
8791-
//area_start = ut_calc_align_down(start_offset, OS_FILE_LOG_BLOCK_SIZE);
8792-
//area_end = ut_calc_align_down(end_offset, OS_FILE_LOG_BLOCK_SIZE);
87938788

8794-
//len = area_end - area_start;
87958789
len = plogbuf->size;
87968790
ut_ad(len > 0);
87978791

storage/innobase/include/mtr0log.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,6 @@ mlog_write_initial_log_record(
8787

8888
/********************************************************//**
8989
Catenates 1 - 4 bytes to the mtr log. The value is not compressed. */
90-
#if defined (UNIV_PMEMOBJ_PART_PL)
91-
UNIV_INLINE
92-
void
93-
mlog_catenate_ulint(
94-
/*================*/
95-
mtr_buf_t* dyn_buf, /*!< in/out: buffer to write */
96-
ulint val, /*!< in: value to write */
97-
mlog_id_t type); /*!< in: type of value to write */
98-
#else
9990
UNIV_INLINE
10091
void
10192
mlog_catenate_ulint(
@@ -112,7 +103,6 @@ mlog_catenate_ulint(
112103
mtr_t* mtr, /*!< in: mtr */
113104
ulint val, /*!< in: value to write */
114105
mlog_id_t type); /*!< in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
115-
#endif
116106
/********************************************************//**
117107
Catenates n bytes to the mtr log. */
118108
void

storage/innobase/include/mtr0log.ic

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ mlog_close(
7878
mtr->set_cur_off(new_off);
7979
}
8080

81+
/*Catenates 1 - 4 bytes to the mtr log. The value is not compressed. */
82+
UNIV_INLINE
83+
void
84+
mlog_catenate_ulint(
85+
/*================*/
86+
mtr_buf_t* mtr_buf, /*!< in/out: buffer to write */
87+
ulint val, /*!< in: value to write */
88+
mlog_id_t type) /*!< in: type of value to write */
89+
{
90+
//we don't use this function
91+
assert(0);
92+
}
93+
8194
/* PPL FUNCTION
8295
Catenates 1 - 4 bytes to the mtr log. The value is not compressed.
8396
This function use push instead of open_log and close_log

storage/innobase/include/my_pmem_common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ enum PMEM_OBJ_TYPES {
7070
BUF_TYPE,
7171
META_DATA_TYPE
7272
};
73+
74+
//use in pm_ppl_write()
75+
#define PMEM_EID_NEW 0
76+
#define PMEM_EID_REVISIT 1
77+
#define PMEM_EID_UNDEFINED 2
78+
79+
7380
enum PMEM_BLOCK_STATE {
7481
PMEM_FREE_BLOCK = 1,
7582
PMEM_IN_USED_BLOCK = 2,

storage/innobase/include/my_pmemobj.h

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,9 @@ struct __pmem_page_log_hashed_line {
545545
uint64_t recv_lsn; //min lsn of block's beginLSN in this line
546546
/*end test */
547547

548-
uint64_t n_blocks; //the total log block in bucket
549548
TOID_ARRAY(TOID(PMEM_PAGE_LOG_BLOCK)) arr;
549+
uint64_t n_blocks; //the current non-free blocks
550+
uint64_t max_blocks; //the total log block in bucket
550551

551552
//Alternative to recv_sys_t in InnoDB, allocate in DRAM when recovery
552553
PMEM_RECV_LINE* recv_line;
@@ -598,7 +599,7 @@ struct __pmem_page_log_buf {
598599
struct __pmem_page_log_block {
599600
PMEMrwlock lock;
600601
bool is_free; //flag
601-
uint32_t bid; //block id
602+
uint64_t bid; //block id
602603
uint64_t key; //fold id
603604

604605
//uint64_t cur_size; //the current offset (0 - log block size)
@@ -688,7 +689,8 @@ pm_log_redoer_close(PMEM_LOG_REDOER* redoer);
688689
// Dirty Page Entry Ref in the log block
689690
struct __pmem_page_ref {
690691
uint64_t key; //fold of page_id_t.fold() in InnoDB
691-
int64_t idx; // index of the entry in DPT
692+
//int64_t idx; // index of the entry in DPT
693+
uint64_t idx; // index of the entry in DPT
692694
uint64_t pageLSN; //latest LSN on this page caused by the host transction, this value used in reclaiming logs
693695
};
694696

@@ -708,8 +710,10 @@ struct __pmem_tt_hashed_line {
708710
PMEMrwlock lock;
709711

710712
uint64_t hashed_id;
711-
uint64_t n_entries; //the total log block in bucket
713+
712714
TOID_ARRAY(TOID(PMEM_TT_ENTRY)) arr;
715+
uint64_t n_entries; //current number of entries
716+
uint64_t max_entries; //capacity (extendable)
713717

714718
};
715719

@@ -956,9 +960,20 @@ void __init_tt_entry(
956960
uint64_t k,
957961
uint64_t pages_per_tx);
958962

963+
uint64_t
964+
pm_ppl_create_entry_id(
965+
uint16_t type,
966+
uint32_t row,
967+
uint32_t col);
968+
void
969+
pm_ppl_parse_entry_id(
970+
uint64_t val,
971+
uint16_t* type,
972+
uint32_t* row,
973+
uint32_t* col);
959974

960975
/*Called when a mini-transaction write log record to log buffer in the traditional InnoDB*/
961-
int64_t
976+
uint64_t
962977
pm_ppl_write(
963978
PMEMobjpool* pop,
964979
PMEM_PAGE_PART_LOG* ppl,
@@ -968,10 +983,9 @@ pm_ppl_write(
968983
uint64_t n_recs,
969984
uint64_t* key_arr,
970985
uint64_t* size_arr,
971-
//uint64_t* LSN_arr,
972986
uint64_t* ret_start_lsn,
973987
uint64_t* ret_end_lsn,
974-
int64_t block_id);
988+
uint64_t block_id);
975989

976990
void __handle_pm_ppl_write_by_entry(
977991
PMEMobjpool* pop,
@@ -988,7 +1002,7 @@ void __handle_pm_ppl_write_by_entry(
9881002
PMEM_TT_ENTRY* pe,
9891003
bool is_new);
9901004

991-
int64_t
1005+
uint64_t
9921006
__update_page_log_block_on_write(
9931007
PMEMobjpool* pop,
9941008
PMEM_PAGE_PART_LOG* ppl,
@@ -998,7 +1012,7 @@ __update_page_log_block_on_write(
9981012
uint64_t key,
9991013
uint64_t* LSN,
10001014
int64_t eid,
1001-
int64_t bid);
1015+
uint64_t bid);
10021016

10031017
PMEM_PAGE_LOG_BLOCK*
10041018
__get_log_block_by_id(
@@ -1094,7 +1108,7 @@ pm_ppl_commit(
10941108
PMEMobjpool* pop,
10951109
PMEM_PAGE_PART_LOG* ppl,
10961110
uint64_t tid,
1097-
int64_t eid);
1111+
uint64_t eid);
10981112
void
10991113
pm_ppl_flush_page(
11001114
PMEMobjpool* pop,
@@ -1293,12 +1307,24 @@ __update_page_log_block_on_commit(
12931307
PMEMobjpool* pop,
12941308
PMEM_PAGE_PART_LOG* ppl,
12951309
PMEM_PAGE_REF* pref,
1296-
int64_t eid);
1310+
uint64_t eid);
12971311
void
12981312
__reset_TT_entry(
12991313
PMEMobjpool* pop,
13001314
PMEM_PAGE_PART_LOG* ppl,
13011315
PMEM_TT_ENTRY* pe);
1316+
1317+
void __realloc_page_log_block_line(
1318+
PMEMobjpool* pop,
1319+
PMEM_PAGE_PART_LOG* ppl,
1320+
PMEM_PAGE_LOG_HASHED_LINE* pline,
1321+
uint64_t new_size);
1322+
1323+
void __realloc_TT_line(
1324+
PMEMobjpool* pop,
1325+
PMEM_PAGE_PART_LOG* ppl,
1326+
PMEM_TT_HASHED_LINE* pline,
1327+
uint64_t new_size);
13021328
void
13031329
__realloc_TT_entry(
13041330
PMEMobjpool* pop,

storage/innobase/include/trx0trx.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,9 @@ struct trx_t {
912912
this transaction must abort when
913913
it can */
914914
#if defined(UNIV_PMEMOBJ_PART_PL)
915-
int64_t pm_log_block_id;
915+
uint64_t pm_log_block_id; /*1byte type (1: NEW, 2: REVISIT, 3: UNDEFINED
916+
3-byte line_id,
917+
4-byte offset*/
916918
#endif
917919
trx_id_t id; /*!< transaction id */
918920

storage/innobase/mtr/mtr0mtr.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,9 @@ mtr_t::Command::execute()
13511351
else{
13521352
//assert(type > 0 && type <= 8);
13531353
//all type <= 8 is treat as trx_id 0
1354+
uint64_t dummy_eid;
1355+
dummy_eid = pm_ppl_create_entry_id(PMEM_EID_UNDEFINED, 0, 0);
1356+
13541357
pm_ppl_write(
13551358
gb_pmw->pop,
13561359
gb_pmw->ppl,
@@ -1362,7 +1365,7 @@ mtr_t::Command::execute()
13621365
m_impl->size_arr,
13631366
&ret_start_lsn,
13641367
&ret_end_lsn,
1365-
-2);
1368+
dummy_eid);
13661369
}
13671370

13681371
//Update m_start_lsn and m_end_lsn. They are required for update pageLSN in release_block()

0 commit comments

Comments
 (0)