summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-10-24 10:16:26 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-23 23:51:20 +0000
commit5c0815dea7e7f85f6f3b7d2a6a9dc8663682c72f (patch)
tree0c7582ca7d18a9a66e5237d6dd9eb10f91c7bace
parent2c8eb809349a83d2ba8dd69c2ecfee65b7a1342d (diff)
downloadmongo-5c0815dea7e7f85f6f3b7d2a6a9dc8663682c72f.tar.gz
Import wiredtiger: 042827a42111af42b743c1e5add01c584bbcc93d from branch mongodb-master
ref: b55f1f03a6..042827a421 for: 6.2.0-rc0 WT-9144 Update Wiredtiger cursor documentation (#8367)
-rw-r--r--src/third_party/wiredtiger/examples/c/ex_cursor.c11
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/docs/arch-cursor.dox25
-rw-r--r--src/third_party/wiredtiger/src/docs/cursor-ops.dox40
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound01.py4
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound02.py12
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound04.py10
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound06.py16
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound09.py10
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound15.py14
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound16.py10
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor_bound18.py6
12 files changed, 116 insertions, 44 deletions
diff --git a/src/third_party/wiredtiger/examples/c/ex_cursor.c b/src/third_party/wiredtiger/examples/c/ex_cursor.c
index 23377c13a23..5ca30671af6 100644
--- a/src/third_party/wiredtiger/examples/c/ex_cursor.c
+++ b/src/third_party/wiredtiger/examples/c/ex_cursor.c
@@ -31,6 +31,7 @@
#include <test_util.h>
int cursor_reset(WT_CURSOR *cursor);
+int cursor_bound(WT_CURSOR *cursor);
int cursor_forward_scan(WT_CURSOR *cursor);
int cursor_reverse_scan(WT_CURSOR *cursor);
int cursor_search(WT_CURSOR *cursor);
@@ -84,6 +85,16 @@ cursor_reset(WT_CURSOR *cursor)
}
/*! [cursor reset] */
+/*! [cursor bound] */
+int
+cursor_bound(WT_CURSOR *cursor)
+{
+ cursor->set_key(cursor, "A");
+ error_check(cursor->bound(cursor, "action=set,bound=lower"));
+ return (0);
+}
+/*! [cursor bound] */
+
/*! [cursor search] */
int
cursor_search(WT_CURSOR *cursor)
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index dd205f2ee70..7ec3502650a 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": "b55f1f03a66fbe568a3681862b672311b9280b2c"
+ "commit": "042827a42111af42b743c1e5add01c584bbcc93d"
}
diff --git a/src/third_party/wiredtiger/src/docs/arch-cursor.dox b/src/third_party/wiredtiger/src/docs/arch-cursor.dox
index 4b29d8f39b4..4cef76a305f 100644
--- a/src/third_party/wiredtiger/src/docs/arch-cursor.dox
+++ b/src/third_party/wiredtiger/src/docs/arch-cursor.dox
@@ -371,6 +371,31 @@ how many references to closed data handles are freed, we may continue our walk.
usually strike a good balance between not having a lot of overhead for sweeps, and keeping up with
the need to free up shared resources.
+@section arch_cursor_bound Range bounded cursors
+
+Range bounded cursors provide a mechanism for optimizing cursor operations in collections with a large number
+of invisible records. When traversing records the record's key is compared with the bounds set on the cursor and
+the traversal will exit with \c WT_NOTFOUND regardless of whether the value associated with the cursor is visible.
+
+The lower and upper bound in a cursor is represented as a \c WT_ITEM. The implementation applies bounds through the function
+\c __wt_cursor_bound which takes the cursor and a config string as arguments. The config string specifies whether the operation is clearing
+or setting the bound, and if a "set" is in progress, whether the bound is a lower or upper bound. There are four flags that can be set
+when applying bounds: \c WT_CURSTD_BOUND_LOWER, \c WT_CURSTD_BOUND_LOWER_INCLUSIVE, \c WT_CURSTD_BOUND_UPPER, and \c WT_CURSTD_BOUND_UPPER_INCLUSIVE.
+When calling \c __wt_cursor_bound with valid bounds, the respective bound flag is set and the key held on the cursor is copied into the relevant bound buffer.
+When a bounds is set, a copy of the bounds key is made and is kept by the cursor. Thus the memory used for the key when making the \c cursor->bound call
+does not need to be retained by the application. Clearing a cursor's bounds can be done via resetting the cursor or calling bound with the "clear" config
+which will free both bounds buffers.
+
+When calling \c cursor->next and \c cursor->prev on an unpositioned cursor, WiredTiger guarantees that the cursor will start walking from either the start or end of the file respectively.
+The range bounded cursor logic continues to uphold this guarantee. Doing so requires additional logic to place the cursor at the start or end of the range. In \c cursor->next and \c cursor->prev,
+the cursor gets positioned with the function \c __wt_btcur_bounds_position. This attempts to position the cursor on the appropriate bound for the direction of traversal (e.g. lower bound for next).
+If the bound exists, the cursor will be positioned on the bound, if not it could be positioned on the closest valid record (meaning within the bounded range), or the record just outside of the range.
+In the case it's positioned just outside the range, this is still acceptable as it will be marked as "needing walk", and the following traversal (whether next or
+prev) will continue, returning a record within range at completion.
+
+In \c cursor->search_near, \c __btcur_bounds_search_near_reposition is initially called. This function checks whether the given key to be searched for is within
+the bounded range. If not, the key to be searched for will be updated to be the nearest bound.
+
@section arch_cursor_debug_copy Debug copy
When cursors are positioned, their data may point to data in the btree or data allocated in the cursor.
diff --git a/src/third_party/wiredtiger/src/docs/cursor-ops.dox b/src/third_party/wiredtiger/src/docs/cursor-ops.dox
index 256b446d84d..3110eec75e8 100644
--- a/src/third_party/wiredtiger/src/docs/cursor-ops.dox
+++ b/src/third_party/wiredtiger/src/docs/cursor-ops.dox
@@ -161,4 +161,42 @@ that may not be modified or freed by the application. If a longer scope
is required, the application must make a copy of the memory before the
cursor is re-used, closed or reset.
- */
+@section cursor_bound Apply bounds to the cursor
+
+A cursor may have a set of bounds applied to it, this restricts the key range
+that the cursor operates within.
+
+Suppose we have a table with keys \c A to \c Z. We can restrict the cursor to only operate over
+keys \c L->Q. If the cursor walks past key \c Q, the cursor will enter an unpositioned state having
+walked off the "end" of the table from its perspective. Additionally should the cursor perform a
+search_near, it will only search within the key range of \c L->Q. This can provide an application with a
+performance boost when operating within tables that have a large number of deleted or invisible records.
+This is because the key comparison with the bound occurs before we determine if the value associated
+with the key is visible or not. The cursor can have a lower bound set or an upper bound set, or both.
+
+@snippet ex_cursor.c cursor bound
+
+Both or either one of the lower and upper bounds can be set, if a bound is not set then the usual start or end of the file applies.
+Given our previous example had we set a lower bound of \c L and no upper bound then our key range would be \c L->Z. When setting the bounds,
+the relevant bound is set prior with \c cursor->set_key. This key does not have to exist or be visible in order for bounds setting to succeed.
+
+Cursor operations next, prev, search, search near, modify, insert, update, and remove support bounds. When performing a traversal such as
+\c cursor->next or \c cursor->prev, the cursor will only return keys that are within the bounds that have been set. For example, calling \c cursor->next
+on an unpositioned range bounded cursor will position it on the lower bound rather than the start of the key range.
+
+If search is called on a key that's not within bounds, this will result in returning a \c WT_NOTFOUND. Calling \c cursor->search_near with a key outside the range
+will always return a key within the range unless no keys are present. \c cursor->search_near can benefit from range bounded cursors, once the cursor
+traverses outside of the bounded range the \c search_near logic can early exit reducing the overall number of keys visited.
+
+Clearing the bounds can be done through resetting the cursor with \c cursor->reset or by passing a clear config to the bounds API call.
+This will unconditionally clear both bounds.
+
+Bounds API is supported with row-store and variable length column store. Bounds API is not supported with fixed length column store.
+
+The bounds API supports these cursor types:
+- File cursor
+- Table cursor
+- Datastore cursor
+- Dump cursor
+
+*/
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py
index ee5127c4435..5a629e5cc3f 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py
@@ -99,10 +99,8 @@ class test_cursor_bound01(bound_base):
cursor.set_key(self.gen_key(10))
cursor.bound("action=set,bound=upper")
- # Check that clear with bound configuration works properly.
+ # Check that clear works properly.
cursor.bound("action=clear")
- cursor.bound("action=clear,bound=lower")
- cursor.bound("action=clear,bound=upper")
# Check that largest key doesn't work with bounded cursors.
cursor.set_key(self.gen_key(1))
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound02.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound02.py
index ce308dbe473..444e0bb86ec 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound02.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound02.py
@@ -33,7 +33,7 @@ from wtbound import bound_base
# test_cursor_bound02.py
# Test that setting bounds of different key formats works in the cursor bound API. Make
# sure that WiredTiger complains when the upper and lower bounds overlap and that clearing the
-# bounds through the bound API and reset calls work appriopately.
+# bounds through the bound API and reset calls work appropriately.
class test_cursor_bound02(bound_base):
file_name = 'test_cursor_bound02'
@@ -85,10 +85,10 @@ class test_cursor_bound02(bound_base):
cursor.set_key(self.gen_key(90))
self.assertEqual(self.set_bounds(cursor, 90, "upper"), 0)
- # Test bound API: Upper bound < lower bound.
+ # Test bound API: setting upper bound < lower bound is invalid.
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, 30, "upper"), '/Invalid argument/')
- # Test bound API: Lower bound > upper bound.
+ # Test bound API: setting lower bound > upper bound is invalid.
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, 95, "lower"), '/Invalid argument/')
# Test bound API: Test setting lower bound to 20, which would succeed setting upper
@@ -116,7 +116,7 @@ class test_cursor_bound02(bound_base):
self.assertEqual(self.set_bounds(cursor, 90, "upper"), 0)
cursor.insert()
- # Test bound API: that if lower bound is equal to the upper bound, that both bounds needs to
+ # Test bound API: Test that if lower bound is equal to the upper bound, both bounds needs to
# have inclusive configured.
cursor.bound("action=clear")
self.assertEqual(self.set_bounds(cursor, 50, "lower", True), 0)
@@ -124,7 +124,7 @@ class test_cursor_bound02(bound_base):
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=lower,inclusive=false"), '/Invalid argument/')
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=upper,inclusive=false"), '/Invalid argument/')
- # Test bound API: Test that only setting one of the bound inclusive config to true, should
+ # Test bound API: Test that setting only one of the bound inclusive configs to true should
# fail too.
cursor.bound("action=clear")
self.assertEqual(self.set_bounds(cursor, 50, "lower", False), 0)
@@ -175,7 +175,7 @@ class test_cursor_bound02(bound_base):
self.assertEqual(self.set_bounds(cursor, 90, "lower"), 0)
self.assertEqual(self.set_bounds(cursor, 99, "upper"), 0)
- # Test bound API: Make sure that a clear and reset works sequentially.
+ # Test bound API: Make sure that clear and reset works regardless of the order its called.
cursor.reset()
self.assertEqual(cursor.bound("action=clear"), 0)
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound04.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound04.py
index f1ec5c5ae8c..ffeab1492eb 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound04.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound04.py
@@ -33,8 +33,8 @@ from wtbound import bound_base
# test_cursor_bound04.py
# Test the next() and prev() calls in the cursor bound API. There are two scenarios that are
# tested in this python test.
-# 2. Test combination scenarios of using next() and prev() together.
-# 3. Test clearing bounds and special scenarios of the cursor API usage.
+# 1. Test combination scenarios of using next() and prev() together.
+# 2. Test clearing bounds and special scenarios of the cursor API usage.
class test_cursor_bound04(bound_base):
file_name = 'test_cursor_bound04'
@@ -75,7 +75,7 @@ class test_cursor_bound04(bound_base):
key = cursor.get_key()
self.assertEqual(key, self.check_key(self.start_key))
cursor.reset()
-
+
# Test bound api: Test lower bound setting with positioned cursor.
self.set_bounds(cursor, 45, "lower")
self.assertEqual(cursor.next(), 0)
@@ -167,7 +167,7 @@ class test_cursor_bound04(bound_base):
def test_bound_combination_scenario(self):
cursor = self.create_session_and_cursor()
- # Test that basic cases of setting lower bound and performing combination of next() and
+ # Test basic cases of setting lower bound and performing combination of next() and
# prev() calls.
self.set_bounds(cursor, 45, "lower")
self.assertEqual(cursor.next(), 0)
@@ -181,7 +181,7 @@ class test_cursor_bound04(bound_base):
self.assertEqual(key, self.check_key(45))
self.assertEqual(cursor.prev(), wiredtiger.WT_NOTFOUND)
- # Test that basic cases of setting upper bound and performing combination of next() and
+ # Test basic cases of setting upper bound and performing combination of next() and
# prev() calls.
self.set_bounds(cursor, 60, "upper")
self.assertEqual(cursor.prev(), 0)
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound06.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound06.py
index fbc34406fab..f8373182379 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound06.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound06.py
@@ -69,19 +69,19 @@ class test_cursor_bound06(bound_base):
def test_bound_search_scenario(self):
cursor = self.create_session_and_cursor()
- # Search for a non-existant key with no bounds.
+ # Test bound API: Search for a non-existent key with no bounds.
cursor.set_key(self.gen_key(10))
ret = cursor.search()
self.assertEqual(ret, wiredtiger.WT_NOTFOUND)
cursor.reset()
- # Search for an existing key with no bounds.
+ # Test bound API: Search for an existing key with no bounds.
cursor.set_key(self.gen_key(50))
ret = cursor.search()
self.assertEqual(ret, 0)
cursor.reset()
- # Search for a key outside of lower bound.
+ # Test bound API: Search for a key outside of lower bound.
self.set_bounds(cursor, 30, "lower", self.inclusive)
cursor.set_key(self.gen_key(20))
ret = cursor.search()
@@ -95,7 +95,7 @@ class test_cursor_bound06(bound_base):
self.assertEqual(ret, wiredtiger.WT_NOTFOUND)
cursor.reset()
- # Search for a valid key in the middle of the range.
+ # Test bound API: Search for a valid key in the middle of the range.
self.set_bounds(cursor, 20, "lower", self.inclusive)
self.set_bounds(cursor, 40, "upper", self.inclusive)
cursor.set_key(self.gen_key(35))
@@ -103,21 +103,21 @@ class test_cursor_bound06(bound_base):
self.assertEqual(ret, 0)
cursor.reset()
- # Search for a key next to the lower bound.
+ # Test bound API: Search for a key next to the lower bound.
self.set_bounds(cursor, 20, "lower", self.inclusive)
cursor.set_key(self.gen_key(21))
ret = cursor.search()
self.assertEqual(ret, 0)
cursor.reset()
- # Search for a key next to the upper bound.
+ # Test bound API: Search for a key next to the upper bound.
self.set_bounds(cursor, 40, "upper", self.inclusive)
cursor.set_key(self.gen_key(39))
ret = cursor.search()
self.assertEqual(ret, 0)
cursor.reset()
- # Search for a key equal to the bound.
+ # Test bound API: Search for a key equal to the bound.
self.set_bounds(cursor, 60, "upper", self.inclusive)
cursor.set_key(self.gen_key(60))
ret = cursor.search()
@@ -127,7 +127,7 @@ class test_cursor_bound06(bound_base):
self.assertEqual(ret, wiredtiger.WT_NOTFOUND)
cursor.reset()
- # Search for a key equal to the bound.
+ # Test bound API: Search for a key equal to the bound.
self.set_bounds(cursor, 20, "upper", self.inclusive)
cursor.set_key(self.gen_key(20))
ret = cursor.search()
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound09.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound09.py
index 5b2178bb0b1..793c42ccf1d 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound09.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound09.py
@@ -73,7 +73,7 @@ class test_cursor_bound09(bound_base):
# Test ignore prepare.
def test_cursor_bound_prepared(self):
- # Scenario 1: Prepare conflict on search, search_near and next with key set in middle of bounds.
+ # Test bound api: Prepare conflict on search, search_near and next with key set in middle of bounds.
cursor = self.create_session_and_cursor()
session2 = self.conn.open_session()
@@ -109,7 +109,7 @@ class test_cursor_bound09(bound_base):
raise e
session2.rollback_transaction()
- # Scenario 2: Prepare conflict on search, search_near and next with key set on the bounds.
+ # Test bound api: Prepare conflict on search, search_near and next with key set on the bounds.
if (self.ignore_prepare):
session2.begin_transaction('ignore_prepare=true')
else:
@@ -137,7 +137,7 @@ class test_cursor_bound09(bound_base):
raise e
session2.rollback_transaction()
- # Scenario 3: Prepare conflict with prev. Validate keys that aren't in prepared range.
+ # Test bound api: Prepare conflict with prev. Validate keys that aren't in prepared range.
if (self.ignore_prepare):
session2.begin_transaction('ignore_prepare=true')
else:
@@ -163,7 +163,7 @@ class test_cursor_bound09(bound_base):
raise (e)
session2.rollback_transaction()
- # Scenario 4: Prepare conflict with search_near out of the bounds.
+ # Test bound api:: Prepare conflict with search_near out of the bounds.
self.session.rollback_transaction()
# Prepare keys 29-30
@@ -193,7 +193,7 @@ class test_cursor_bound09(bound_base):
raise e
session2.rollback_transaction()
- # Scenario 4: Prepare conflict with next with non-inclusive bounds.
+ # Test bound api:Prepare conflict with next with non-inclusive bounds.
if (self.ignore_prepare):
session2.begin_transaction('ignore_prepare=true')
else:
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound15.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound15.py
index 2cb02c655ef..0b0eafe6ef6 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound15.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound15.py
@@ -86,7 +86,7 @@ class test_cursor_bound15(bound_base):
cursor3 = self.session.open_cursor(uri)
cursor3.reset()
- # Test with only lower bound set.
+ # Test bound api: Test with only lower bound set.
self.assertEqual(self.set_bounds(cursor3, "aab", "lower"), 0)
cursor3.set_key("ab")
self.assertEqual(cursor3.search_near(), -1)
@@ -111,7 +111,7 @@ class test_cursor_bound15(bound_base):
self.assertEqual(cursor3.get_key(), self.check_key("aaa"))
cursor3.reset()
- # Test with only upper bound set.
+ # Test bound api: Test with only upper bound set.
self.assertEqual(self.set_bounds(cursor3, "aac", "upper", True), 0)
cursor3.set_key("aad")
self.assertEqual(cursor3.search_near(), -1)
@@ -130,7 +130,7 @@ class test_cursor_bound15(bound_base):
self.assertEqual(cursor3.get_key(), self.check_key("aaa"))
cursor3.reset()
- # Test with both bounds set.
+ # Test bound api: Test with both bounds set.
self.assertEqual(self.set_bounds(cursor3, "aaa", "lower"), 0)
self.assertEqual(self.set_bounds(cursor3, "aad", "upper"), 0)
cursor3.set_key("aae")
@@ -152,7 +152,7 @@ class test_cursor_bound15(bound_base):
self.assertEqual(cursor3.get_key(), self.check_key("aac"))
cursor3.reset()
- # Test with prefix bounds set.
+ # Test bound api: Test with prefix bounds set.
# Search near for aaza, with prefix bounds aaa should return the closest visible key: aaz.
set_prefix_bound(self, cursor3, "aaz")
self.session.breakpoint()
@@ -161,7 +161,7 @@ class test_cursor_bound15(bound_base):
self.assertEqual(cursor3.get_key(), self.check_key("aaz"))
cursor3.reset()
- # Search near for ab, with prefix bounds "aaa" should return the closest visible key: aaa.
+ # Test bound api: Search near for ab, with prefix bounds "aaa" should return the closest visible key: aaa.
set_prefix_bound(self, cursor3, "aaa")
self.session.breakpoint()
cursor3.set_key("ab")
@@ -169,7 +169,7 @@ class test_cursor_bound15(bound_base):
self.assertEqual(cursor3.get_key(), self.check_key("aaa"))
cursor3.reset()
- # Search near for aac, should return the closest visible key: aac.
+ # Test bound api: Search near for aac, should return the closest visible key: aac.
set_prefix_bound(self, cursor3, "a")
self.session.breakpoint()
cursor3.set_key("aac")
@@ -177,7 +177,7 @@ class test_cursor_bound15(bound_base):
self.assertEqual(cursor3.get_key(), self.check_key("aac"))
cursor3.reset()
- # Search near for aa, should return the closest visible key: aaa.
+ # Test bound api: Search near for aa, should return the closest visible key: aaa.
set_prefix_bound(self, cursor3, "aaa")
self.session.breakpoint()
cursor3.set_key("aa")
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound16.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound16.py
index 204e5925a1d..07802b41b3f 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound16.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound16.py
@@ -85,13 +85,13 @@ class test_cursor_bound16(bound_base):
dumpcurs = self.session.open_cursor(self.uri + self.file_name,
None, dumpopt)
- # Set bounds at lower key 30 and upper key at 50.
+ # Test bound api: Set bounds at lower key 30 and upper key at 50.
self.set_bounds(dumpcurs, self.gen_dump_key(30), "lower")
self.set_bounds(dumpcurs, self.gen_dump_key(50), "upper")
self.cursor_traversal_bound(dumpcurs, self.gen_dump_key(30), self.gen_dump_key(50), True, 21)
self.cursor_traversal_bound(dumpcurs, self.gen_dump_key(30), self.gen_dump_key(50), False, 21)
- # Test basic search near scenarios.
+ # Test bound api: Test basic search near scenarios.
dumpcurs.set_key(self.gen_dump_key(20))
self.assertEqual(dumpcurs.search_near(), 1)
self.assertEqual(dumpcurs.get_key(), self.gen_dump_key(30))
@@ -104,7 +104,7 @@ class test_cursor_bound16(bound_base):
self.assertEqual(dumpcurs.search_near(), -1)
self.assertEqual(dumpcurs.get_key(), self.gen_dump_key(50))
- # Test basic search scenarios.
+ # Test bound api: Test basic search scenarios.
dumpcurs.set_key(self.gen_dump_key(20))
self.assertEqual(dumpcurs.search(), wiredtiger.WT_NOTFOUND)
@@ -114,12 +114,12 @@ class test_cursor_bound16(bound_base):
dumpcurs.set_key(self.gen_dump_key(60))
self.assertEqual(dumpcurs.search(), wiredtiger.WT_NOTFOUND)
- # Test that cursor resets the bounds.
+ # Test bound api: Test that cursor resets the bounds.
self.assertEqual(dumpcurs.reset(), 0)
self.cursor_traversal_bound(dumpcurs, self.start_key, self.end_key, True, 60)
self.cursor_traversal_bound(dumpcurs, self.start_key, self.end_key, False, 60)
- # Test that cursor action clear works and clears the bounds.
+ # Test bound api: Test that cursor action clear works and clears the bounds.
self.set_bounds(dumpcurs, self.gen_dump_key(30), "lower")
self.set_bounds(dumpcurs, self.gen_dump_key(50), "upper")
self.assertEqual(dumpcurs.bound("action=clear"), 0)
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound18.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound18.py
index dd9f8e2b2c2..f61bc15f405 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor_bound18.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound18.py
@@ -69,11 +69,11 @@ class test_cursor_bound18(bound_base):
def test_bound_api(self):
cursor = self.create_session_and_cursor()
- # Test default bound api with column groups.
+ # Test bound api: Test default bound api with column groups.
self.assertEqual(self.set_bounds(cursor, 40, "lower"), 0)
self.assertEqual(self.set_bounds(cursor, 90, "upper"), 0)
- # Test that original bounds persist even if setting one bound fails.
+ # Test bound api: Test that original bounds persist even if setting one bound fails.
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, 30, "upper"), '/Invalid argument/')
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, 95, "lower"), '/Invalid argument/')
@@ -89,7 +89,7 @@ class test_cursor_bound18(bound_base):
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, 80, "lower"), '/Invalid argument/')
self.cursor_traversal_bound(cursor, 50, 70, None)
- #Test successful setting of both bounds.
+ # Test bound api: Test successful setting of both bounds.
self.assertEqual(self.set_bounds(cursor, 50, "lower"), 0)
self.assertEqual(self.set_bounds(cursor, 70, "upper"), 0)
self.cursor_traversal_bound(cursor, 50, 70, None)