Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ $ ./build.sh --origin
| innodb_nvdimm_buffer_pool_instances | The number of regions that the NVDIMM cache is divided into. The default value is 1. |
| innodb_nvdimm_pc_threshold_pct | Wakeup the NVDIMM page cleaner when this % of free pages remaining. The default value is 5. |
| innodb_nvdimm_home_dir | NVDIMM-aware files resident directory |
| innodb_use_nvdimm_dwb | Specifies whether to use NVDIMM dwb. **true** or **false**. |

For example:

Expand Down
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ elif [ "$1" = "--nc-monitor" ]; then
# Cache hot LB pages with mtr-logging/monitoring enabled
BUILD_FLAGS="-DUNIV_NVDIMM_CACHE -DUNIV_LOG_HEADER -DUNIV_FLUSH_MONITOR"
else
# Cache hot LB pages (default)
BUILD_FLAGS="-DUNIV_NVDIMM_CACHE -DUNIV_LOG_HEADER"
# Cache NVDIMM pages in TPC-C workloads
BUILD_FLAGS="-DUNIV_NVDIMM_CACHE"
fi

echo "Start build using $BUILD_FLAGS"

cd $BASE_DIR
cd $BUILD_DIR

cmake -DWITH_DEBUG=0 -DCMAKE_C_FLAGS="$BUILD_FLAGS" -DCMAKE_CXX_FLAGS="$BUILD_FLAGS" \
cmake .. -DWITH_DEBUG=0 -DCMAKE_C_FLAGS="$BUILD_FLAGS" -DCMAKE_CXX_FLAGS="$BUILD_FLAGS" \
-DDOWNLOAD_BOOST=ON -DWITH_BOOST=$BASE_DIR/boost -DENABLED_LOCAL_INFILE=1 \
-DCMAKE_INSTALL_PREFIX=$BUILD_DIR

Expand Down
25 changes: 16 additions & 9 deletions my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,31 @@ prompt=\u:\d>\_

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
user = root
socket = /tmp/mysql.sock
#nice = 0

[mysqld]
#
# * Basic Settings
#
user = root
default-storage-engine = innodb
skip-grant-tables
pid-file = /home/mijin/test_data/mysql.pid
pid-file = /home/vldb/test_data/mysql.pid
socket = /tmp/mysql.sock
port = 3306
datadir = /home/mijin/test_data/
log-error = /home/mijin/test_data/mysql_error_nvdimm.log
datadir = /home/vldb/test_data/
log-error = /home/vldb/test_data/mysql_error_nvdimm.log

##################################################
# Need to Modify
##################################################
#Log group path (iblog0, iblog1)
innodb_log_group_home_dir=/home/mijin/test_log/
innodb_log_group_home_dir=/home/vldb/test_log/
#innodb_log_group_home_dir=/mnt/pmemdir/test_log/
#innodb_undo_directory=/mnt/pmemdir/


#innodb page size
innodb_page_size=4KB
Expand All @@ -59,21 +64,24 @@ innodb_use_nvdimm_buffer=true
innodb_nvdimm_buffer_pool_size=1G
innodb_nvdimm_buffer_pool_instances=1
innodb_nvdimm_pc_threshold_pct=15
innodb_nvdimm_home_dir=/mnt/ramdisk
#innodb_nvdimm_home_dir=/mnt/pmem
innodb_nvdimm_home_dir=/mnt/pmemdir

#transaction log settings
innodb_log_file_size=2G
innodb_log_file_size=500M
innodb_log_files_in_group=3

# 0:every 1 seconds, 1:fsync on commits, 2:writes on commits
innodb_flush_log_at_trx_commit=0
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=32M
innodb_flush_neighbors=0
#innodb_force_recovery = 1

#doublewrite and flush method
innodb_doublewrite=ON
innodb_flush_method=O_DIRECT
# dwb NVM version
innodb_use_nvdimm_dwb=false


#AIO control
innodb_use_native_aio=true
Expand All @@ -95,4 +103,3 @@ open_files_limit = 24000
#performance-schema-instrument='wait/synch/rwlock/innodb/%=ON'
#innodb_status_output = ON
#innodb_status_output_locks = ON

23 changes: 13 additions & 10 deletions storage/innobase/btr/btr0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3924,23 +3924,19 @@ btr_cur_update_in_place(
}

