summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2020-06-03 17:32:56 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-03 07:46:19 +0000
commitff99a2afe938bf7aec7e4bbfb0a922d7f70d6712 (patch)
tree07d2afeb5da1be1e9d427d00c37a5160a205f8a9 /src/third_party/wiredtiger/test
parentf9f44a12b3c712d60881b430510bd5b7d603ca1b (diff)
downloadmongo-ff99a2afe938bf7aec7e4bbfb0a922d7f70d6712.tar.gz
Import wiredtiger: 3901b43d1e0f034c46999ccfdbdd0914791859e0 from branch mongodb-4.4r4.4.0-rc8
ref: cc2458c2c2..3901b43d1e for: 4.4.0-rc8 WT-5769 Search history store can potentially walk the whole history store tree WT-6328 Update test_compact02 to handle being halted by eviction pressure WT-6355 test/format can configure keys that are too short WT-6364 Fix double counting sizes of existing updates on the update chain for the history store
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r--src/third_party/wiredtiger/test/format/config.h7
-rw-r--r--src/third_party/wiredtiger/test/suite/test_compact02.py4
-rw-r--r--src/third_party/wiredtiger/test/suite/test_hs11.py30
-rw-r--r--src/third_party/wiredtiger/test/suite/test_hs14.py101
4 files changed, 119 insertions, 23 deletions
diff --git a/src/third_party/wiredtiger/test/format/config.h b/src/third_party/wiredtiger/test/format/config.h
index 80d2ab99cd4..d0023be05d2 100644
--- a/src/third_party/wiredtiger/test/format/config.h
+++ b/src/third_party/wiredtiger/test/format/config.h
@@ -103,7 +103,12 @@ static CONFIG c[] = {
{"btree.key_max", "maximum size of keys", 0x0, 20, 128, MEGABYTE(10), &g.c_key_max, NULL},
- {"btree.key_min", "minimum size of keys", 0x0, 10, 32, 256, &g.c_key_min, NULL},
+ /*
+ * A minimum key size of 11 is necessary. Row-store keys have a leading 10-digit number and the
+ * 11 guarantees we never see a key that we can't convert to a numeric value without formatting
+ * it first because there's a trailing non-digit character in every key.
+ */
+ {"btree.key_min", "minimum size of keys", 0x0, 11, 32, 256, &g.c_key_min, NULL},
{"btree.leaf_page_max", "maximum size of Btree leaf nodes", 0x0, 9, 17, 27, &g.c_leaf_page_max,
NULL},
diff --git a/src/third_party/wiredtiger/test/suite/test_compact02.py b/src/third_party/wiredtiger/test/suite/test_compact02.py
index c15fb5bc78b..e466aa81a95 100644
--- a/src/third_party/wiredtiger/test/suite/test_compact02.py
+++ b/src/third_party/wiredtiger/test/suite/test_compact02.py
@@ -149,11 +149,11 @@ class test_compact02(wttest.WiredTigerTestCase):
# Compact can collide with eviction, if that happens we retry. Wait for
# a long time, the check for EBUSY means we're not retrying on any real
# errors.
- for i in range(1, 60):
+ for i in range(1, 80):
if not self.raisesBusy(
lambda: self.session.compact(self.uri, None)):
break
- time.sleep(5)
+ time.sleep(6)
# 6. Get stats on compacted table.
sz = self.getSize()
diff --git a/src/third_party/wiredtiger/test/suite/test_hs11.py b/src/third_party/wiredtiger/test/suite/test_hs11.py
index f7d31c6796f..efc9d02401c 100644
--- a/src/third_party/wiredtiger/test/suite/test_hs11.py
+++ b/src/third_party/wiredtiger/test/suite/test_hs11.py
@@ -32,12 +32,13 @@ def timestamp_str(t):
return '%x' % t
# test_hs11.py
-# Ensure that mixed mode updates clear the history store records.
+# Ensure that when we delete a key due to a tombstone being globally visible, we delete its
+# associated history store content.
class test_hs11(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB'
session_config = 'isolation=snapshot'
- def run_test(self, update_type):
+ def test_key_deletion_clears_hs(self):
uri = 'table:test_hs11'
create_params = 'key_format=S,value_format=S'
self.session.create(uri, create_params)
@@ -57,16 +58,14 @@ class test_hs11(wttest.WiredTigerTestCase):
# Reconcile and flush versions 1-3 to the history store.
self.session.checkpoint()
- # Apply a mixed mode update.
+ # Apply a non-timestamped tombstone. When the pages get evicted, the keys will get deleted
+ # since the tombstone is globally visible.
for i in range(1, 10000):
if i % 2 == 0:
- if update_type == 'deletion':
- cursor.set_key(str(i))
- cursor.remove()
- else:
- cursor[str(i)] = value2
+ cursor.set_key(str(i))
+ cursor.remove()
- # Now apply an update at timestamp 10.
+ # Now apply an update at timestamp 10 to recreate each key.
for i in range(1, 10000):
self.session.begin_transaction()
cursor[str(i)] = value2
@@ -77,17 +76,8 @@ class test_hs11(wttest.WiredTigerTestCase):
self.session.begin_transaction('read_timestamp=' + timestamp_str(ts))
for i in range(1, 10000):
if i % 2 == 0:
- if update_type == 'deletion':
- cursor.set_key(str(i))
- self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND)
- else:
- self.assertEqual(cursor[str(i)], value2)
+ cursor.set_key(str(i))
+ self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND)
else:
self.assertEqual(cursor[str(i)], value1)
self.session.rollback_transaction()
-
- def test_key_deletion_clears_hs(self):
- self.run_test('deletion')
-
- def test_key_update_clears_hs(self):
- self.run_test('update')
diff --git a/src/third_party/wiredtiger/test/suite/test_hs14.py b/src/third_party/wiredtiger/test/suite/test_hs14.py
new file mode 100644
index 00000000000..ebd5f471f2b
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_hs14.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2020 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 time, wiredtiger, wttest
+
+def timestamp_str(t):
+ return '%x' % t
+
+# test_hs14.py
+# Ensure that point in time reads with few visible history store records don't
+# damage performance.
+class test_hs14(wttest.WiredTigerTestCase):
+ conn_config = 'cache_size=50MB'
+ session_config = 'isolation=snapshot'
+
+ def test_hs14(self):
+ uri = 'table:test_hs14'
+ self.session.create(uri, 'key_format=S,value_format=S')
+ self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(1))
+ cursor = self.session.open_cursor(uri)
+
+ value1 = 'a' * 500
+ value2 = 'b' * 500
+ value3 = 'c' * 500
+ value4 = 'd' * 500
+ value5 = 'e' * 500
+
+ for i in range(1, 10000):
+ self.session.begin_transaction()
+ cursor[str(i)] = value1
+ self.session.commit_transaction('commit_timestamp=' + timestamp_str(2))
+ self.session.begin_transaction()
+ cursor[str(i)] = value2
+ self.session.commit_transaction('commit_timestamp=' + timestamp_str(2))
+ self.session.begin_transaction()
+ cursor[str(i)] = value3
+ self.session.commit_transaction('commit_timestamp=' + timestamp_str(3))
+ self.session.begin_transaction()
+ cursor[str(i)] = value4
+ self.session.commit_transaction('commit_timestamp=' + timestamp_str(4))
+
+ start = time.time()
+ self.session.begin_transaction('read_timestamp=' + timestamp_str(3))
+ for i in range(1, 10000):
+ self.assertEqual(cursor[str(i)], value3)
+ self.session.rollback_transaction()
+ end = time.time()
+
+ # The time spent when all history store keys are visible to us.
+ visible_hs_latency = (end - start)
+
+ for i in range(1, 10000):
+ self.session.begin_transaction()
+ cursor.set_key(str(i))
+ cursor.remove()
+ self.session.commit_transaction('commit_timestamp=' + timestamp_str(5))
+ self.session.begin_transaction()
+ cursor[str(i)] = value5
+ self.session.commit_transaction('commit_timestamp=' + timestamp_str(10))
+
+ start = time.time()
+ self.session.begin_transaction('read_timestamp=' + timestamp_str(9))
+ for i in range(1, 10000):
+ cursor.set_key(str(i))
+ self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND)
+ self.session.rollback_transaction()
+ end = time.time()
+
+ # The time spent when all history store keys are invisible to us.
+ invisible_hs_latency = (end - start)
+
+ self.assertLess(invisible_hs_latency, (visible_hs_latency * 10),
+ "Reader took an order of magnitude longer for when all "
+ "history store records were invisible, visible={}, invisible={}".format(
+ visible_hs_latency, invisible_hs_latency
+ ))