Skip to content

Commit e04abe7

Browse files
committed
fix bug rec_len diff parsed_len in pm_ppl_recv_parse_log_rec(). How I fixed: save the log_ptr offset in page_copy_rec_list_end_to_created_page() and retrieve it.
1 parent cb01a0f commit e04abe7

File tree

20 files changed

+1904
-659
lines changed

20 files changed

+1904
-659
lines changed

storage/innobase/btr/btr0btr.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,9 @@ btr_insert_on_non_leaf_level_func(
21472147
tuple, &rec, &dummy_big_rec, 0, NULL, mtr);
21482148

21492149
if (err == DB_FAIL) {
2150+
//#if defined (UNIV_PMEMOBJ_PART_PL)
2151+
// printf("PMEM_DEBUG split chain case mtr %zu\n", mtr);
2152+
//#endif
21502153
err = btr_cur_pessimistic_insert(flags
21512154
| BTR_NO_LOCKING_FLAG
21522155
| BTR_KEEP_SYS_FLAG

storage/innobase/btr/btr0cur.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4918,7 +4918,8 @@ btr_cur_del_mark_set_sec_rec_log(
49184918
byte* log_ptr;
49194919
ut_ad(val <= 1);
49204920

4921-
log_ptr = mlog_open(mtr, 11 + 1 + 2);
4921+
//log_ptr = mlog_open(mtr, 11 + 1 + 2);
4922+
log_ptr = mlog_open(mtr, MLOG_HEADER_SIZE + 1 + 2);
49224923

49234924
if (!log_ptr) {
49244925
/* Logging in mtr is switched off during crash recovery:

storage/innobase/fil/fil0fil.cc

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,9 @@ fil_space_create(
14281428
}
14291429

14301430
mutex_exit(&fil_system->mutex);
1431-
1431+
//tdnguyen test
1432+
printf("=====>>|| fil_space_create() space id %zu name %s\n", id, name);
1433+
//end tdnguyen test
14321434
return(space);
14331435
}
14341436

@@ -2116,7 +2118,8 @@ fil_op_write_log(
21162118
ut_ad(strchr(path, OS_PATH_SEPARATOR) != NULL);
21172119
ut_ad(strcmp(&path[strlen(path) - strlen(DOT_IBD)], DOT_IBD) == 0);
21182120

2119-
log_ptr = mlog_open(mtr, 11 + 4 + 2 + 1);
2121+
//log_ptr = mlog_open(mtr, 11 + 4 + 2 + 1);
2122+
log_ptr = mlog_open(mtr, MLOG_HEADER_SIZE + 4 + 2 + 1);
21202123

21212124
if (log_ptr == NULL) {
21222125
/* Logging in mtr is switched off during crash recovery:
@@ -8727,22 +8730,6 @@ pm_log_fil_node_create(
87278730
assert(0);
87288731
return NULL;
87298732
}
8730-
8731-
// //open file, simple version of fil_node_open_file() in fil0fil.cc
8732-
// node->handle = os_file_create(
8733-
// innodb_log_file_key, node->name, OS_FILE_OPEN,
8734-
// OS_FILE_AIO, OS_LOG_FILE, false, &success);
8735-
//
8736-
// if (!success){
8737-
// printf("PMEM_ERROR in pm_create_or_open_part_log_files(), cannot open fil_node %s \n ", node->name);
8738-
// assert(0);
8739-
// }
8740-
//
8741-
// node->is_open = true;
8742-
//
8743-
// fil_system->n_open++;
8744-
// fil_n_file_opened++;
8745-
87468733
return node;
87478734
}
87488735
/*
@@ -8757,7 +8744,6 @@ pm_log_fil_io(
87578744
{
87588745

87598746
PMEM_LOG_GROUP* group;
8760-
PMEM_PAGE_LOG_HASHED_LINE* pline;
87618747

87628748
byte* pdata;
87638749
byte* log_src;
@@ -8802,20 +8788,24 @@ pm_log_fil_io(
88028788
assert(plogbuf->hashed_id >= 0);
88038789

88048790
group = ppl->log_groups[plogbuf->hashed_id];
8805-
pline = D_RW(D_RW(ppl->buckets)[plogbuf->hashed_id]);
8806-
8807-
next_offset = pline->write_diskaddr;
88088791

8809-
if (next_offset + len > group->file_size){
8810-
printf("PMEM_INFO log file of line %zu is full\n", plogbuf->hashed_id);
8811-
assert(0);
8812-
//TODO: handle the case that the log group is full
8813-
//write_len = group->file_size - next_offset;
8814-
}
8815-
else {
8816-
write_len = len;
8817-
}
8792+
/*if the previous AIO is not finish while this AIO happen, write_diskaddr < diskaddr.
8793+
* Otherwise, write_diskaddr == diskaddr.
8794+
* So we write from diskaddr to avoid overwirte on previous written
8795+
* Since we advanced diskaddr size-bytes when handling full pline, we write from the previous size bytes from diskaddr
8796+
* */
88188797

8798+
//next_offset = pline->write_diskaddr
8799+
next_offset = plogbuf->diskaddr;
8800+
8801+
//tdnguyen test, fixing bug pline 593 has first write block zero
8802+
8803+
//what if we only write the first block
8804+
if (plogbuf->hashed_id == 593 && next_offset > plogbuf->size ) {
8805+
printf("===> TEST only write first block ...\n\n");
8806+
return;
8807+
}
8808+
88198809
//(2) Write, simulate log_group_write_buf()
88208810
assert((end_offset % univ_page_size.physical()) == 0);
88218811
//ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -8833,6 +8823,25 @@ pm_log_fil_io(
88338823
}
88348824
node->is_open = true;
88358825
}
8826+
8827+
if (next_offset + len > group->file_size){
8828+
printf("PMEM_INFO log file of line %zu is full, extend it to double size\n", plogbuf->hashed_id);
8829+
//assert(0);
8830+
bool ret = os_file_truncate(
8831+
node->name,
8832+
node->handle,
8833+
group->file_size * 2);
8834+
if (!ret){
8835+
printf("PMEM_ERROR cannot extend log file of line %zu \n", plogbuf->hashed_id);
8836+
assert(0);
8837+
}
8838+
8839+
group->file_size = group->file_size * 2;
8840+
8841+
}
8842+
else {
8843+
write_len = len;
8844+
}
88368845

88378846
err = os_aio(
88388847
req_type,

storage/innobase/handler/handler0alter.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8449,6 +8449,10 @@ ha_innobase::commit_inplace_alter_table(
84498449
ut_ad(trx_is_rseg_updated(trx));
84508450

84518451
if (mtr.get_log()->size() > 0) {
8452+
#if defined (UNIV_PMEMOBJ_PART_PL)
8453+
//TODO: handle this
8454+
assert(0);
8455+
#endif
84528456
ut_ad(*mtr.get_log()->front()->begin()
84538457
== MLOG_FILE_RENAME2);
84548458

storage/innobase/include/dyn0buf.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,25 @@ class dyn_buf_t {
372372
return(true);
373373
}
374374

375+
#if defined (UNIV_PMEMOBJ_PART_PL)
376+
/**
377+
@return the next block */
378+
block_t* next(block_t* block)
379+
MY_ATTRIBUTE((warn_unused_result))
380+
{
381+
ut_ad(UT_LIST_GET_LEN(m_list) > 0);
382+
if (block == NULL){
383+
return NULL;
384+
}
385+
386+
return(UT_LIST_GET_NEXT(m_node, block));
387+
}
388+
389+
block_t* get_back(){
390+
return (UT_LIST_GET_LAST(m_list));
391+
}
392+
#endif
393+
375394
/**
376395
@return the first block */
377396
block_t* front()

storage/innobase/include/mtr0log.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,18 @@ mlog_write_initial_log_record(
8484
modification is made */
8585
mlog_id_t type, /*!< in: log item type: MLOG_1BYTE, ... */
8686
mtr_t* mtr); /*!< in: mini-transaction handle */
87+
8788
/********************************************************//**
8889
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
8999
UNIV_INLINE
90100
void
91101
mlog_catenate_ulint(
@@ -102,6 +112,7 @@ mlog_catenate_ulint(
102112
mtr_t* mtr, /*!< in: mtr */
103113
ulint val, /*!< in: value to write */
104114
mlog_id_t type); /*!< in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
115+
#endif
105116
/********************************************************//**
106117
Catenates n bytes to the mtr log. */
107118
void

0 commit comments

Comments
 (0)