From eb7433209268fcb25ee3fdb74b8f7b2f57cf213f Mon Sep 17 00:00:00 2001 From: Etienne Petrel Date: Mon, 26 Sep 2022 18:23:48 +0000 Subject: Import wiredtiger: 4afd038167adcdefefc2a8673f355d941226517f from branch mongodb-master ref: b4070294cd..4afd038167 for: 6.2.0-rc0 WT-9876 Add cursor bound test for apis that resets all cursors internally (#8291) --- src/third_party/wiredtiger/import.data | 2 +- .../wiredtiger/test/suite/test_cursor_bound17.py | 133 +++++++++++++++++++++ 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 src/third_party/wiredtiger/test/suite/test_cursor_bound17.py diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index a331fd69623..06b0b9dc3fe 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "b4070294cdfd2df5e6a3a7f355f6c9109e094048" + "commit": "4afd038167adcdefefc2a8673f355d941226517f" } diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound17.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound17.py new file mode 100644 index 00000000000..ca76f96db3d --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound17.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python +# +# Public Domain 2014-present 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 wiredtiger, wttest +from wtscenario import make_scenarios +from wtbound import bound_base + +# test_cursor_bound17.py +# Test cursor bound reset functionality with special internal reset scenario calls. +class test_cursor_bound17(bound_base): + file_name = 'test_cursor_bound17' + + types = [ + ('file', dict(uri='file:', use_colgroup=False)), + ('table', dict(uri='table:', use_colgroup=False)), + ('colgroup', dict(uri='table:', use_colgroup=True)) + ] + + key_formats = [ + ('string', dict(key_format='S')), + ('var', dict(key_format='r')), + ('int', dict(key_format='i')), + ('bytes', dict(key_format='u')), + ('composite_string', dict(key_format='SSS')), + ('composite_int_string', dict(key_format='iS')), + ('composite_complex', dict(key_format='iSru')), + ] + + value_formats = [ + ('string', dict(value_format='S')), + # FIXME-WT-9851: Enable once FLCS is supported. + # ('fix', dict(value_format='8t')), + ('complex-string', dict(value_format='SS')), + ] + + config = [ + ('evict', dict(evict=True)), + ('no-evict', dict(evict=False)) + ] + scenarios = make_scenarios(config, types, key_formats, value_formats) + + def test_bound_checkpoint_or_rollback(self): + cursor = self.create_session_and_cursor() + + # Test bound api: Test that when checkpoint resets all cursors it doesn't clear the bounds + # on all the cursors. + self.set_bounds(cursor, 30, "lower") + self.set_bounds(cursor, 60, "upper") + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + self.session.checkpoint() + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + cursor.reset() + + # Test bound api: Test that when rollback resets all cursors it doesn't clear the bounds + # on all the cursors. + self.session.begin_transaction() + self.set_bounds(cursor, 30, "lower") + self.set_bounds(cursor, 60, "upper") + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + self.session.rollback_transaction() + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + cursor.reset() + + # Test bound api: Test that when commit resets all cursors it doesn't clear the bounds + # on all the cursors. + self.session.begin_transaction() + self.set_bounds(cursor, 30, "lower") + self.set_bounds(cursor, 60, "upper") + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + self.session.commit_transaction() + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + cursor.reset() + + # Test bound api: Test that when reconfigure resets all cursors it doesn't clear the bounds + # on all the cursors. + self.set_bounds(cursor, 30, "lower") + self.set_bounds(cursor, 60, "upper") + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + self.session.reconfigure("cache_cursors=false") + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + cursor.reset() + + # Test bound api: Test that when session reset api resets all cursors it doesn't clear the + # bounds on all the cursors. + self.set_bounds(cursor, 30, "lower") + self.set_bounds(cursor, 60, "upper") + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + self.session.reset() + self.cursor_traversal_bound(cursor, 30, 60, True) + self.cursor_traversal_bound(cursor, 30, 60, False) + cursor.reset() + + self.cursor_traversal_bound(cursor, None, None, True) + self.cursor_traversal_bound(cursor, None, None, False) + cursor.close() + + +if __name__ == '__main__': + wttest.run() -- cgit v1.2.1