summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-08-05 17:10:03 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2016-08-05 17:10:03 +1000
commit34182adadbac99c6195f7bf06e60904b0e3025e1 (patch)
tree3401f5a3adb69b2116f6745d2c4660592a69217b
parenta9e96961abc9dd20d464bdeb120d792166ee4cf9 (diff)
parent86e03d9baf9f805d39b13755db7e1d81d936eb5f (diff)
downloadmongodb-3.3.11.tar.gz
Merge branch 'develop' into mongodb-3.4mongodb-3.3.11
-rw-r--r--build_posix/configure.ac.in4
-rw-r--r--src/include/txn.i23
-rw-r--r--src/txn/txn_ckpt.c14
-rw-r--r--test/suite/test_reconfig03.py58
4 files changed, 82 insertions, 17 deletions
diff --git a/build_posix/configure.ac.in b/build_posix/configure.ac.in
index bbc6cf89d91..aa5dfac4005 100644
--- a/build_posix/configure.ac.in
+++ b/build_posix/configure.ac.in
@@ -85,8 +85,10 @@ fi
# Java and Python APIs
if test "$wt_cv_enable_java" = "yes" -o "$wt_cv_enable_python" = "yes"; then
+ # Only a warning, we need to build release packages without SWIG.
AX_PKG_SWIG(2.0.4, [],
- [AC_MSG_WARN([SWIG is required to rebuild Java or Python APIs.])])
+ [AC_MSG_WARN([SWIG is required to rebuild Java or Python APIs.]) &&
+ SWIG="SWIG_NOT_FOUND_DURING_CONFIGURE"])
fi
if test "$wt_cv_enable_java" = "yes"; then
diff --git a/src/include/txn.i b/src/include/txn.i
index 8f0f49d9676..ffd319fd5c1 100644
--- a/src/include/txn.i
+++ b/src/include/txn.i
@@ -113,16 +113,14 @@ __wt_txn_oldest_id(WT_SESSION_IMPL *session)
/*
* Take a local copy of these IDs in case they are updated while we are
- * checking visibility. Only the generation needs to be carefully
- * ordered: if a checkpoint is starting and the generation is bumped,
- * we take the minimum of the other two IDs, which is what we want.
+ * checking visibility. The read of the transaction ID pinned by a
+ * checkpoint needs to be carefully ordered: if a checkpoint is
+ * starting and we have to start checking the pinned ID, we take the
+ * minimum of it with the oldest ID, which is what we want.
*/
oldest_id = txn_global->oldest_id;
- if (btree == NULL)
- include_checkpoint_txn = false;
- else
- WT_ORDERED_READ(
- include_checkpoint_txn, btree->include_checkpoint_txn);
+ include_checkpoint_txn = btree == NULL || btree->include_checkpoint_txn;
+ WT_READ_BARRIER();
checkpoint_pinned = txn_global->checkpoint_pinned;
/*
@@ -131,13 +129,12 @@ __wt_txn_oldest_id(WT_SESSION_IMPL *session)
* if they are only required for the checkpoint and it has already
* seen them.
*
- * If there is no active checkpoint, this session is doing the
- * checkpoint, or this handle is up to date with the active checkpoint
- * then it's safe to ignore the checkpoint ID in the visibility check.
+ * If there is no active checkpoint or this handle is up to date with
+ * the active checkpoint then it's safe to ignore the checkpoint ID in
+ * the visibility check.
*/
if (!include_checkpoint_txn || checkpoint_pinned == WT_TXN_NONE ||
- WT_TXNID_LT(oldest_id, checkpoint_pinned) ||
- WT_SESSION_IS_CHECKPOINT(session))
+ WT_TXNID_LT(oldest_id, checkpoint_pinned))
return (oldest_id);
return (checkpoint_pinned);
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index c23f293154a..089237d79e3 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -322,7 +322,7 @@ __checkpoint_reduce_dirty_cache(WT_SESSION_IMPL *session)
struct timespec start, last, stop;
u_int current_dirty;
uint64_t bytes_written_last, bytes_written_start, bytes_written_total;
- uint64_t current_us, stepdown_us, total_ms;
+ uint64_t cache_size, current_us, stepdown_us, total_ms;
bool progress;
conn = S2C(session);
@@ -332,13 +332,21 @@ __checkpoint_reduce_dirty_cache(WT_SESSION_IMPL *session)
last = start;
bytes_written_last = 0;
bytes_written_start = cache->bytes_written;
+ cache_size = conn->cache_size;
+ /*
+ * If the cache size is zero or very small, we're done. The cache
+ * size can briefly become zero if we're transitioning to a shared
+ * cache via reconfigure. This avoids potential divide by zero.
+ */
+ if (cache_size < (WT_MEGABYTE * 5))
+ return (0);
stepdown_us = 10000;
progress = false;
/* Step down the dirty target to the eviction trigger */
for (;;) {
current_dirty = (u_int)((100 *
- __wt_cache_dirty_leaf_inuse(cache)) / conn->cache_size);
+ __wt_cache_dirty_leaf_inuse(cache)) / cache_size);
if (current_dirty <= cache->eviction_dirty_target)
break;
@@ -366,7 +374,7 @@ __checkpoint_reduce_dirty_cache(WT_SESSION_IMPL *session)
(!progress ||
current_dirty <= cache->eviction_dirty_trigger)) {
stepdown_us = (uint64_t)(WT_THOUSAND * (
- (double)(conn->cache_size / 100) /
+ (double)(cache_size / 100) /
(double)(bytes_written_total / total_ms)));
if (!progress)
stepdown_us = WT_MIN(stepdown_us, 200000);
diff --git a/test/suite/test_reconfig03.py b/test/suite/test_reconfig03.py
new file mode 100644
index 00000000000..c667a5c7d9d
--- /dev/null
+++ b/test/suite/test_reconfig03.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2016 MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import fnmatch, os, time
+import wiredtiger, wttest
+from helper import simple_populate
+
+# test_reconfig03.py
+# Test the connection reconfiguration operations used in the MongoDB
+# test reconfigwt.js.
+class test_reconfig03(wttest.WiredTigerTestCase):
+ conn_config = 'log=(archive=false,enabled,file_max=100K,prealloc=false,zero_fill=false),checkpoint=(wait=1),cache_size=1G'
+ uri = "table:reconfig03"
+
+ # Reconfigure similar to MongoDB tests. Sleep so that checkpoint
+ # can run after we've made modifications.
+ def test_reconfig03_mdb(self):
+ entries = 10000
+ simple_populate(self, self.uri, 'key_format=S', entries)
+ time.sleep(1)
+ self.conn.reconfigure("eviction_target=81")
+ simple_populate(self, self.uri, 'key_format=S', entries * 2)
+ time.sleep(1)
+ self.conn.reconfigure("cache_size=81M")
+ simple_populate(self, self.uri, 'key_format=S', entries * 3)
+ time.sleep(1)
+ self.conn.reconfigure("eviction_dirty_target=82")
+ simple_populate(self, self.uri, 'key_format=S', entries * 4)
+ time.sleep(1)
+ self.conn.reconfigure("shared_cache=(chunk=11MB, name=bar, reserve=12MB, size=1G)")
+
+if __name__ == '__main__':
+ wttest.run()