Skip to content

Commit fa34845

Browse files
committed
stable PPL
1 parent 1c8fd78 commit fa34845

File tree

5 files changed

+237
-90
lines changed

5 files changed

+237
-90
lines changed

build_mysql.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ MYSQL_HOME=/home/vldb/mysql-plnvm
55
IS_DEBUG=0
66
#IS_DEBUG=1
77

8+
## Standalone PL-NVM
9+
## Standard version
10+
#BUILD_NAME="-DUNIV_PMEMOBJ_PART_PL_DEBUG -DUNIV_PMEMOBJ_PART_PL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_FLUSH_TIME"
811

9-
#BUILD_NAME="-DUNIV_TRACE_FLUSH_TIME"
12+
## skip write logbuf to log files version
13+
#BUILD_NAME="-DUNIV_WRITE_LOG_ON_NVM -DUNIV_PMEMOBJ_PART_PL_DEBUG -DUNIV_PMEMOBJ_PART_PL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_FLUSH_TIME"
14+
15+
### PB-NVM + PL-NVM
16+
#BUILD_NAME="-DUNIV_PMEMOBJ_PART_PL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_PARTITION -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_RECOVERY -DUNIV_PMEMOBJ_BUF_STAT -DUNIV_TRACE_FLUSH_TIME"
17+
18+
BUILD_NAME="-DUNIV_TRACE_FLUSH_TIME"
1019
#BUILD_NAME="-DUNIV_TRACE_FLUSH_TIME -DUNIV_SKIPLOG"
1120
#BUILD_NAME="-DUNIV_PMEMOBJ_WAL -DU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V_PMEMOBJ_BUF_STAT -DUNIV_TRACE_FLUSH_TIME"
2638
#BUILD_NAME="-DUNIV_PMEMOBJ_PART_PL_DEBUG -DUNIV_PMEMOBJ_PART_PL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_PARTITION -DUNIV_PMEMOBJ_BUF_RECOVERY -DUNIV_PMEMOBJ_BUF_STAT -DUNIV_TRACE_FLUSH_TIME"
2739

28-
## Standalone PL-NVM
29-
## Standard version
30-
#BUILD_NAME="-DUNIV_PMEMOBJ_PART_PL_DEBUG -DUNIV_PMEMOBJ_PART_PL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_FLUSH_TIME"
31-
## skip write logbuf to log files version
32-
#BUILD_NAME="-DUNIV_WRITE_LOG_ON_NVM -DUNIV_PMEMOBJ_PART_PL_DEBUG -DUNIV_PMEMOBJ_PART_PL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_FLUSH_TIME"
33-
34-
### PB-NVM + PL-NVM
35-
#BUILD_NAME="-DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_PARTITION -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_RECOVERY -DUNIV_PMEMOBJ_BUF_STAT -DUNIV_TRACE_FLUSH_TIME"
36-
BUILD_NAME="-DUNIV_PMEMOBJ_PART_PL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_PARTITION -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_RECOVERY -DUNIV_PMEMOBJ_BUF_STAT -DUNIV_TRACE_FLUSH_TIME"
3740

3841
## PMEMOBJ_WAL + NVM_LOG (test for Starlab)
3942
#BUILD_NAME="-DUNIV_NVM_LOG -DUNIV_PMEMOBJ_WAL -DUNIV_TRACE_FLUSH_TIME"

storage/innobase/include/my_pmemobj.h

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -465,24 +465,27 @@ struct __pmem_dpt {
465465
};
466466
/////////////// Per-Page Logging ///////////////////
467467

