Skip to content

Commit 8f90419

Browse files
committedDec 6, 2017
implement persistent Redo log file with libpmemobj
1 parent f8c0978 commit 8f90419

File tree

15 files changed

+429
-34
lines changed

15 files changed

+429
-34
lines changed
 

‎CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
#tdnguyen added
1717
#SET (NVM_LIBS mytest)
18-
SET (NVM_LIBS pmem)
18+
SET (NVM_LIB_PMEM pmem)
19+
SET (NVM_LIB_PMEMOBJ pmemobj)
1920
#end tdnguyen added
2021

2122
IF(WIN32)

‎client/dump/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ SET(MYSQLPUMP_LIB_SOURCES
141141
../../sql-common/my_user.c)
142142
ADD_CONVENIENCE_LIBRARY(mysqlpump_lib ${MYSQLPUMP_LIB_SOURCES})
143143
TARGET_LINK_LIBRARIES(mysqlpump_lib
144+
# client_base ${LZ4_LIBRARY} ${NVM_LIB_PMEM} ${NVM_LIB_PMEMOBJ})
144145
client_base ${LZ4_LIBRARY})
145146

146147
ADD_COMPILE_FLAGS(

‎include/my_global.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@
2525
differences are mitigated.
2626
*/
2727

28-
#ifdef UNIV_NVM_LOG
28+
#if defined(UNIV_NVM_LOG) || defined(UNIV_PMEMOBJ_LOG)
2929
//tdnguyen
3030
#include <libpmem.h>
3131
#endif
32+
#ifdef UNIV_PMEMOBJ_LOG
33+
#include <libpmemobj.h>
34+
#include <libpmem.h>
35+
#endif
3236

3337
#include "my_config.h"
3438

‎libmysqld/examples/CMakeLists.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
2828
../../client/mysql.cc ../../client/readline.cc)
2929
#tdnguyen added
3030
#TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver)
31-
TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver ${NVM_LIBS})
31+
TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver ${NVM_LIB_PMEMOBJ} ${NVM_LIB_PMEM} )
32+
#TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver ${NVM_LIB_PMEM})
3233
#end tdnguyen added
3334

3435
IF(UNIX)
@@ -50,7 +51,8 @@ ENDIF()
5051
MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
5152
#tdnguyen added
5253
#TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver)
53-
TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver ${NVM_LIBS})
54+
TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver ${NVM_LIB_PMEMOBJ} ${NVM_LIB_PMEM} )
55+
#TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver ${NVM_LIB_PMEM})
5456

5557

5658
IF(CMAKE_GENERATOR MATCHES "Xcode")
@@ -78,7 +80,8 @@ ENDIF()
7880
IF(NOT INSTALL_LAYOUT MATCHES "SVR4")
7981
#tdnguyen added
8082
#TARGET_LINK_LIBRARIES(mysql_client_test_embedded mysqlserver)
81-
TARGET_LINK_LIBRARIES(mysql_client_test_embedded mysqlserver ${NVM_LIBS})
83+
TARGET_LINK_LIBRARIES(mysql_client_test_embedded mysqlserver ${NVM_LIB_PMEMOBJ} ${NVM_LIB_PMEM} )
84+
#TARGET_LINK_LIBRARIES(mysql_client_test_embedded mysqlserver ${NVM_LIB_PMEM})
8285
ENDIF()
8386

8487
IF(UNIX)

‎rapid/plugin/x/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ ELSE()
145145
MODULE_ONLY MODULE_OUTPUT_NAME "mysqlx")
146146

147147
IF(WITH_PROTOBUF STREQUAL "system")
148-
TARGET_LINK_LIBRARIES(mysqlx "${PROTOBUF_LIBRARY}")
148+
TARGET_LINK_LIBRARIES(mysqlx "${PROTOBUF_LIBRARY}")
149+
# TARGET_LINK_LIBRARIES(mysqlx "${PROTOBUF_LIBRARY}" ${NVM_LIB_PMEM} ${NVM_LIB_PMEMOBJ})
149150
ENDIF()
150151

151152
ADD_DEPENDENCIES(mysqlx GenError)
@@ -216,6 +217,7 @@ ELSE()
216217

