diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2015-09-16 11:41:10 -0400 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2015-09-16 11:41:10 -0400 |
commit | 452b2ee3f9bed8faeb487c0eaadd9080a5871be7 (patch) | |
tree | 7a9f35e7bdb7b8c64bc455bfeb833b68b79c75b2 | |
parent | 0d76fcd0976a55385d68ae5d5d389147f641976b (diff) | |
download | mongo-452b2ee3f9bed8faeb487c0eaadd9080a5871be7.tar.gz |
WT-2104 Backport a form of log_flush to 3.0.
-rw-r--r-- | dist/api_data.py | 9 | ||||
-rw-r--r-- | dist/stat_data.py | 1 | ||||
-rw-r--r-- | lang/java/java_doc.i | 1 | ||||
-rw-r--r-- | src/config/config_def.c | 9 | ||||
-rw-r--r-- | src/include/config.h | 31 | ||||
-rw-r--r-- | src/include/extern.h | 1 | ||||
-rw-r--r-- | src/include/stat.h | 1 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 136 | ||||
-rw-r--r-- | src/log/log.c | 33 | ||||
-rw-r--r-- | src/session/session_api.c | 36 | ||||
-rw-r--r-- | src/support/stat.c | 2 |
11 files changed, 183 insertions, 77 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index 215e3f81803..3b14fae427c 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -662,6 +662,15 @@ methods = { type='boolean'), ]), +'session.log_flush' : Method([ + Config('sync', 'on', r''' + forcibly flush the log and wait for it to synchronize. If + using \c off, then wait for the log to be written to the file + system. If using \c on, wait for the log to be synchronized + to the backing store.''', + choices=['off', 'on']), +]), + 'session.log_printf' : Method([]), 'session.open_cursor' : Method(cursor_runtime_config + [ diff --git a/dist/stat_data.py b/dist/stat_data.py index d27840d3fbc..37843acb188 100644 --- a/dist/stat_data.py +++ b/dist/stat_data.py @@ -228,6 +228,7 @@ connection_stats = [ LogStat('log_compress_small', 'log records too small to compress'), LogStat('log_compress_writes', 'log records compressed'), LogStat('log_compress_write_fails', 'log records not compressed'), + LogStat('log_flush', 'log flush operations'), LogStat('log_max_filesize', 'maximum log file size', 'no_clear,no_scale'), LogStat('log_prealloc_files', 'pre-allocated log files prepared'), LogStat('log_prealloc_max', diff --git a/lang/java/java_doc.i b/lang/java/java_doc.i index 53785a3bab4..d997306d87f 100644 --- a/lang/java/java_doc.i +++ b/lang/java/java_doc.i @@ -33,6 +33,7 @@ COPYDOC(__wt_session, WT_SESSION, open_cursor) COPYDOC(__wt_session, WT_SESSION, create) COPYDOC(__wt_session, WT_SESSION, compact) COPYDOC(__wt_session, WT_SESSION, drop) +COPYDOC(__wt_session, WT_SESSION, log_flush) COPYDOC(__wt_session, WT_SESSION, log_printf) COPYDOC(__wt_session, WT_SESSION, rename) COPYDOC(__wt_session, WT_SESSION, salvage) diff --git a/src/config/config_def.c b/src/config/config_def.c index 2dfcf862cc8..75252afae34 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -299,6 +299,11 @@ static const WT_CONFIG_CHECK confchk_session_drop[] = { { NULL, NULL, NULL, NULL, NULL } }; +static const WT_CONFIG_CHECK confchk_session_log_flush[] = { + { "sync", "string", NULL, "choices=[\"off\",\"on\"]", NULL }, + { NULL, NULL, NULL, NULL, NULL } +}; + static const WT_CONFIG_CHECK confchk_session_open_cursor[] = { { "append", "boolean", NULL, NULL, NULL }, { "bulk", "string", NULL, NULL, NULL }, @@ -742,6 +747,10 @@ static const WT_CONFIG_ENTRY config_entries[] = { "force=0,remove_files=", confchk_session_drop }, + { "session.log_flush", + "sync=on", + confchk_session_log_flush + }, { "session.log_printf", "", NULL diff --git a/src/include/config.h b/src/include/config.h index 1f30667b8d6..8cb793b799c 100644 --- a/src/include/config.h +++ b/src/include/config.h @@ -68,21 +68,22 @@ struct __wt_config_parser_impl { #define WT_CONFIG_ENTRY_session_compact 18 #define WT_CONFIG_ENTRY_session_create 19 #define WT_CONFIG_ENTRY_session_drop 20 -#define WT_CONFIG_ENTRY_session_log_printf 21 -#define WT_CONFIG_ENTRY_session_open_cursor 22 -#define WT_CONFIG_ENTRY_session_reconfigure 23 -#define WT_CONFIG_ENTRY_session_rename 24 -#define WT_CONFIG_ENTRY_session_rollback_transaction 25 -#define WT_CONFIG_ENTRY_session_salvage 26 -#define WT_CONFIG_ENTRY_session_strerror 27 -#define WT_CONFIG_ENTRY_session_truncate 28 -#define WT_CONFIG_ENTRY_session_upgrade 29 -#define WT_CONFIG_ENTRY_session_verify 30 -#define WT_CONFIG_ENTRY_table_meta 31 -#define WT_CONFIG_ENTRY_wiredtiger_open 32 -#define WT_CONFIG_ENTRY_wiredtiger_open_all 33 -#define WT_CONFIG_ENTRY_wiredtiger_open_basecfg 34 -#define WT_CONFIG_ENTRY_wiredtiger_open_usercfg 35 +#define WT_CONFIG_ENTRY_session_log_flush 21 +#define WT_CONFIG_ENTRY_session_log_printf 22 +#define WT_CONFIG_ENTRY_session_open_cursor 23 +#define WT_CONFIG_ENTRY_session_reconfigure 24 +#define WT_CONFIG_ENTRY_session_rename 25 +#define WT_CONFIG_ENTRY_session_rollback_transaction 26 +#define WT_CONFIG_ENTRY_session_salvage 27 +#define WT_CONFIG_ENTRY_session_strerror 28 +#define WT_CONFIG_ENTRY_session_truncate 29 +#define WT_CONFIG_ENTRY_session_upgrade 30 +#define WT_CONFIG_ENTRY_session_verify 31 +#define WT_CONFIG_ENTRY_table_meta 32 +#define WT_CONFIG_ENTRY_wiredtiger_open 33 +#define WT_CONFIG_ENTRY_wiredtiger_open_all 34 +#define WT_CONFIG_ENTRY_wiredtiger_open_basecfg 35 +#define WT_CONFIG_ENTRY_wiredtiger_open_usercfg 36 /* * configuration section: END * DO NOT EDIT: automatically built by dist/flags.py. diff --git a/src/include/extern.h b/src/include/extern.h index a11f3dcd73c..447a74d2d67 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -332,6 +332,7 @@ extern int __wt_log_read(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp extern int __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags, int (*func)(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, WT_LSN *next_lsnp, void *cookie, int firstrecord), void *cookie); extern int __wt_log_write(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, uint32_t flags); extern int __wt_log_vprintf(WT_SESSION_IMPL *session, const char *fmt, va_list ap); +extern int __wt_log_flush(WT_SESSION_IMPL *session, uint32_t flags); extern int __wt_logrec_alloc(WT_SESSION_IMPL *session, size_t size, WT_ITEM **logrecp); extern void __wt_logrec_free(WT_SESSION_IMPL *session, WT_ITEM **logrecp); extern int __wt_logrec_read(WT_SESSION_IMPL *session, const uint8_t **pp, const uint8_t *end, uint32_t *rectypep); diff --git a/src/include/stat.h b/src/include/stat.h index df8f950f330..64d5c4bc71e 100644 --- a/src/include/stat.h +++ b/src/include/stat.h @@ -214,6 +214,7 @@ struct __wt_connection_stats { WT_STATS log_compress_small; WT_STATS log_compress_write_fails; WT_STATS log_compress_writes; + WT_STATS log_flush; WT_STATS log_max_filesize; WT_STATS log_prealloc_files; WT_STATS log_prealloc_max; diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index ab03d2d27ad..2667e02c5b6 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1213,6 +1213,16 @@ struct __wt_session { const char *name, const char *config); /*! + * Flush the log. + * + * @param session the session handle + * @configstart{WT_SESSION.log_flush, see dist/api_data.py} + * @configend + * @errors + */ + int __F(log_flush)(WT_SESSION *session, const char *config); + + /*! * Insert a ::WT_LOGREC_MESSAGE type record in the database log files * (the database must be configured for logging when this method is * called). @@ -3369,130 +3379,132 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1080 /*! log: log records compressed */ #define WT_STAT_CONN_LOG_COMPRESS_WRITES 1081 +/*! log: log flush operations */ +#define WT_STAT_CONN_LOG_FLUSH 1082 /*! log: maximum log file size */ -#define WT_STAT_CONN_LOG_MAX_FILESIZE 1082 +#define WT_STAT_CONN_LOG_MAX_FILESIZE 1083 /*! log: pre-allocated log files prepared */ -#define WT_STAT_CONN_LOG_PREALLOC_FILES 1083 +#define WT_STAT_CONN_LOG_PREALLOC_FILES 1084 /*! log: number of pre-allocated log files to create */ -#define WT_STAT_CONN_LOG_PREALLOC_MAX 1084 +#define WT_STAT_CONN_LOG_PREALLOC_MAX 1085 /*! log: pre-allocated log files used */ -#define WT_STAT_CONN_LOG_PREALLOC_USED 1085 +#define WT_STAT_CONN_LOG_PREALLOC_USED 1086 /*! log: log read operations */ -#define WT_STAT_CONN_LOG_READS 1086 +#define WT_STAT_CONN_LOG_READS 1087 /*! log: log release advances write LSN */ -#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1087 +#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1088 /*! log: records processed by log scan */ -#define WT_STAT_CONN_LOG_SCAN_RECORDS 1088 +#define WT_STAT_CONN_LOG_SCAN_RECORDS 1089 /*! log: log scan records requiring two reads */ -#define WT_STAT_CONN_LOG_SCAN_REREADS 1089 +#define WT_STAT_CONN_LOG_SCAN_REREADS 1090 /*! log: log scan operations */ -#define WT_STAT_CONN_LOG_SCANS 1090 +#define WT_STAT_CONN_LOG_SCANS 1091 /*! log: consolidated slot closures */ -#define WT_STAT_CONN_LOG_SLOT_CLOSES 1091 +#define WT_STAT_CONN_LOG_SLOT_CLOSES 1092 /*! log: logging bytes consolidated */ -#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1092 +#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1093 /*! log: consolidated slot joins */ -#define WT_STAT_CONN_LOG_SLOT_JOINS 1093 +#define WT_STAT_CONN_LOG_SLOT_JOINS 1094 /*! log: consolidated slot join races */ -#define WT_STAT_CONN_LOG_SLOT_RACES 1094 +#define WT_STAT_CONN_LOG_SLOT_RACES 1095 /*! log: slots selected for switching that were unavailable */ -#define WT_STAT_CONN_LOG_SLOT_SWITCH_FAILS 1095 +#define WT_STAT_CONN_LOG_SLOT_SWITCH_FAILS 1096 /*! log: record size exceeded maximum */ -#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1096 +#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1097 /*! log: failed to find a slot large enough for record */ -#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1097 +#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1098 /*! log: consolidated slot join transitions */ -#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1098 +#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1099 /*! log: log sync operations */ -#define WT_STAT_CONN_LOG_SYNC 1099 +#define WT_STAT_CONN_LOG_SYNC 1100 /*! log: log sync_dir operations */ -#define WT_STAT_CONN_LOG_SYNC_DIR 1100 +#define WT_STAT_CONN_LOG_SYNC_DIR 1101 /*! log: log server thread advances write LSN */ -#define WT_STAT_CONN_LOG_WRITE_LSN 1101 +#define WT_STAT_CONN_LOG_WRITE_LSN 1102 /*! log: log write operations */ -#define WT_STAT_CONN_LOG_WRITES 1102 +#define WT_STAT_CONN_LOG_WRITES 1103 /*! LSM: sleep for LSM checkpoint throttle */ -#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1103 +#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1104 /*! LSM: sleep for LSM merge throttle */ -#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1104 +#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1105 /*! LSM: rows merged in an LSM tree */ -#define WT_STAT_CONN_LSM_ROWS_MERGED 1105 +#define WT_STAT_CONN_LSM_ROWS_MERGED 1106 /*! LSM: application work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1106 +#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1107 /*! LSM: merge work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1107 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1108 /*! LSM: tree queue hit maximum */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1108 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1109 /*! LSM: switch work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1109 +#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1110 /*! LSM: tree maintenance operations scheduled */ -#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1110 +#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1111 /*! LSM: tree maintenance operations discarded */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1111 +#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1112 /*! LSM: tree maintenance operations executed */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1112 +#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1113 /*! connection: memory allocations */ -#define WT_STAT_CONN_MEMORY_ALLOCATION 1113 +#define WT_STAT_CONN_MEMORY_ALLOCATION 1114 /*! connection: memory frees */ -#define WT_STAT_CONN_MEMORY_FREE 1114 +#define WT_STAT_CONN_MEMORY_FREE 1115 /*! connection: memory re-allocations */ -#define WT_STAT_CONN_MEMORY_GROW 1115 +#define WT_STAT_CONN_MEMORY_GROW 1116 /*! thread-yield: page acquire busy blocked */ -#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1116 +#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1117 /*! thread-yield: page acquire eviction blocked */ -#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1117 +#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1118 /*! thread-yield: page acquire locked blocked */ -#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1118 +#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1119 /*! thread-yield: page acquire read blocked */ -#define WT_STAT_CONN_PAGE_READ_BLOCKED 1119 +#define WT_STAT_CONN_PAGE_READ_BLOCKED 1120 /*! thread-yield: page acquire time sleeping (usecs) */ -#define WT_STAT_CONN_PAGE_SLEEP 1120 +#define WT_STAT_CONN_PAGE_SLEEP 1121 /*! connection: total read I/Os */ -#define WT_STAT_CONN_READ_IO 1121 +#define WT_STAT_CONN_READ_IO 1122 /*! reconciliation: page reconciliation calls */ -#define WT_STAT_CONN_REC_PAGES 1122 +#define WT_STAT_CONN_REC_PAGES 1123 /*! reconciliation: page reconciliation calls for eviction */ -#define WT_STAT_CONN_REC_PAGES_EVICTION 1123 +#define WT_STAT_CONN_REC_PAGES_EVICTION 1124 /*! reconciliation: split bytes currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1124 +#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1125 /*! reconciliation: split objects currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1125 +#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1126 /*! connection: pthread mutex shared lock read-lock calls */ -#define WT_STAT_CONN_RWLOCK_READ 1126 +#define WT_STAT_CONN_RWLOCK_READ 1127 /*! connection: pthread mutex shared lock write-lock calls */ -#define WT_STAT_CONN_RWLOCK_WRITE 1127 +#define WT_STAT_CONN_RWLOCK_WRITE 1128 /*! session: open cursor count */ -#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1128 +#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1129 /*! session: open session count */ -#define WT_STAT_CONN_SESSION_OPEN 1129 +#define WT_STAT_CONN_SESSION_OPEN 1130 /*! transaction: transaction begins */ -#define WT_STAT_CONN_TXN_BEGIN 1130 +#define WT_STAT_CONN_TXN_BEGIN 1131 /*! transaction: transaction checkpoints */ -#define WT_STAT_CONN_TXN_CHECKPOINT 1131 +#define WT_STAT_CONN_TXN_CHECKPOINT 1132 /*! transaction: transaction checkpoint generation */ -#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1132 +#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1133 /*! transaction: transaction checkpoint currently running */ -#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1133 +#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1134 /*! transaction: transaction checkpoint max time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1134 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1135 /*! transaction: transaction checkpoint min time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1135 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1136 /*! transaction: transaction checkpoint most recent time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1136 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1137 /*! transaction: transaction checkpoint total time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1137 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1138 /*! transaction: transactions committed */ -#define WT_STAT_CONN_TXN_COMMIT 1138 +#define WT_STAT_CONN_TXN_COMMIT 1139 /*! transaction: transaction failures due to cache overflow */ -#define WT_STAT_CONN_TXN_FAIL_CACHE 1139 +#define WT_STAT_CONN_TXN_FAIL_CACHE 1140 /*! transaction: transaction range of IDs currently pinned by a checkpoint */ -#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1140 +#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1141 /*! transaction: transaction range of IDs currently pinned */ -#define WT_STAT_CONN_TXN_PINNED_RANGE 1141 +#define WT_STAT_CONN_TXN_PINNED_RANGE 1142 /*! transaction: transactions rolled back */ -#define WT_STAT_CONN_TXN_ROLLBACK 1142 +#define WT_STAT_CONN_TXN_ROLLBACK 1143 /*! connection: total write I/Os */ -#define WT_STAT_CONN_WRITE_IO 1143 +#define WT_STAT_CONN_WRITE_IO 1144 /*! * @} diff --git a/src/log/log.c b/src/log/log.c index 76cf5f55f7b..567200ffa0b 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -1920,3 +1920,36 @@ __wt_log_vprintf(WT_SESSION_IMPL *session, const char *fmt, va_list ap) err: __wt_scr_free(session, &logrec); return (ret); } + +/* + * __wt_log_flush -- + * Forcibly flush the log to the synchronization level specified. + * Wait until it has been completed. + */ +int +__wt_log_flush(WT_SESSION_IMPL *session, uint32_t flags) +{ + WT_CONNECTION_IMPL *conn; + WT_LOG *log; + WT_LSN last_lsn, lsn; + + conn = S2C(session); + WT_ASSERT(session, FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED)); + log = conn->log; + last_lsn = log->alloc_lsn; + lsn = log->write_lsn; + /* + * Wait until all current outstanding writes have been written + * to the file system. + */ + while (LOG_CMP(&last_lsn, &lsn) > 0) { + __wt_yield(); + lsn = log->write_lsn; + } + /* + * If the user wants sync, force it now. + */ + if (LF_ISSET(WT_LOG_FSYNC)) + WT_RET(__wt_log_force_sync(session, &lsn)); + return (0); +} diff --git a/src/session/session_api.c b/src/session/session_api.c index 881be7428e5..af30edb9251 100644 --- a/src/session/session_api.c +++ b/src/session/session_api.c @@ -439,6 +439,41 @@ err: API_END_RET_NOTFOUND_MAP(session, ret); } /* + * __session_log_flush -- + * WT_SESSION->log_flush method. + */ +static int +__session_log_flush(WT_SESSION *wt_session, const char *config) +{ + WT_CONFIG_ITEM cval; + WT_CONNECTION_IMPL *conn; + WT_DECL_RET; + WT_SESSION_IMPL *session; + uint32_t flags; + + session = (WT_SESSION_IMPL *)wt_session; + SESSION_API_CALL(session, log_flush, config, cfg); + WT_STAT_FAST_CONN_INCR(session, log_flush); + + conn = S2C(session); + flags = 0; + /* + * If logging is not enabled there is nothing to do. + */ + if (!FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED)) + WT_ERR_MSG(session, EINVAL, "logging not enabled"); + + WT_ERR(__wt_config_gets_def(session, cfg, "sync", 0, &cval)); + if (WT_STRING_MATCH("on", cval.str, cval.len)) + flags = WT_LOG_FSYNC; + else if (WT_STRING_MATCH("off", cval.str, cval.len)) + flags = WT_LOG_FLUSH; + ret = __wt_log_flush(session, flags); + +err: API_END_RET(session, ret); +} + +/* * __session_log_printf -- * WT_SESSION->log_printf method. */ @@ -1008,6 +1043,7 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, __session_create, __session_compact, __session_drop, + __session_log_flush, __session_log_printf, __session_rename, __session_salvage, diff --git a/src/support/stat.c b/src/support/stat.c index 476566b227f..a95cfcdafbb 100644 --- a/src/support/stat.c +++ b/src/support/stat.c @@ -455,6 +455,7 @@ __wt_stat_init_connection_stats(WT_CONNECTION_STATS *stats) "log: failed to find a slot large enough for record"; stats->log_bytes_payload.desc = "log: log bytes of payload data"; stats->log_bytes_written.desc = "log: log bytes written"; + stats->log_flush.desc = "log: log flush operations"; stats->log_reads.desc = "log: log read operations"; stats->log_compress_writes.desc = "log: log records compressed"; stats->log_compress_write_fails.desc = @@ -630,6 +631,7 @@ __wt_stat_refresh_connection_stats(void *stats_arg) stats->log_slot_toosmall.v = 0; stats->log_bytes_payload.v = 0; stats->log_bytes_written.v = 0; + stats->log_flush.v = 0; stats->log_reads.v = 0; stats->log_compress_writes.v = 0; stats->log_compress_write_fails.v = 0; |