468+
/*
469+
* The high-level struc of page-level logging
470+
* */
468471
struct __pmem_page_part_log {
469472
PMEMrwlock lock;
470473
/*log buffer area*/
471474

472-
uint64_t size; //the total size
473-
PMEMoid data; //pointer to allocated nvm
474-
byte* p_align; //align
475+
uint64_t size; //the total size
476+
PMEMoid data; //pointer to allocated nvm
477+
byte* p_align; //align
475478

476-
uint64_t log_buf_size; //log block size in bytes
477-
uint64_t n_log_bufs;
478-
TOID(PMEM_PAGE_LOG_FREE_POOL) free_pool;
479+
uint64_t log_buf_size; //log block size in bytes
480+
uint64_t n_log_bufs;
481+
TOID(PMEM_PAGE_LOG_FREE_POOL) free_pool;
479482

480483
// Transaction Table
481484
TOID(PMEM_TT) tt; // transaction table
482485

483486

484487
bool is_new;
485-
/*log data as hash table*/
488+
/*log area as hash table*/
486489
uint64_t n_buckets; //# of buckets
487490
TOID_ARRAY(TOID(PMEM_PAGE_LOG_HASHED_LINE)) buckets;
488491

@@ -497,32 +500,32 @@ struct __pmem_page_part_log {
497500
PMEM_LOG_FLUSHER* flusher;
498501

499502
/*DRAM Log File*/
500-
uint64_t log_file_size;
501-
pfs_os_file_t log_files[1000];
502-
uint64_t n_log_files_per_bucket;
503+
uint64_t log_file_size;
504+
pfs_os_file_t log_files[4096];
505+
uint64_t n_log_files_per_bucket;
503506
PMEM_LOG_GROUP** log_groups; //n_buckets groups
504507
fil_node_t** node_arr; // n_buckets fil_nodes
505508
fil_space_t* log_space;
506509
/*Statistic info*/
507510
//log area
508-
uint64_t pmem_alloc_size;
511+
uint64_t pmem_alloc_size;
509512

510513
//metadata
511-
uint64_t pmem_page_log_size;
512-
uint64_t pmem_page_log_free_pool_size;
513-
uint64_t pmem_tt_size;
514+
uint64_t pmem_page_log_size;
515+
uint64_t pmem_page_log_free_pool_size;
516+
uint64_t pmem_tt_size;
514517

515518
/*Debug*/
516-
FILE* deb_file;
519+
FILE* deb_file;
517520
};
518521
/*
519-
* A hashed line has array of log blocks share the same hashed value
522+
* A hashed line has array of log blocks share the same hashed value and log buffer
520523
* */
521524
struct __pmem_page_log_hashed_line {
522525
PMEMrwlock lock;
523526

524527
int hashed_id;
525-
TOID(PMEM_PAGE_LOG_BUF) logbuf;
528+
TOID(PMEM_PAGE_LOG_BUF) logbuf; //pointer to log buffer
526529

527530
uint64_t diskaddr; //log file offset, update when flush log, reset when purging file
528531
uint64_t write_diskaddr; //diskaddr that log recs are durable write write_diskaddr < diskaddr
@@ -536,7 +539,14 @@ struct __pmem_page_log_hashed_line {
536539
TOID_ARRAY(TOID(PMEM_PAGE_LOG_BLOCK)) arr;
537540
//TODO:
538541
// log file
542+
/*Statistic info*/
543+
#if defined(UNIV_PMEMOBJ_PPL_STAT)
544+
uint64_t log_write_lock_wait_time; //total time lock holding for copying log records to log buffer
545+
uint64_t n_log_write; //total copies
539546

547+
uint64_t log_flush_lock_wait_time; //total time of lock holding for flushing log buffer to disk
548+
uint64_t n_log_flush; //total
549+
#endif
540550
};
541551

542552
struct __pmem_page_log_free_pool {
@@ -621,19 +631,20 @@ pm_log_flusher_close(PMEM_LOG_FLUSHER* flusher);
621631

622632
struct __pmem_tt_entry {
623633
PMEMrwlock lock;
624-
uint64_t eid; //block id
625-
uint64_t tid; //transaction id
634+
uint64_t eid; //block id
635+
uint64_t tid; //transaction id
626636
PMEM_TX_STATE state;
627-
628-
TOID_ARRAY(TOID(PMEM_PAGE_REF)) dp_arr; //dirty page array consists of key of entry in dirty page table
629-
uint64_t n_dp_entries;
637+
638+
/*dirty page array consists of (key, bid) pair of dirty pages caused by this transaction*/
639+
TOID_ARRAY(TOID(PMEM_PAGE_REF)) dp_arr;
640+
uint64_t n_dp_entries;
630641
};
631642

632643
struct __pmem_tt_hashed_line {
633644
PMEMrwlock lock;
634645

635-
uint64_t hashed_id;
636-
uint64_t n_entries; //the total log block in bucket
646+
uint64_t hashed_id;
647+
uint64_t n_entries; //the total log block in bucket
637648
TOID_ARRAY(TOID(PMEM_TT_ENTRY)) arr;
638649

639650
};
@@ -753,15 +764,14 @@ pm_ptxl_check_and_reset_dpt_entry(
753764
PMEM_DPT* pdpt,
754765
uint64_t key);
755766

756-
//for debugging
757-
void
758-
__print_tx_blocks_state(FILE* f,
759-
PMEM_TX_PART_LOG* ptxl);
767+
768+
#if defined (UNIV_PMEMOBJ_PART_PL_STAT)
760769
void
761770
__print_page_blocks_state(FILE* f,
762771
PMEM_PAGE_PART_LOG* ppl);
763-
764-
#if defined (UNIV_PMEMOBJ_PART_PL_STAT)
772+
void
773+
__print_tx_blocks_state(FILE* f,
774+
PMEM_TX_PART_LOG* ptxl);
765775
void
766776
ptxl_consolidate_stat_info(PMEM_TX_LOG_BLOCK* plog_block);
767777
void
@@ -1009,7 +1019,13 @@ pm_log_fil_node_create(
10091019
fil_space_t* space);
10101020
/////////////// END LOG FILES ///////////
10111021

1022+
//Statistic
1023+
#if defined(UNIV_PMEMOBJ_PPL_STAT)
1024+
void
1025+
__print_lock_overhead(FILE* f,
1026+
PMEM_PAGE_PART_LOG* ppl);
10121027

1028+
#endif
10131029
//for debugging
10141030
void
10151031
__print_blocks_state(FILE* f,

storage/innobase/mtr/mtr0mtr.cc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Created 11/26/1995 Heikki Tuuri
3939
#include "mtr0mtr.ic"
4040
#endif /* UNIV_NONINL */
4141

42+
#if defined (UNIV_TRACE_FLUSH_TIME)
43+
extern volatile int64 gb_write_log_time;
44+
#endif
45+
4246
#if defined (UNIV_PMEMOBJ_PART_PL)
4347
#include "my_pmemobj.h"
4448
extern PMEM_WRAPPER* gb_pmw;
@@ -1021,6 +1025,9 @@ the resources. */
10211025
void
10221026
mtr_t::Command::execute()
10231027
{
1028+
#if defined (UNIV_TRACE_FLUSH_TIME)
1029+
ulint start_time = ut_time_us(NULL);
1030+
#endif
10241031
ulint len = m_impl->m_log.size();
10251032
ulint n_recs = m_impl->m_n_log_recs;
10261033

@@ -1096,6 +1103,13 @@ mtr_t::Command::execute()
10961103
release_latches();
10971104

10981105
release_resources();
1106+
#if defined (UNIV_TRACE_FLUSH_TIME)
1107+
//trace the time spending for write log rec to log buf
1108+
ulint end_time = ut_time_us(NULL);
1109+
ulint exec_time = end_time - start_time;
1110+
//my_atomic_add64(&gb_write_log_time, exec_time);
1111+
__sync_fetch_and_add(&gb_write_log_time, exec_time);
1112+
#endif
10991113
}
11001114
#else //old method
11011115

@@ -1142,6 +1156,9 @@ mtr_t::Command::execute()
11421156
void
11431157
mtr_t::Command::execute()
11441158
{
1159+
#if defined (UNIV_TRACE_FLUSH_TIME)
1160+
ulint start_time = ut_time_us(NULL);
1161+
#endif
11451162
ut_ad(m_impl->m_log_mode != MTR_LOG_NONE);
11461163

11471164
if (const ulint len = prepare_write()) {
@@ -1168,6 +1185,13 @@ mtr_t::Command::execute()
11681185
release_latches();
11691186

11701187
release_resources();
1188+
#if defined (UNIV_TRACE_FLUSH_TIME)
1189+
//trace the time spending for write log rec to log buf
1190+
ulint end_time = ut_time_us(NULL);
1191+
ulint exec_time = end_time - start_time;
1192+
//my_atomic_add64(&gb_write_log_time, exec_time);
1193+
__sync_fetch_and_add(&gb_write_log_time, exec_time);
1194+
#endif
11711195
}
11721196
#endif // UNIV_PMEMOBJ_PL
11731197

0 commit comments

Comments
 (0)