217218
TARGET_LINK_LIBRARIES(mysqlxtest mysys strings mysqlclient)
218219
TARGET_LINK_LIBRARIES(mysqlxtest ${PROTOBUF_LIBRARY})
220+
# TARGET_LINK_LIBRARIES(mysqlxtest ${PROTOBUF_LIBRARY} ${NVM_LIB_PMEM} ${NVM_LIB_PMEMOBJ})
219221

220222
IF( WIN32 )
221223
ADD_DEFINITIONS(-DMYSQLXTEST_EXPORTS)

‎sql/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,12 @@ DTRACE_INSTRUMENT(sql)
388388
# ${LIBWRAP} ${LIBCRYPT} ${LIBDL}
389389
# ${SSL_LIBRARIES})
390390

391+
#tdnguyen
391392
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
392393
mysys mysys_ssl dbug strings vio regex binlogevents_static
393394
${LIBWRAP} ${LIBCRYPT} ${LIBDL}
394-
${SSL_LIBRARIES} ${NVM_LIBS})
395+
#${SSL_LIBRARIES} ${NVM_LIB_PMEM})
396+
${SSL_LIBRARIES} ${NVM_LIB_PMEMOBJ} ${NVM_LIB_PMEM} )
395397

396398
#
397399
# On Windows platform we compile in the clinet-side Windows Native Authentication

‎storage/innobase/fil/fil0fil.cc

+7-3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Created 10/25/1995 Heikki Tuuri
6161
//declare it at storage/innobase/srv/srv0start.cc
6262
extern PMEM_FILE_COLL* gb_pfc;
6363
#endif
64+
#ifdef UNIV_PMEMOBJ_LOG
65+
#include "my_pmemobj.h"
66+
extern PMEM_WRAPPER* gb_pmw;
67+
#endif
6468

6569
/** Tries to close a file in the LRU list. The caller must hold the fil_sys
6670
mutex.
@@ -5784,15 +5788,15 @@ fil_io(
57845788
? false : srv_read_only_mode,
57855789
node, message);
57865790

5787-
#ifdef UNIV_NVM_LOG
5791+
#if defined (UNIV_NVM_LOG) || defined(UNIV_PMEMOBJ_LOG)
57885792
if (req_type.is_log() && mode == OS_AIO_LOG){
57895793
//In NVM_LOG, we don't use aio, so we need to do the post-processing here
57905794
mutex_enter(&fil_system->mutex);
57915795
fil_node_complete_io(node, fil_system, req_type);
57925796
mutex_exit(&fil_system->mutex);
57935797
// log_io_complete() is called in the upper layer
57945798
}
5795-
#endif /*UNIV_NVM_LOG */
5799+
#endif /*UNIV_NVM_LOG || NVM_PMEMOBJ_LOG*/
57965800

57975801
#endif /* UNIV_HOTBACKUP */
57985802

@@ -6019,7 +6023,7 @@ fil_flush(
60196023
node->n_pending_flushes++;
60206024

60216025
mutex_exit(&fil_system->mutex);
6022-
#ifdef UNIV_NVM_LOG
6026+
#if defined (UNIV_NVM_LOG) || defined(UNIV_PMEMOBJ_LOG)
60236027
if ( space->purpose == FIL_TYPE_LOG ){
60246028
//we skip_flush, do nothing
60256029
}

‎storage/innobase/handler/ha_innodb.cc

+9-1
Original file line numberDiff line numberDiff line change
@@ -4382,8 +4382,16 @@ innobase_commit(
43824382
innobase_commit_low(trx);
43834383

43844384
if (!read_only) {
4385+
#if defined(UNIV_NVM_LOG_BUFFER) || defined(UNIV_PMEMOBJ_LOG_BUFFER)
4386+
/*Set this flag to true make the trx_commit_complete_for_mysql() do nothing
4387+
//Since the log buffer now is in NVDIMM, we can safely skip writting
4388+
//and flushing log records when the transaction commit
4389+
//the background thread will do the work
4390+
*/
4391+
trx->flush_log_later = true;
4392+
#else //original
43854393
trx->flush_log_later = false;
4386-
4394+
#endif /*UNIV_NVM_LOG_BUFFER */
43874395
if (innobase_commit_concurrency > 0) {
43884396

43894397
mysql_mutex_lock(&commit_cond_m);

0 commit comments

Comments
 (0)
Please sign in to comment.