Skip to content

Commit 4e4cbf3

Browse files
committed
PPL recovery, DEBUG free bugs
1 parent 4e7572e commit 4e4cbf3

File tree

15 files changed

+96
-83
lines changed

15 files changed

+96
-83
lines changed

Diff for: build_mysql.sh

+2-2
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"

Diff for: storage/innobase/btr/btr0btr.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ btr_page_create(
356356
mtr_t* mtr) /*!< in: mtr */
357357
{
358358
page_t* page = buf_block_get_frame(block);
359-
#if defined (UNIV_PMEMOBJ_PART_PL)
360-
printf("==> PMEM_DEBUG: btr_page_create() (%zu, %zu)\n", block->page.id.space(), block->page.id.page_no());
361-
#endif
359+
//#if defined (UNIV_PMEMOBJ_PART_PL)
360+
// printf("==> PMEM_DEBUG: btr_page_create() (%zu, %zu)\n", block->page.id.space(), block->page.id.page_no());
361+
//#endif
362362
ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table));
363363

364364
if (page_zip) {

Diff for: storage/innobase/buf/buf0flu.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ buf_flush_write_block_low(
11331133
assert(0);
11341134
}
11351135
else{
1136-
printf("PMEM_INFO pm_ppl_flush_page(), input (space %zu, page_no %zu)\n", bpage->id.space(), bpage->id.page_no());
1136+
//printf("PMEM_INFO pm_ppl_flush_page(), input (space %zu, page_no %zu)\n", bpage->id.space(), bpage->id.page_no());
11371137
}
11381138

11391139
// PL-NVM without PB-NVM

Diff for: storage/innobase/fil/fil0fil.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ fil_space_create(
14291429

14301430
mutex_exit(&fil_system->mutex);
14311431
//tdnguyen test
1432-
printf("=====>>|| fil_space_create() space id %zu name %s\n", id, name);
1432+
// printf("=====>>|| fil_space_create() space id %zu name %s\n", id, name);
14331433
//end tdnguyen test
14341434
return(space);
14351435
}

Diff for: storage/innobase/fsp/fsp0fsp.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,9 @@ fsp_init_file_page_low(
723723
if (!fsp_is_system_temporary(block->page.id.space())) {
724724
memset(page, 0, UNIV_PAGE_SIZE);
725725
}
726-
726+
//#if defined (UNIV_PMEMOBJ_PART_PL)
727+
// printf("PMEM_DEBUG: fsp_init_file_page_low() space %zu page %zu\n", block->page.id.space(), block->page.id.page_no());
728+
//#endif
727729
mach_write_to_4(page + FIL_PAGE_OFFSET, block->page.id.page_no());
728730
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
729731
block->page.id.space());

Diff for: storage/innobase/ibuf/ibuf0ibuf.cc

-4
Original file line numberDiff line numberDiff line change
@@ -4440,10 +4440,6 @@ ibuf_merge_or_delete_for_page(
44404440
ut_ad(block == NULL || page_id.equals_to(block->page.id));
44414441
ut_ad(block == NULL || buf_block_get_io_fix(block) == BUF_IO_READ);
44424442

4443-
//#if defined (UNIV_PMEMOBJ_PART_PL)
4444-
// //tdnguyen test
4445-
// return;
4446-
//#endif
44474443
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE
44484444
|| trx_sys_hdr_page(page_id)
44494445
|| fsp_is_system_temporary(page_id.space())) {

Diff for: storage/innobase/include/buf0buf.ic

+7-8
Original file line numberDiff line numberDiff line change
@@ -1042,14 +1042,13 @@ buf_page_hash_get_low(
10421042
{
10431043
buf_page_t* bpage;
10441044

1045-
//tdnguyen test remove this for debug
1046-
//#ifdef UNIV_DEBUG
1047-
// rw_lock_t* hash_lock;
1048-
//
1049-
// hash_lock = hash_get_lock(buf_pool->page_hash, page_id.fold());
1050-
// ut_ad(rw_lock_own(hash_lock, RW_LOCK_X)
1051-
// || rw_lock_own(hash_lock, RW_LOCK_S));
1052-
//#endif /* UNIV_DEBUG */
1045+
#ifdef UNIV_DEBUG
1046+
rw_lock_t* hash_lock;
1047+
1048+
hash_lock = hash_get_lock(buf_pool->page_hash, page_id.fold());
1049+
ut_ad(rw_lock_own(hash_lock, RW_LOCK_X)
1050+
|| rw_lock_own(hash_lock, RW_LOCK_S));
1051+
#endif /* UNIV_DEBUG */
10531052

10541053
/* Look for the page in the hash table */
10551054

Diff for: storage/innobase/include/my_pmemobj.h

+2
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ struct __pmem_log_group {
748748
*/
749749
struct __pmem_recv_line {
750750
uint32_t hashed_id;
751+
752+
bool skip_zero_page;
751753

752754
bool apply_log_recs;
753755
bool apply_batch_on;

Diff for: storage/innobase/log/log0recv.cc

+27-25
Original file line numberDiff line numberDiff line change
@@ -5514,6 +5514,7 @@ pm_ppl_recv_recover_page_func(
55145514
mtr_t mtr;
55155515

55165516
bool is_gb_ht = (pline == NULL);
5517+
bool is_skip_zero_page = true;
55175518

55185519
if(is_gb_ht){
55195520
pmemobj_rwlock_wrlock(pop, &ppl->lock);
@@ -5546,15 +5547,16 @@ pm_ppl_recv_recover_page_func(
55465547

55475548
if(read_space_id != block->page.id.space() || read_page_no != block->page.id.page_no()){
55485549
//printf("PMEM_ERROR in pm_ppl_recv_recover_page_func(), input (space %zu, page_no %zu) differ read (space %zu, page_no %zu)\n", block->page.id.space(), block->page.id.page_no(), read_space_id, read_page_no);
5549-
recv_line->n_addrs--;
5550-
5551-
if(is_gb_ht){
5552-
pmemobj_rwlock_unlock(pop, &ppl->lock);
5553-
}
5554-
else{
5555-
pmemobj_rwlock_unlock(pop, &pline->lock);
5550+
//recv_line->n_addrs--;
5551+
if (recv_line->skip_zero_page){
5552+
if(is_gb_ht){
5553+
pmemobj_rwlock_unlock(pop, &ppl->lock);
5554+
}
5555+
else{
5556+
pmemobj_rwlock_unlock(pop, &pline->lock);
5557+
}
5558+
return;
55565559
}
5557-
return;
55585560
}
55595561

55605562
recv_addr = pm_ppl_recv_get_fil_addr_struct(
@@ -5708,10 +5710,8 @@ pm_ppl_recv_recover_page_func(
57085710
start_lsn = recv->start_lsn;
57095711
}
57105712

5711-
recv_parse_or_apply_log_rec_body(
5712-
recv->type, buf, buf + recv->len,
5713-
recv_addr->space, recv_addr->page_no,
5714-
block, &mtr);
5713+
recv_parse_or_apply_log_rec_body(recv->type, buf, buf + recv->len, recv_addr->space, recv_addr->page_no, block, &mtr);
5714+
57155715
recv_line->found_corrupt_log = recv_sys->found_corrupt_log;
57165716
recv_line->found_corrupt_fs = recv_sys->found_corrupt_fs;
57175717

@@ -6220,7 +6220,6 @@ pm_ppl_recv_apply_hashed_line(
62206220
} else {
62216221
recv_line = ppl->recv_line;
62226222
}
6223-
loop:
62246223
//if (recv_line->apply_batch_on) {
62256224
// os_thread_sleep(500000);
62266225
// goto loop;
@@ -6235,12 +6234,16 @@ pm_ppl_recv_apply_hashed_line(
62356234
recv_line->apply_log_recs = TRUE;
62366235
recv_line->apply_batch_on = TRUE;
62376236

6237+
recv_line->skip_zero_page = true;
6238+
62386239
cnt = 0;
62396240
cnt2 = 10;
62406241

62416242
n = recv_line->n_addrs;
6242-
6243+
62436244
printf("Start apply log recs ... \n");
6245+
6246+
loop:
62446247

62456248
for (i = 0; i < hash_get_n_cells(recv_line->addr_hash); i++) {
62466249

@@ -6282,25 +6285,18 @@ pm_ppl_recv_apply_hashed_line(
62826285

62836286
mtr_start(&mtr);
62846287

6285-
block = buf_page_get(
6286-
page_id, page_size,
6287-
RW_X_LATCH, &mtr);
6288+
block = buf_page_get( page_id, page_size, RW_X_LATCH, &mtr);
62886289

6289-
buf_block_dbg_add_level(
6290-
block, SYNC_NO_ORDER_CHECK);
6290+
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
62916291

6292-
//pm_ppl_recv_recover_page_func(
6293-
// pop, pline, FALSE, block);
6294-
pm_ppl_recv_recover_page_func(
6295-
pop, ppl, pline, FALSE, block);
6292+
pm_ppl_recv_recover_page_func(pop, ppl, pline, FALSE, block);
62966293

62976294
mtr_commit(&mtr);
62986295
} else {
62996296
// apply is done in IO thread after this read call is called
63006297

63016298
//pm_ppl_recv_read_in_area (recv_line, page_id);
6302-
bool read_ok = buf_read_page(
6303-
page_id, page_size);
6299+
bool read_ok = buf_read_page(page_id, page_size);
63046300

63056301
assert(read_ok);
63066302
}
@@ -6314,6 +6310,12 @@ pm_ppl_recv_apply_hashed_line(
63146310
}//end inner for
63156311

63166312
}//end outer for
6313+
6314+
if (recv_line->n_addrs > 0){
6315+
recv_line->skip_zero_page = false;
6316+
printf("=============\n HANDLE ZERO PAGES \n===============\n");
6317+
goto loop;
6318+
}
63176319

63186320
/* Wait until all the pages have been processed */
63196321
// while (recv_line->n_addrs != 0) {

Diff for: storage/innobase/page/page0cur.cc

+13-15
Original file line numberDiff line numberDiff line change
@@ -1262,10 +1262,10 @@ page_cur_parse_insert_rec(
12621262
return(const_cast<byte*>(ptr + (end_seg_len >> 1)));
12631263
}
12641264

1265-
#if defined(UNIV_PMEMOBJ_PART_PL)
1266-
//test skip the below code
1267-
return(const_cast<byte*>(ptr + (end_seg_len >> 1)));
1268-
#endif
1265+
//#if defined(UNIV_PMEMOBJ_PART_PL)
1266+
// //test skip the below code
1267+
// return(const_cast<byte*>(ptr + (end_seg_len >> 1)));
1268+
//#endif
12691269

12701270
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
12711271
ut_ad(!buf_block_get_page_zip(block) || page_is_comp(page));
@@ -1325,13 +1325,7 @@ page_cur_parse_insert_rec(
13251325
index, offsets, mtr))) {
13261326
/* The redo log record should only have been written
13271327
after the write was successful. */
1328-
#if defined(UNIV_PMEMOBJ_PART_PL)
1329-
//tdnguyen test
1330-
//skip this error to see what happend next
1331-
printf("PMEM_ERROR CODE#2 page_cur_rec_insert() return NULL in page_cur_parse_insert_rec() SKIP ERROR !!! \n");
1332-
#else
13331328
ut_error;
1334-
#endif
13351329
}
13361330

13371331
if (buf != buf1) {
@@ -2485,7 +2479,11 @@ page_copy_rec_list_end_to_created_page(
24852479

24862480
ut_a(log_data_len < 100 * UNIV_PAGE_SIZE);
24872481
//update log_ptr, it may change if the mtr->buf is reallocate
2488-
log_ptr = mtr->get_buf() + log_data_len_off;
2482+
if (log_ptr != (mtr->get_buf() + log_data_len_off)){
2483+
printf("===> PMEM_NOTICE: previous log_ptr %zu diffs from current %zu, mtr.logbuf may reallocated\n",
2484+
log_ptr, (mtr->get_buf() + log_data_len_off));
2485+
log_ptr = mtr->get_buf() + log_data_len_off;
2486+
}
24892487

24902488
if (log_ptr != NULL) {
24912489
mach_write_to_4(log_ptr, log_data_len);
@@ -2601,10 +2599,10 @@ page_cur_parse_delete_rec(
26012599
ptr += 2;
26022600

26032601
ut_a(offset <= UNIV_PAGE_SIZE);
2604-
#if defined (UNIV_PMEMOBJ_PART_PL)
2605-
//test, skip parse
2606-
return (ptr);
2607-
#endif
2602+
//#if defined (UNIV_PMEMOBJ_PART_PL)
2603+
// //test, skip parse
2604+
// return (ptr);
2605+
//#endif
26082606
if (block) {
26092607
page_t* page = buf_block_get_frame(block);
26102608
mem_heap_t* heap = NULL;

Diff for: storage/innobase/pmem/pmem0log.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,8 @@ pm_ppl_get_tt_entry_by_tid(
17911791
}
17921792
}
17931793
}
1794+
1795+
return NULL;
17941796
}
17951797

17961798
/*

Diff for: storage/innobase/trx/trx0purge.cc

-4
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,6 @@ trx_purge_add_update_undo_to_history(
350350
ib::fatal() << "undo->id is " << undo->id;
351351
}
352352

353-
//tdnguyen test
354-
if (undo->rseg->space == 0 && undo->rseg->page_no == 6){
355-
printf("===> PURGE: page 6, set UNDO page %zu at slot %zu to FIL_NULL (%zu)\n", trx_rsegf_get_nth_undo(rseg_header, undo->id, mtr), undo->id, FIL_NULL);
356-
}
357353
trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL, mtr);
358354

359355
MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_USED);

Diff for: storage/innobase/trx/trx0roll.cc

+16
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ Created 3/26/1996 Heikki Tuuri
4848
#include "trx0undo.h"
4949
#include "usr0sess.h"
5050

51+
#if defined (UNIV_PMEMOBJ_PART_PL)
52+
#include "my_pmemobj.h"
53+
extern PMEM_WRAPPER* gb_pmw;
54+
#endif
55+
5156
/** This many pages must be undone before a truncate is tried within
5257
rollback */
5358
static const ulint TRX_ROLL_TRUNC_THRESHOLD = 1;
@@ -735,6 +740,17 @@ trx_rollback_resurrected(
735740
{
736741
ut_ad(trx_sys_mutex_own());
737742

743+
#if defined (UNIV_PMEMOBJ_PART_PL)
744+
//Get the TT entry by tid
745+
PMEM_TT_ENTRY* pe;
746+
pe = pm_ppl_get_tt_entry_by_tid(
747+
gb_pmw->pop,
748+
gb_pmw->ppl,
749+
trx->id);
750+
if (pe == NULL){
751+
printf("PMEM_WARN: trx_rollback_reserrected() trx %zu is not in PPL \n");
752+
}
753+
#endif
738754
/* The trx->is_recovered flag and trx->state are set
739755
atomically under the protection of the trx->mutex (and
740756
lock_sys->mutex) in lock_trx_release_locks(). We do not want

Diff for: storage/innobase/trx/trx0rseg.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ trx_rseg_header_create(
113113
sys_header, rseg_slot_no, page_no, mtr);
114114

115115
//tdnguyen test
116-
printf("===>>> trx_rseg_header_create() create new rseg space %zu page %zu slot_no %zu\n",
117-
space, page_no, rseg_slot_no);
116+
//printf("===>>> trx_rseg_header_create() create new rseg space %zu page %zu slot_no %zu\n",
117+
// space, page_no, rseg_slot_no);
118118
//end tdnguyen test
119119
}
120120

Diff for: storage/innobase/trx/trx0undo.cc

+17-17
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,15 @@ trx_undo_seg_create(
521521

522522
trx_rsegf_set_nth_undo(rseg_hdr, slot_no,
523523
page_get_page_no(*undo_page), mtr);
524-
//tdnguyen test
525-
ulint rseg_page_no = page_get_page_no(page_align(rseg_hdr));
526-
ulint useg_page_no = page_get_page_no(*undo_page);
527-
528-
if (rseg_page_no == 6){
529-
printf("===>SEG_CREATE: rseg page %zu create UNDO seg page_no %zu type %zu at slot %zu \n",
530-
rseg_page_no, useg_page_no, type, slot_no);
531-
}
532-
//end tdnguyen test
524+
////tdnguyen test
525+
// ulint rseg_page_no = page_get_page_no(page_align(rseg_hdr));
526+
// ulint useg_page_no = page_get_page_no(*undo_page);
527+
//
528+
// if (rseg_page_no == 6){
529+
// printf("===>SEG_CREATE: rseg page %zu create UNDO seg page_no %zu type %zu at slot %zu \n",
530+
// rseg_page_no, useg_page_no, type, slot_no);
531+
// }
532+
////end tdnguyen test
533533

534534
*id = slot_no;
535535

@@ -976,10 +976,10 @@ trx_undo_add_page(
976976
undo->size++;
977977
rseg->curr_size++;
978978

979-
//tdnguyen test
980-
printf("===>>>> add new UNDO page in RSEG (id %zu page_no %zu) UNDO segment (slot %zu header page_no %zu last page_no %zu size %zu)\n",
981-
rseg->id, rseg->page_no, undo->id, undo->hdr_page_no, undo->last_page_no);
982-
//end tdnguyen test
979+
////tdnguyen test
980+
//printf("===>>>> add new UNDO page in RSEG (id %zu page_no %zu) UNDO segment (slot %zu header page_no %zu last page_no %zu size %zu)\n",
981+
// rseg->id, rseg->page_no, undo->id, undo->hdr_page_no, undo->last_page_no);
982+
////end tdnguyen test
983983

984984
return(new_block);
985985
}
@@ -1291,9 +1291,9 @@ trx_undo_seg_free(
12911291
rseg->space, rseg->page_no, rseg->page_size,
12921292
&mtr);
12931293
//tdnguyen test
1294-
if(rseg->space == 0 && rseg->page_no ==6) {
1295-
printf("===> SEG_FREE: set UNDO page %zu at slot %zu to FIL_NULL (%zu)\n", trx_rsegf_get_nth_undo(rseg_header, undo->id, &mtr), undo->id, FIL_NULL);
1296-
}
1294+
//if(rseg->space == 0 && rseg->page_no ==6) {
1295+
// printf("===> SEG_FREE: set UNDO page %zu at slot %zu to FIL_NULL (%zu)\n", trx_rsegf_get_nth_undo(rseg_header, undo->id, &mtr), undo->id, FIL_NULL);
1296+
//}
12971297
trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL,
12981298
&mtr);
12991299

@@ -1427,7 +1427,7 @@ trx_undo_mem_create_at_db_start(
14271427
}
14281428
}
14291429
//tdnguyen test
1430-
printf("==> add UNDO obj when server start RSEG (id %zu page_no %zu) UNDO segment(slot %zu page_no %zu header page_no %zu last page_no %zu trx_id %zu\n", rseg->id, rseg->page_no, id, page_no, undo->hdr_page_no, undo->last_page_no, trx_id);
1430+
//printf("==> add UNDO obj when server start RSEG (id %zu page_no %zu) UNDO segment(slot %zu page_no %zu header page_no %zu last page_no %zu trx_id %zu\n", rseg->id, rseg->page_no, id, page_no, undo->hdr_page_no, undo->last_page_no, trx_id);
14311431
//end tdnguyen test
14321432
return(undo);
14331433
}

0 commit comments

Comments
 (0)