#ifdef UNIV_NVDIMM_CACHE
// (jhpark): add REDO log for NC pages
btr_cur_update_in_place_log(flags, rec, index, update,
trx_id, roll_ptr, mtr);
/*
nvm_block = btr_cur_get_block(cursor);
nvm_bpage = &(nvm_block->page);

if (nvm_bpage->cached_in_nvdimm) {
// skip generating REDO logs for NVM-resident pages
// write NC page on NVDIMM
//pm_mmap_buf_write(nvm_bpage->size.physical(), (void*) ((buf_block_t*) nvm_bpage)->frame);

// persist records
ulint cur_rec_size = rec_offs_size(offsets);
pm_mmap_mtrlogbuf_commit(nvm_block->frame, UNIV_PAGE_SIZE, nvm_bpage->id.space(), nvm_bpage->id.page_no());

//pm_mmap_mtrlogbuf_commit(rec, cur_rec_size, nvm_bpage->id.space(), nvm_bpage->id.page_no());

} else {
btr_cur_update_in_place_log(flags, rec, index, update,
trx_id, roll_ptr, mtr);
}
*/
#else
btr_cur_update_in_place_log(flags, rec, index, update,
trx_id, roll_ptr, mtr);
Expand Down Expand Up @@ -4937,6 +4933,7 @@ btr_cur_del_mark_set_clust_rec(
row_upd_rec_sys_fields(rec, page_zip, index, offsets, trx, roll_ptr);

#ifdef UNIV_NVDIMM_CACHE
/*
if (is_nvm_page) {
// skip generating REDO logs for nvm-page
// Instead, write commit log in mtr log
Expand All @@ -4950,6 +4947,12 @@ btr_cur_del_mark_set_clust_rec(
btr_cur_del_mark_set_clust_rec_log(rec, index, trx->id,
roll_ptr, mtr);
}
*/

// (jhpark): add REDO log for NC pages
btr_cur_del_mark_set_clust_rec_log(rec, index, trx->id,
roll_ptr, mtr);

#else
btr_cur_del_mark_set_clust_rec_log(rec, index, trx->id,
roll_ptr, mtr);
Expand Down
72 changes: 70 additions & 2 deletions storage/innobase/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,74 @@ buf_pool_register_chunk(
chunk->blocks->frame, chunk));
}

// HOT DEBUG //
lsn_t
nvdimm_buf_pool_get_oldest_modification(void)
/*==================================*/
{
lsn_t lsn = 0;
lsn_t oldest_lsn = 0;
lsn_t page_lsn = 0;

/* When we traverse all the flush lists we don't want another
thread to add a dirty page to any flush list. */
log_flush_order_mutex_enter();

for (ulint i = srv_buf_pool_instances; i < srv_buf_pool_instances+1; i++) {
buf_pool_t* buf_pool;

buf_pool = buf_pool_from_array(i);

buf_flush_list_mutex_enter(buf_pool);

buf_page_t* bpage;

/* We don't let log-checkpoint halt because pages from system
temporary are not yet flushed to the disk. Anyway, object
residing in system temporary doesn't generate REDO logging. */
for (bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
bpage != NULL
&& fsp_is_system_temporary(bpage->id.space());
bpage = UT_LIST_GET_PREV(list, bpage)) {
/* Do nothing. */
}

if (bpage != NULL) {
ut_ad(bpage->in_flush_list);

// HOT DEBUG //
// check page lsn of current NC pages
/*
buf_block_t *block;
block = (buf_block_t*)bpage;
uint64_t cur_lsn_page = mach_read_from_8(block->frame + FIL_PAGE_LSN);
if (cur_lsn_page !=0
&& cur_lsn_page < pmem_lsn) {
lsn = pmem_lsn;
} else {
lsn = cur_lsn_page;
}
*/
lsn = bpage->oldest_modification;
}

buf_flush_list_mutex_exit(buf_pool);

if (!oldest_lsn || oldest_lsn > lsn) {
oldest_lsn = lsn;
}
}

log_flush_order_mutex_exit();

/* The returned answer may be out of date: the flush_list can
change after the mutex has been released. */

return(oldest_lsn);
}



/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
zero if all modified pages have been flushed to disk.
Expand All @@ -421,7 +489,7 @@ buf_pool_get_oldest_modification(void)
thread to add a dirty page to any flush list. */
log_flush_order_mutex_enter();

for (ulint i = 0; i < srv_buf_pool_instances; i++) {
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool;

buf_pool = buf_pool_from_array(i);
Expand Down Expand Up @@ -6331,7 +6399,7 @@ buf_page_io_complete(
Asserts that all file pages in the buffer are in a replaceable state.
@return TRUE */
static
ibool
ibool
buf_all_freed_instance(
/*===================*/
buf_pool_t* buf_pool) /*!< in: buffer pool instancce */
Expand Down
Loading