summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/conn
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/conn')
-rw-r--r--src/third_party/wiredtiger/src/conn/api_version.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_api.c10
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_cache.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_cache_pool.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_ckpt.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_dhandle.c60
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_handle.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_log.c46
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_open.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_stat.c6
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_sweep.c12
11 files changed, 87 insertions, 59 deletions
diff --git a/src/third_party/wiredtiger/src/conn/api_version.c b/src/third_party/wiredtiger/src/conn/api_version.c
index 6293d221417..a36cdb8d8eb 100644
--- a/src/third_party/wiredtiger/src/conn/api_version.c
+++ b/src/third_party/wiredtiger/src/conn/api_version.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c
index bd14e1bf4fd..2f62950a36e 100644
--- a/src/third_party/wiredtiger/src/conn/conn_api.c
+++ b/src/third_party/wiredtiger/src/conn/conn_api.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
@@ -1605,6 +1605,7 @@ __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[])
{ "mutex", WT_VERB_MUTEX },
{ "overflow", WT_VERB_OVERFLOW },
{ "read", WT_VERB_READ },
+ { "rebalance", WT_VERB_REBALANCE },
{ "reconcile", WT_VERB_RECONCILE },
{ "recovery", WT_VERB_RECOVERY },
{ "salvage", WT_VERB_SALVAGE },
@@ -1749,7 +1750,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[])
WT_ERR_NOTFOUND_OK(ret);
/* Flush the handle and rename the file into place. */
- ret = __wt_sync_and_rename_fp(
+ ret = __wt_sync_fp_and_rename(
session, &fp, WT_BASECONFIG_SET, WT_BASECONFIG);
if (0) {
@@ -2003,6 +2004,9 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
WT_ERR(__wt_sweep_config(session, cfg));
WT_ERR(__wt_verbose_config(session, cfg));
+ /* Initialize the OS page size for mmap */
+ conn->page_size = __wt_get_vm_pagesize();
+
/* Now that we know if verbose is configured, output the version. */
WT_ERR(__wt_verbose(
session, WT_VERB_VERSION, "%s", WIREDTIGER_VERSION_STRING));
@@ -2061,7 +2065,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
* DATABASE HOME, IT'S WHAT WE USE TO DECIDE IF WE'RE CREATING OR NOT.
*/
WT_ERR(__wt_turtle_init(session));
- WT_ERR(__wt_metadata_open(session));
+ WT_ERR(__wt_metadata_cursor(session, NULL));
/* Start the worker threads and run recovery. */
WT_ERR(__wt_connection_workers(session, cfg));
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache.c b/src/third_party/wiredtiger/src/conn/conn_cache.c
index a1d509e75bd..1831aad5895 100644
--- a/src/third_party/wiredtiger/src/conn/conn_cache.c
+++ b/src/third_party/wiredtiger/src/conn/conn_cache.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache_pool.c b/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
index 8d16f94c092..72f23b015b7 100644
--- a/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
+++ b/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
diff --git a/src/third_party/wiredtiger/src/conn/conn_ckpt.c b/src/third_party/wiredtiger/src/conn/conn_ckpt.c
index b47e2550b23..a23350a5e46 100644
--- a/src/third_party/wiredtiger/src/conn/conn_ckpt.c
+++ b/src/third_party/wiredtiger/src/conn/conn_ckpt.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
diff --git a/src/third_party/wiredtiger/src/conn/conn_dhandle.c b/src/third_party/wiredtiger/src/conn/conn_dhandle.c
index c6d5b535b86..dedafc2b102 100644
--- a/src/third_party/wiredtiger/src/conn/conn_dhandle.c
+++ b/src/third_party/wiredtiger/src/conn/conn_dhandle.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
@@ -119,46 +119,29 @@ __wt_conn_dhandle_find(
}
/*
- * __conn_dhandle_mark_dead --
- * Mark a data handle dead.
- */
-static int
-__conn_dhandle_mark_dead(WT_SESSION_IMPL *session)
-{
- bool evict_reset;
-
- /*
- * Handle forced discard (e.g., when dropping a file).
- *
- * We need exclusive access to the file -- disable ordinary
- * eviction and drain any blocks already queued.
- */
- WT_RET(__wt_evict_file_exclusive_on(session, &evict_reset));
- F_SET(session->dhandle, WT_DHANDLE_DEAD);
- if (evict_reset)
- __wt_evict_file_exclusive_off(session);
- return (0);
-}
-
-/*
* __wt_conn_btree_sync_and_close --
* Sync and close the underlying btree handle.
*/
int
__wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, bool final, bool force)
{
+ WT_BM *bm;
WT_BTREE *btree;
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
- bool marked_dead, no_schema_lock;
+ bool evict_reset, marked_dead, no_schema_lock;
btree = S2BT(session);
+ bm = btree->bm;
dhandle = session->dhandle;
marked_dead = false;
if (!F_ISSET(dhandle, WT_DHANDLE_OPEN))
return (0);
+ /* Ensure that we aren't racing with the eviction server */
+ WT_RET(__wt_evict_file_exclusive_on(session, &evict_reset));
+
/*
* If we don't already have the schema lock, make it an error to try
* to acquire it. The problem is that we are holding an exclusive
@@ -191,8 +174,16 @@ __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, bool final, bool force)
*/
if (!F_ISSET(btree,
WT_BTREE_SALVAGE | WT_BTREE_UPGRADE | WT_BTREE_VERIFY)) {
- if (force && (btree->bm == NULL || btree->bm->map == NULL)) {
- WT_ERR(__conn_dhandle_mark_dead(session));
+ if (force && (bm == NULL || !bm->is_mapped(bm, session))) {
+ F_SET(session->dhandle, WT_DHANDLE_DEAD);
+
+ /*
+ * Reset the tree's eviction priority, and the tree is
+ * evictable by definition.
+ */
+ __wt_evict_priority_clear(session);
+ F_CLR(S2BT(session), WT_BTREE_NO_EVICTION);
+
marked_dead = true;
}
if (!marked_dead || final)
@@ -215,6 +206,9 @@ __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, bool final, bool force)
err: __wt_spin_unlock(session, &dhandle->close_lock);
+ if (evict_reset)
+ __wt_evict_file_exclusive_off(session);
+
if (no_schema_lock)
F_CLR(session, WT_SESSION_NO_SCHEMA_LOCK);
@@ -650,8 +644,9 @@ __wt_conn_dhandle_discard_single(
F_SET(S2C(session)->cache, WT_CACHE_CLEAR_WALKS);
/* Try to remove the handle, protected by the data handle lock. */
- WT_WITH_HANDLE_LIST_LOCK(session,
- WT_TRET(__conn_dhandle_remove(session, final)));
+ WT_WITH_HANDLE_LIST_LOCK(session, tret,
+ tret = __conn_dhandle_remove(session, final));
+ WT_TRET(tret);
/*
* After successfully removing the handle, clean it up.
@@ -709,6 +704,15 @@ restart:
__wt_session_close_cache(session);
F_SET(session, WT_SESSION_NO_DATA_HANDLES);
+ /*
+ * The connection may have an open metadata cursor handle. We cannot
+ * close it before now because it's potentially used when discarding
+ * other open data handles. Close it before discarding the underlying
+ * metadata handle.
+ */
+ if (session->meta_cursor != NULL)
+ WT_TRET(session->meta_cursor->close(session->meta_cursor));
+
/* Close the metadata file handle. */
while ((dhandle = TAILQ_FIRST(&conn->dhqh)) != NULL)
WT_WITH_DHANDLE(session, dhandle,
diff --git a/src/third_party/wiredtiger/src/conn/conn_handle.c b/src/third_party/wiredtiger/src/conn/conn_handle.c
index cc4e3ae2681..12b4e87e921 100644
--- a/src/third_party/wiredtiger/src/conn/conn_handle.c
+++ b/src/third_party/wiredtiger/src/conn/conn_handle.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
diff --git a/src/third_party/wiredtiger/src/conn/conn_log.c b/src/third_party/wiredtiger/src/conn/conn_log.c
index 1d44d816467..ed226393fb0 100644
--- a/src/third_party/wiredtiger/src/conn/conn_log.c
+++ b/src/third_party/wiredtiger/src/conn/conn_log.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
@@ -511,7 +511,7 @@ typedef struct {
* write_lsn in LSN order after the buffer is written to the log file.
*/
int
-__wt_log_wrlsn(WT_SESSION_IMPL *session)
+__wt_log_wrlsn(WT_SESSION_IMPL *session, int *yield)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
@@ -550,6 +550,8 @@ restart:
* based on the release LSN, and then look for them in order.
*/
if (written_i > 0) {
+ if (yield != NULL)
+ *yield = 0;
WT_INSERTION_SORT(written, written_i,
WT_LOG_WRLSN_ENTRY, WT_WRLSN_ENTRY_CMP_LT);
/*
@@ -660,22 +662,31 @@ __log_wrlsn_server(void *arg)
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_SESSION_IMPL *session;
+ int yield;
session = arg;
conn = S2C(session);
+ yield = 0;
while (F_ISSET(conn, WT_CONN_LOG_SERVER_RUN)) {
/*
* Write out any log record buffers.
*/
- WT_ERR(__wt_log_wrlsn(session));
- WT_ERR(__wt_cond_wait(session, conn->log_wrlsn_cond, 10000));
+ WT_ERR(__wt_log_wrlsn(session, &yield));
+ /*
+ * If __wt_log_wrlsn did work we want to yield instead of sleep.
+ */
+ if (yield++ < WT_THOUSAND)
+ __wt_yield();
+ else
+ WT_ERR(__wt_cond_wait(
+ session, conn->log_wrlsn_cond, 10000));
}
/*
* On close we need to do this one more time because there could
* be straggling log writes that need to be written.
*/
WT_ERR(__wt_log_force_write(session, 1));
- WT_ERR(__wt_log_wrlsn(session));
+ WT_ERR(__wt_log_wrlsn(session, NULL));
if (0) {
err: __wt_err(session, ret, "log wrlsn server error");
}
@@ -694,12 +705,12 @@ __log_server(void *arg)
WT_LOG *log;
WT_SESSION_IMPL *session;
int freq_per_sec;
- bool signalled;
+ bool locked, signalled;
session = arg;
conn = S2C(session);
log = conn->log;
- signalled = false;
+ locked = signalled = false;
/*
* Set this to the number of times per second we want to force out the
@@ -740,8 +751,22 @@ __log_server(void *arg)
/*
* Perform log pre-allocation.
*/
- if (conn->log_prealloc > 0)
- WT_ERR(__log_prealloc_once(session));
+ if (conn->log_prealloc > 0) {
+ /*
+ * Log file pre-allocation is disabled when a
+ * hot backup cursor is open because we have
+ * agreed not to rename or remove any files in
+ * the database directory.
+ */
+ WT_ERR(__wt_readlock(
+ session, conn->hot_backup_lock));
+ locked = true;
+ if (!conn->hot_backup)
+ WT_ERR(__log_prealloc_once(session));
+ WT_ERR(__wt_readunlock(
+ session, conn->hot_backup_lock));
+ locked = false;
+ }
/*
* Perform the archive.
@@ -768,6 +793,9 @@ __log_server(void *arg)
if (0) {
err: __wt_err(session, ret, "log server error");
+ if (locked)
+ WT_TRET(__wt_readunlock(
+ session, conn->hot_backup_lock));
}
return (WT_THREAD_RET_VALUE);
}
diff --git a/src/third_party/wiredtiger/src/conn/conn_open.c b/src/third_party/wiredtiger/src/conn/conn_open.c
index 4fe1db1c524..58577b4587d 100644
--- a/src/third_party/wiredtiger/src/conn/conn_open.c
+++ b/src/third_party/wiredtiger/src/conn/conn_open.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
diff --git a/src/third_party/wiredtiger/src/conn/conn_stat.c b/src/third_party/wiredtiger/src/conn/conn_stat.c
index 31438e10606..9edc6091b10 100644
--- a/src/third_party/wiredtiger/src/conn/conn_stat.c
+++ b/src/third_party/wiredtiger/src/conn/conn_stat.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
@@ -340,8 +340,8 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp)
* any that match the list of object sources.
*/
if (conn->stat_sources != NULL) {
- WT_WITH_HANDLE_LIST_LOCK(session, ret =
- __wt_conn_btree_apply(
+ WT_WITH_HANDLE_LIST_LOCK(session, ret,
+ ret = __wt_conn_btree_apply(
session, false, NULL, __statlog_apply, NULL));
WT_RET(ret);
}
diff --git a/src/third_party/wiredtiger/src/conn/conn_sweep.c b/src/third_party/wiredtiger/src/conn/conn_sweep.c
index b9b46f3211c..a15aabdd6fe 100644
--- a/src/third_party/wiredtiger/src/conn/conn_sweep.c
+++ b/src/third_party/wiredtiger/src/conn/conn_sweep.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 MongoDB, Inc.
+ * Copyright (c) 2014-2016 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
@@ -64,11 +64,9 @@ __sweep_expire_one(WT_SESSION_IMPL *session)
WT_BTREE *btree;
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
- bool evict_reset;
btree = S2BT(session);
dhandle = session->dhandle;
- evict_reset = false;
/*
* Acquire an exclusive lock on the handle and mark it dead.
@@ -92,9 +90,6 @@ __sweep_expire_one(WT_SESSION_IMPL *session)
!__wt_txn_visible_all(session, btree->rec_max_txn))
goto err;
- /* Ensure that we aren't racing with the eviction server */
- WT_ERR(__wt_evict_file_exclusive_on(session, &evict_reset));
-
/*
* Mark the handle as dead and close the underlying file
* handle. Closing the handle decrements the open file count,
@@ -102,9 +97,6 @@ __sweep_expire_one(WT_SESSION_IMPL *session)
*/
ret = __wt_conn_btree_sync_and_close(session, false, true);
- if (evict_reset)
- __wt_evict_file_exclusive_off(session);
-
err: WT_TRET(__wt_writeunlock(session, dhandle->rwlock));
return (ret);
@@ -243,7 +235,7 @@ __sweep_remove_handles(WT_SESSION_IMPL *session)
if (!WT_DHANDLE_CAN_DISCARD(dhandle))
continue;
- WT_WITH_HANDLE_LIST_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session, ret,
ret = __sweep_remove_one(session, dhandle));
if (ret == 0)
WT_STAT_FAST_CONN_INCR(session, dh_sweep_remove);