summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-11-08 07:23:43 -0500
committerGitHub <noreply@github.com>2016-11-08 07:23:43 -0500
commitc2db2b0b43973b0c8e31bbce18081605aaf6cea3 (patch)
tree5dcd5efeef48c33ad2fd035e4174868ae625e5a4
parentf8afbce1f26f5a6683594641279ad0c065145825 (diff)
downloadmongo-c2db2b0b43973b0c8e31bbce18081605aaf6cea3.tar.gz
WT-3002 Allow applications to exempt threads from eviction. (#3116)
* WT-3002 Allow applications to exempt threads from eviction. * Update wiredtiger.in. * Rename config key, make WT_SESSION::reconfigure only apply to passed-in values. Add a basic smoke test of WT_SESSION::reconfigure. * whitespace * Update.
-rw-r--r--.gitignore8
-rw-r--r--dist/api_data.py11
-rw-r--r--src/config/config_def.c10
-rw-r--r--src/include/wiredtiger.in10
-rw-r--r--src/session/session_api.c24
-rw-r--r--test/suite/test_reconfig04.py47
6 files changed, 97 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index bef47daabf9..cd1873533ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,11 +16,12 @@
*.obj
*.pdb
*.pyc
+.dirstamp
.sconf_temp
.sconsign.dblite
-.dirstamp
/Makefile.am
/aclocal.m4
+/autom4te.cache/
/build_posix/aclocal/libtool.m4
/build_posix/aclocal/ltoptions.m4
/build_posix/aclocal/ltsugar.m4
@@ -32,7 +33,7 @@
/config.status
/configure
/configure.ac
-/libtool/
+/libtool
/stamp-h1
/wiredtiger.h
/wiredtiger.pc
@@ -63,9 +64,9 @@ WT_TEST/
# Python
/lang/python/_wiredtiger.so
+/lang/python/wiredtiger.py
/lang/python/wiredtiger/__init__.py
/lang/python/wiredtiger/_wiredtiger.pyd
-/lang/python/wiredtiger.py
/lang/python/wiredtiger_wrap.c
_wiredtiger.pyd
@@ -106,6 +107,7 @@ _wiredtiger.pyd
**/test/csuite/test_wt2719_reconfig
**/test/csuite/test_wt2834_join_bloom_fix
**/test/csuite/test_wt2853_perf
+**/test/csuite/test_wt2999_join_extractor
**/test/cursor_order/cursor_order
**/test/fops/t
**/test/format/s_dumpcmp
diff --git a/dist/api_data.py b/dist/api_data.py
index 22d06c380ae..7016be374a8 100644
--- a/dist/api_data.py
+++ b/dist/api_data.py
@@ -190,9 +190,8 @@ file_config = format_meta + [
WiredTiger to consume memory over the configured cache limit''',
type='boolean'),
Config('internal_key_truncate', 'true', r'''
- configure internal key truncation, discarding unnecessary
- trailing bytes on internal keys (ignored for custom
- collators)''',
+ configure internal key truncation, discarding unnecessary trailing
+ bytes on internal keys (ignored for custom collators)''',
type='boolean'),
Config('internal_page_max', '4KB', r'''
the maximum page size for internal nodes, in bytes; the size
@@ -637,6 +636,12 @@ wiredtiger_open_statistics_log_configuration = [
]
session_config = [
+ Config('ignore_cache_size', 'false', r'''
+ when set, operations performed by this session ignore the cache size
+ and are not blocked when the cache is full. Note that use of this
+ option for operations that create cache pressure can starve ordinary
+ sessions that obey the cache size.''',
+ type='boolean'),
Config('isolation', 'read-committed', r'''
the default isolation level for operations in this session''',
choices=['read-uncommitted', 'read-committed', 'snapshot']),
diff --git a/src/config/config_def.c b/src/config/config_def.c
index d57bc418c93..540cf846e90 100644
--- a/src/config/config_def.c
+++ b/src/config/config_def.c
@@ -24,6 +24,7 @@ static const WT_CONFIG_CHECK confchk_WT_CONNECTION_load_extension[] = {
};
static const WT_CONFIG_CHECK confchk_WT_CONNECTION_open_session[] = {
+ { "ignore_cache_size", "boolean", NULL, NULL, NULL, 0 },
{ "isolation", "string",
NULL, "choices=[\"read-uncommitted\",\"read-committed\","
"\"snapshot\"]",
@@ -344,6 +345,7 @@ static const WT_CONFIG_CHECK confchk_WT_SESSION_open_cursor[] = {
};
static const WT_CONFIG_CHECK confchk_WT_SESSION_reconfigure[] = {
+ { "ignore_cache_size", "boolean", NULL, NULL, NULL, 0 },
{ "isolation", "string",
NULL, "choices=[\"read-uncommitted\",\"read-committed\","
"\"snapshot\"]",
@@ -1017,8 +1019,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {
confchk_WT_CONNECTION_load_extension, 4
},
{ "WT_CONNECTION.open_session",
- "isolation=read-committed",
- confchk_WT_CONNECTION_open_session, 1
+ "ignore_cache_size=false,isolation=read-committed",
+ confchk_WT_CONNECTION_open_session, 2
},
{ "WT_CONNECTION.reconfigure",
"async=(enabled=false,ops_max=1024,threads=2),cache_overhead=8,"
@@ -1116,8 +1118,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {
NULL, 0
},
{ "WT_SESSION.reconfigure",
- "isolation=read-committed",
- confchk_WT_SESSION_reconfigure, 1
+ "ignore_cache_size=false,isolation=read-committed",
+ confchk_WT_SESSION_reconfigure, 2
},
{ "WT_SESSION.rename",
"",
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 665e8eaf4b0..296e510d8d4 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -827,6 +827,11 @@ struct __wt_session {
*
* @param session the session handle
* @configstart{WT_SESSION.reconfigure, see dist/api_data.py}
+ * @config{ignore_cache_size, when set\, operations performed by this
+ * session ignore the cache size and are not blocked when the cache is
+ * full. Note that use of this option for operations that create cache
+ * pressure can starve ordinary sessions that obey the cache size., a
+ * boolean flag; default \c false.}
* @config{isolation, the default isolation level for operations in this
* session., a string\, chosen from the following options: \c
* "read-uncommitted"\, \c "read-committed"\, \c "snapshot"; default \c
@@ -2005,6 +2010,11 @@ struct __wt_connection {
* connection's error handler is used. See @ref error_handling_event
* for more information.
* @configstart{WT_CONNECTION.open_session, see dist/api_data.py}
+ * @config{ignore_cache_size, when set\, operations performed by this
+ * session ignore the cache size and are not blocked when the cache is
+ * full. Note that use of this option for operations that create cache
+ * pressure can starve ordinary sessions that obey the cache size., a
+ * boolean flag; default \c false.}
* @config{isolation, the default isolation level for operations in this
* session., a string\, chosen from the following options: \c
* "read-uncommitted"\, \c "read-committed"\, \c "snapshot"; default \c
diff --git a/src/session/session_api.c b/src/session/session_api.c
index 3afea383b08..00c2852649f 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -249,18 +249,36 @@ __session_reconfigure(WT_SESSION *wt_session, const char *config)
session = (WT_SESSION_IMPL *)wt_session;
SESSION_API_CALL(session, reconfigure, config, cfg);
+ /*
+ * Note that this method only checks keys that are passed in by the
+ * application: we don't want to reset other session settings to their
+ * default values.
+ */
+ WT_UNUSED(cfg);
+
if (F_ISSET(&session->txn, WT_TXN_RUNNING))
WT_ERR_MSG(session, EINVAL, "transaction in progress");
- WT_TRET(__wt_session_reset_cursors(session, false));
+ WT_ERR(__wt_session_reset_cursors(session, false));
- WT_ERR(__wt_config_gets_def(session, cfg, "isolation", 0, &cval));
- if (cval.len != 0)
+ ret = __wt_config_getones(session, config, "isolation", &cval);
+ if (ret == 0 && cval.len != 0) {
session->isolation = session->txn.isolation =
WT_STRING_MATCH("snapshot", cval.str, cval.len) ?
WT_ISO_SNAPSHOT :
WT_STRING_MATCH("read-uncommitted", cval.str, cval.len) ?
WT_ISO_READ_UNCOMMITTED : WT_ISO_READ_COMMITTED;
+ }
+ WT_ERR_NOTFOUND_OK(ret);
+
+ ret = __wt_config_getones(session, config, "ignore_cache_size", &cval);
+ if (ret == 0) {
+ if (cval.val)
+ F_SET(session, WT_SESSION_NO_EVICTION);
+ else
+ F_CLR(session, WT_SESSION_NO_EVICTION);
+ }
+ WT_ERR_NOTFOUND_OK(ret);
err: API_END_RET_NOTFOUND_MAP(session, ret);
}
diff --git a/test/suite/test_reconfig04.py b/test/suite/test_reconfig04.py
new file mode 100644
index 00000000000..be5e6d3729e
--- /dev/null
+++ b/test/suite/test_reconfig04.py
@@ -0,0 +1,47 @@
+#!/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 wtdataset import SimpleDataSet
+
+# test_reconfig04.py
+# Test WT_SESSION::reconfigure
+class test_reconfig04(wttest.WiredTigerTestCase):
+ def test_session_reconfigure(self):
+ self.session.reconfigure('ignore_cache_size=false')
+
+ self.session.reconfigure('isolation=snapshot')
+ self.session.reconfigure('isolation=read-committed')
+ self.session.reconfigure('isolation=read-uncommitted')
+
+ self.session.reconfigure('ignore_cache_size=true')
+ self.session.reconfigure('isolation=snapshot')
+
+if __name__ == '__main__':
+ wttest.run()