From 78fd754a3b3b4fc96c2c2a4c44da576e3261bd34 Mon Sep 17 00:00:00 2001 From: Don Anderson Date: Thu, 4 Aug 2016 12:38:19 -0400 Subject: WT-2688 improve build error messages when SWIG is unavailable. (#2928) --- build_posix/configure.ac.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1 From d317d32e167c741462b68edc170f34f212d3c997 Mon Sep 17 00:00:00 2001 From: sueloverso Date: Thu, 4 Aug 2016 14:38:32 -0400 Subject: WT-2812 Verify cache_size before dividing. (#2931) * WT-2812 Verify cache_size before dividing. It can be zero during reconfigure. * Fix test comments. * Fix formatting. * Test fixes from review. --- src/txn/txn_ckpt.c | 14 ++++++++--- test/suite/test_reconfig03.py | 58 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 test/suite/test_reconfig03.py 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() -- cgit v1.2.1 From b33890e7d973645d85fddbd3672aad99c78ad86c Mon Sep 17 00:00:00 2001 From: Michael Cahill Date: Fri, 5 Aug 2016 04:42:29 +1000 Subject: WT-2811 Include the checkpoint transaction if there is no btree. (#2930) Also make sure there is always a read barrier between reading the oldest ID and the pinned checkpoint ID. --- src/include/txn.i | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/include/txn.i b/src/include/txn.i index 8f0f49d9676..d56972d570c 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; /* -- cgit v1.2.1 From 86e03d9baf9f805d39b13755db7e1d81d936eb5f Mon Sep 17 00:00:00 2001 From: Alex Gorrod Date: Fri, 5 Aug 2016 17:08:25 +1000 Subject: WT-2811 The checkpoint session should not ignore it's own transaction ID (#2934) There is a sanity check in reconciliation that transaction IDs always move forward. The tracked ID is updated by both the checkpoint session and reconciliation in service of eviction. Recent changes in when a btree is open for eviction mean that interleaving reconciliation between eviction and checkpoint made it look like time went backwards. --- src/include/txn.i | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/include/txn.i b/src/include/txn.i index d56972d570c..ffd319fd5c1 100644 --- a/src/include/txn.i +++ b/src/include/txn.i @@ -129,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); -- cgit v1.2.1