Skip to content

Commit

Permalink
Import wiredtiger-wiredtiger-2.8.0-209-g234b68b.tar.gz from wiredtige…
Browse files Browse the repository at this point in the history
…r branch mongodb-3.2

ref: 88b898e..234b68b

SERVER-24306  40-second journaling stall from "log files prepared" to checkpoint
WT-2559       Windows segfault in logging code
WT-2560       Stuck trying to update oldest transaction ID
WT-2613       Windows build failing with a C4100 error
WT-2629       Introduction of ppc64le crc32c assembly file has made the stack executable
SERVER-23954  WiredTiger changes for MongoDB 3.2.7
  • Loading branch information
michaelcahill committed Jun 1, 2016
1 parent d0c19b8 commit ee0fe8a
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 147 deletions.
4 changes: 2 additions & 2 deletions src/third_party/wiredtiger/src/btree/bt_cursor.c
Expand Up @@ -325,7 +325,7 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt)
valid = false;
if (F_ISSET(cbt, WT_CBT_ACTIVE) &&
cbt->ref->page->read_gen != WT_READGEN_OLDEST) {
__wt_txn_cursor_op(session);
WT_ERR(__wt_txn_cursor_op(session));

WT_ERR(btree->type == BTREE_ROW ?
__cursor_row_search(session, cbt, cbt->ref, false) :
Expand Down Expand Up @@ -405,7 +405,7 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp)
if (btree->type == BTREE_ROW &&
F_ISSET(cbt, WT_CBT_ACTIVE) &&
cbt->ref->page->read_gen != WT_READGEN_OLDEST) {
__wt_txn_cursor_op(session);
WT_ERR(__wt_txn_cursor_op(session));

WT_ERR(__cursor_row_search(session, cbt, cbt->ref, true));

Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/btree/bt_read.c
Expand Up @@ -326,7 +326,7 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref)
__wt_page_evict_soon(page);

/* Bump the oldest ID, we're about to do some visibility checks. */
__wt_txn_update_oldest(session, false);
WT_RET(__wt_txn_update_oldest(session, false));

/* If eviction cannot succeed, don't try. */
return (__wt_page_can_evict(session, ref, NULL));
Expand Down
4 changes: 2 additions & 2 deletions src/third_party/wiredtiger/src/btree/bt_sync.c
Expand Up @@ -81,7 +81,7 @@ __sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
if (__wt_page_is_modified(page) &&
WT_TXNID_LT(page->modify->update_txn, oldest_id)) {
if (txn->isolation == WT_ISO_READ_COMMITTED)
__wt_txn_get_snapshot(session);
WT_ERR(__wt_txn_get_snapshot(session));
leaf_bytes += page->memory_footprint;
++leaf_pages;
WT_ERR(__wt_reconcile(session, walk, NULL, 0));
Expand All @@ -100,7 +100,7 @@ __sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
* the metadata shouldn't be that big, and (b) if we do ever
*/
if (txn->isolation == WT_ISO_READ_COMMITTED)
__wt_txn_get_snapshot(session);
WT_ERR(__wt_txn_get_snapshot(session));

/*
* We cannot check the tree modified flag in the case of a
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/conn/conn_open.c
Expand Up @@ -93,7 +93,7 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn)
* transaction ID will catch up with the current ID.
*/
for (;;) {
__wt_txn_update_oldest(session, true);
WT_TRET(__wt_txn_update_oldest(session, true));
if (txn_global->oldest_id == txn_global->current)
break;
__wt_yield();
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/cursor/cur_ds.c
Expand Up @@ -16,7 +16,7 @@ static int
__curds_txn_enter(WT_SESSION_IMPL *session)
{
session->ncursors++; /* XXX */
__wt_txn_cursor_op(session);
WT_RET(__wt_txn_cursor_op(session));

return (0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/evict/evict_file.c
Expand Up @@ -26,7 +26,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
WT_RET(__wt_evict_file_exclusive_on(session));

/* Make sure the oldest transaction ID is up-to-date. */
__wt_txn_update_oldest(session, true);
WT_RET(__wt_txn_update_oldest(session, true));

/* Walk the tree, discarding pages. */
next_ref = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/evict/evict_lru.c
Expand Up @@ -594,7 +594,7 @@ __evict_pass(WT_SESSION_IMPL *session)
* of whether the cache is full, to prevent the oldest ID
* falling too far behind.
*/
__wt_txn_update_oldest(session, true);
WT_RET(__wt_txn_update_oldest(session, loop > 0));

if (!__evict_update_work(session))
break;
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/evict/evict_page.c
Expand Up @@ -420,7 +420,7 @@ __evict_review(
* fallen behind current.
*/
if (modified)
__wt_txn_update_oldest(session, true);
WT_RET(__wt_txn_update_oldest(session, false));

if (!__wt_page_can_evict(session, ref, inmem_splitp))
return (EBUSY);
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/include/cursor.i
Expand Up @@ -270,7 +270,7 @@ __cursor_func_init(WT_CURSOR_BTREE *cbt, bool reenter)
* to read.
*/
if (!F_ISSET(cbt, WT_CBT_NO_TXN))
__wt_txn_cursor_op(session);
WT_RET(__wt_txn_cursor_op(session));
return (0);
}

Expand Down
4 changes: 2 additions & 2 deletions src/third_party/wiredtiger/src/include/extern.h
Expand Up @@ -676,8 +676,8 @@ extern void __wt_stat_join_clear_single(WT_JOIN_STATS *stats);
extern void __wt_stat_join_clear_all(WT_JOIN_STATS **stats);
extern void __wt_stat_join_aggregate( WT_JOIN_STATS **from, WT_JOIN_STATS *to);
extern void __wt_txn_release_snapshot(WT_SESSION_IMPL *session);
extern void __wt_txn_get_snapshot(WT_SESSION_IMPL *session);
extern void __wt_txn_update_oldest(WT_SESSION_IMPL *session, bool force);
extern int __wt_txn_get_snapshot(WT_SESSION_IMPL *session);
extern int __wt_txn_update_oldest(WT_SESSION_IMPL *session, bool force);
extern int __wt_txn_config(WT_SESSION_IMPL *session, const char *cfg[]);
extern void __wt_txn_release(WT_SESSION_IMPL *session);
extern int __wt_txn_commit(WT_SESSION_IMPL *session, const char *cfg[]);
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/include/serial.i
Expand Up @@ -306,7 +306,7 @@ __wt_update_serial(WT_SESSION_IMPL *session, WT_PAGE *page,
if ((txn = page->modify->obsolete_check_txn) != WT_TXN_NONE) {
if (!__wt_txn_visible_all(session, txn)) {
/* Try to move the oldest ID forward and re-check. */
__wt_txn_update_oldest(session, false);
WT_RET(__wt_txn_update_oldest(session, false));

if (!__wt_txn_visible_all(session, txn))
return (0);
Expand Down
9 changes: 6 additions & 3 deletions src/third_party/wiredtiger/src/include/txn.h
Expand Up @@ -74,16 +74,19 @@ struct __wt_txn_global {
volatile uint64_t current; /* Current transaction ID. */

/* The oldest running transaction ID (may race). */
uint64_t last_running;
volatile uint64_t last_running;

/*
* The oldest transaction ID that is not yet visible to some
* transaction in the system.
*/
volatile uint64_t oldest_id;

/* Count of scanning threads, or -1 for exclusive access. */
volatile int32_t scan_count;
/*
* Prevents the oldest ID moving forwards while threads are scanning
* the global transaction state.
*/
WT_RWLOCK *scan_rwlock;

/*
* Track information about the running checkpoint. The transaction
Expand Down
12 changes: 7 additions & 5 deletions src/third_party/wiredtiger/src/include/txn.i
Expand Up @@ -261,14 +261,14 @@ __wt_txn_begin(WT_SESSION_IMPL *session, const char *cfg[])
* eviction, it's better to do it beforehand.
*/
WT_RET(__wt_cache_eviction_check(session, false, NULL));

__wt_txn_get_snapshot(session);
WT_RET(__wt_txn_get_snapshot(session));
}

F_SET(txn, WT_TXN_RUNNING);
if (F_ISSET(S2C(session), WT_CONN_READONLY))
F_SET(txn, WT_TXN_READONLY);
return (false);

return (0);
}

/*
Expand Down Expand Up @@ -450,7 +450,7 @@ __wt_txn_read_last(WT_SESSION_IMPL *session)
* __wt_txn_cursor_op --
* Called for each cursor operation.
*/
static inline void
static inline int
__wt_txn_cursor_op(WT_SESSION_IMPL *session)
{
WT_TXN *txn;
Expand Down Expand Up @@ -482,7 +482,9 @@ __wt_txn_cursor_op(WT_SESSION_IMPL *session)
if (txn_state->snap_min == WT_TXN_NONE)
txn_state->snap_min = txn_global->last_running;
} else if (!F_ISSET(txn, WT_TXN_HAS_SNAPSHOT))
__wt_txn_get_snapshot(session);
WT_RET(__wt_txn_get_snapshot(session));

return (0);
}

/*
Expand Down
29 changes: 25 additions & 4 deletions src/third_party/wiredtiger/src/log/log.c
Expand Up @@ -8,6 +8,8 @@

#include "wt_internal.h"

static int __log_openfile(
WT_SESSION_IMPL *, bool, WT_FH **, const char *, uint32_t);
static int __log_write_internal(
WT_SESSION_IMPL *, WT_ITEM *, WT_LSN *, uint32_t);

Expand Down Expand Up @@ -93,8 +95,9 @@ __wt_log_background(WT_SESSION_IMPL *session, WT_LSN *lsn)
int
__wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn)
{
WT_LOG *log;
WT_DECL_RET;
WT_FH *log_fh;
WT_LOG *log;

log = S2C(session)->log;

Expand Down Expand Up @@ -129,12 +132,21 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn)
* Sync the log file if needed.
*/
if (__wt_log_cmp(&log->sync_lsn, min_lsn) < 0) {
/*
* Get our own file handle to the log file. It is possible
* for the file handle in the log structure to change out
* from under us and either be NULL or point to a different
* file than we want.
*/
WT_ERR(__log_openfile(session,
false, &log_fh, WT_LOG_FILENAME, min_lsn->l.file));
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"log_force_sync: sync %s to LSN %" PRIu32 "/%" PRIu32,
log->log_fh->name, min_lsn->l.file, min_lsn->l.offset));
WT_ERR(__wt_fsync(session, log->log_fh, true));
log_fh->name, min_lsn->l.file, min_lsn->l.offset));
WT_ERR(__wt_fsync(session, log_fh, true));
log->sync_lsn = *min_lsn;
WT_STAT_FAST_CONN_INCR(session, log_sync);
WT_ERR(__wt_close(session, &log_fh));
WT_ERR(__wt_cond_signal(session, log->log_sync_cond));
}
err:
Expand Down Expand Up @@ -2128,9 +2140,18 @@ __wt_log_flush(WT_SESSION_IMPL *session, uint32_t flags)
* We need to flush out the current slot first to get the real
* end of log LSN in log->alloc_lsn.
*/
WT_RET(__wt_log_flush_lsn(session, &lsn, 0));
WT_RET(__wt_log_flush_lsn(session, &lsn, false));
last_lsn = log->alloc_lsn;

/*
* If the last write caused a switch to a new log file, we should only
* wait for the last write to be flushed. Otherwise, if the workload
* is single-threaded we could wait here forever because the write LSN
* doesn't switch into the new file until it contains a record.
*/
if (last_lsn.l.offset == WT_LOG_FIRST_RECORD)
last_lsn = log->log_close_lsn;

/*
* Wait until all current outstanding writes have been written
* to the file system.
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/lsm/lsm_cursor.c
Expand Up @@ -210,7 +210,7 @@ __clsm_enter(WT_CURSOR_LSM *clsm, bool reset, bool update)
goto open;

if (txn->isolation == WT_ISO_SNAPSHOT)
__wt_txn_cursor_op(session);
WT_RET(__wt_txn_cursor_op(session));

/*
* Figure out how many updates are required for
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/src/lsm/lsm_work_unit.c
Expand Up @@ -289,7 +289,7 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session,
}

/* Stop if a running transaction needs the chunk. */
__wt_txn_update_oldest(session, true);
WT_RET(__wt_txn_update_oldest(session, true));
if (chunk->switch_txn == WT_TXN_NONE ||
!__wt_txn_visible_all(session, chunk->switch_txn)) {
WT_RET(__wt_verbose(session, WT_VERB_LSM,
Expand Down
7 changes: 7 additions & 0 deletions src/third_party/wiredtiger/src/support/power8/crc32.S
Expand Up @@ -769,3 +769,10 @@ FUNC_START(__crc32_vpmsum)

FUNC_END(__crc32_vpmsum)
#endif

/*
* Make sure the stack isn't executable with GCC (regardless of platform).
*/
#ifndef __clang__
.section .note.GNU-stack,"",@progbits
#endif

0 comments on commit ee0fe8a

Please sign in to comment.