Skip to content

Commit f95fd0c

Browse files
wt-vendoring-bot[bot]MongoDB Bot
authored andcommitted
Import wiredtiger: f49c810f58d706c592a7aa54ae44c3dd0c3f3bb9 from branch mongodb-7.0 (#31609)
GitOrigin-RevId: b72b25fae961e57c17d873cbd183389f91fc18bb
1 parent d4fb079 commit f95fd0c

File tree

9 files changed

+92
-18
lines changed

9 files changed

+92
-18
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# All backports must be approved by the backport-approvers Github team.
2+
* @wiredtiger/backport-approvers
3+
4+
# Exclude some test and non-functional folders from the backport approvals.
5+
bench/
6+
dist/
7+
test/
8+
tools/
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"vendor": "wiredtiger",
3-
"github": "wiredtiger/wiredtiger.git",
3+
"github": "wiredtiger/wiredtiger",
44
"branch": "mongodb-7.0",
5-
"commit": "862374f32e5e9325922e85b6f07b9b5bed8d68fe"
5+
"commit": "f49c810f58d706c592a7aa54ae44c3dd0c3f3bb9"
66
}

src/third_party/wiredtiger/lang/python/wiredtiger.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ OVERRIDE_METHOD(__wt_cursor, WT_CURSOR, search_near, (self))
665665
metadata = PyBytes_FromStringAndSize(*$1, *$2);
666666
$result = metadata;
667667
data = PyBytes_FromStringAndSize(*$3, *$4);
668-
$result = SWIG_Python_AppendOutput($result, data);
668+
$result = SWIG_AppendOutput($result, data);
669669
} else {
670670
SWIG_exception_fail(SWIG_AttributeError, "invalid pointer argument");
671671
}
@@ -677,7 +677,7 @@ OVERRIDE_METHOD(__wt_cursor, WT_CURSOR, search_near, (self))
677677
key_data = PyBytes_FromStringAndSize(*$1, *$2);
678678
$result = key_data;
679679
value_data = PyBytes_FromStringAndSize(*$3, *$4);
680-
$result = SWIG_Python_AppendOutput($result, value_data);
680+
$result = SWIG_AppendOutput($result, value_data);
681681
} else {
682682
SWIG_exception_fail(SWIG_AttributeError, "invalid pointer argument");
683683
}

src/third_party/wiredtiger/src/conn/conn_sweep.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ __sweep_mark(WT_SESSION_IMPL *session, uint64_t now)
4444
dhandle->timeofdeath != 0)
4545
continue;
4646

47+
/*
48+
* Never close out the history store handle via sweep. It can cause a deadlock if eviction
49+
* needs to re-open a handle to the history store while a checkpoint is getting started.
50+
*/
51+
if (WT_IS_HS(dhandle))
52+
continue;
53+
4754
dhandle->timeofdeath = now;
4855
WT_STAT_CONN_INCR(session, dh_sweep_tod);
4956
}

src/third_party/wiredtiger/src/session/session_compact.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ __wt_session_compact(WT_SESSION *wt_session, const char *uri, const char *config
333333
session = (WT_SESSION_IMPL *)wt_session;
334334
SESSION_API_CALL(session, compact, config, cfg);
335335

336+
if (uri == NULL)
337+
WT_ERR_MSG(session, EINVAL, "Compaction requires a URI");
338+
336339
WT_STAT_CONN_SET(session, session_table_compact_running, 1);
337340

338341
/*

src/third_party/wiredtiger/test/suite/hook_tiered.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def session_compact_replace(orig_session_compact, session_self, uri, config):
191191
# a tiered table, but we don't have the create config around to check.
192192
# We want readonly connections to do the real call, see comment in testcase_is_readonly.
193193
ret = 0
194-
if not uri.startswith("table:") or testcase_is_readonly():
194+
if not uri or not uri.startswith("table:") or testcase_is_readonly():
195195
ret = orig_session_compact(session_self, uri, config)
196196
return ret
197197

src/third_party/wiredtiger/test/suite/test_autoclose.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2727
# OTHER DEALINGS IN THE SOFTWARE.
2828

29-
import wttest
29+
import sys, wttest
3030

3131
# test_autoclose
3232
class test_autoclose(wttest.WiredTigerTestCase):
@@ -36,6 +36,9 @@ class test_autoclose(wttest.WiredTigerTestCase):
3636
handles are also closed.
3737
"""
3838
uri = 'table:test_autoclose'
39+
# Note: SWIG generates a TypeError instead of a RuntimeError for several cases.
40+
# The same error on all platforms would be better.
41+
expected_exception = TypeError if sys.platform.startswith('darwin') else RuntimeError
3942

4043
def create_table(self):
4144
self.session.create(self.uri,
@@ -57,7 +60,7 @@ def test_close_cursor1(self):
5760
inscursor = self.open_cursor()
5861
inscursor['key1'] = 'value1'
5962
inscursor.close()
60-
self.assertRaisesHavingMessage(RuntimeError,
63+
self.assertRaisesHavingMessage(self.expected_exception,
6164
lambda: inscursor.next(),
6265
'/wt_cursor.* is None/')
6366
self.drop_table()
@@ -72,7 +75,7 @@ def test_close_cursor2(self):
7275
inscursor = self.open_cursor()
7376
inscursor['key1'] = 'value1'
7477
self.session.close()
75-
self.assertRaisesHavingMessage(RuntimeError,
78+
self.assertRaisesHavingMessage(self.expected_exception,
7679
lambda: inscursor.next(),
7780
'/wt_cursor.* is None/')
7881
self.close_conn()
@@ -86,7 +89,7 @@ def test_close_cursor3(self):
8689
inscursor = self.open_cursor()
8790
inscursor['key1'] = 'value1'
8891
self.close_conn()
89-
self.assertRaisesHavingMessage(RuntimeError,
92+
self.assertRaisesHavingMessage(self.expected_exception,
9093
lambda: inscursor.next(),
9194
'/wt_cursor.* is None/')
9295

@@ -117,14 +120,12 @@ def test_close_cursor5(self):
117120
inscursor2 = self.session.open_cursor(None, inscursor, None)
118121
inscursor.compare(inscursor2)
119122

120-
# Note: SWIG generates a TypeError in this case.
121-
# A RuntimeError to match the other cases would be better.
122123
inscursor2.close()
123124
self.assertRaises(TypeError,
124125
lambda: inscursor.compare(inscursor2))
125126

126127
inscursor2 = None
127-
self.assertRaisesHavingMessage(RuntimeError,
128+
self.assertRaisesHavingMessage(self.expected_exception,
128129
lambda: inscursor.compare(inscursor2),
129130
'/wt_cursor.* is None/')
130131

@@ -133,7 +134,7 @@ def test_close_session1(self):
133134
Use a session handle after it is explicitly closed.
134135
"""
135136
self.session.close()
136-
self.assertRaisesHavingMessage(RuntimeError,
137+
self.assertRaisesHavingMessage(self.expected_exception,
137138
lambda: self.create_table(),
138139
'/wt_session.* is None/')
139140
self.close_conn()
@@ -143,7 +144,7 @@ def test_close_session2(self):
143144
Use a session handle after the connection is closed.
144145
"""
145146
self.close_conn()
146-
self.assertRaisesHavingMessage(RuntimeError,
147+
self.assertRaisesHavingMessage(self.expected_exception,
147148
lambda: self.create_table(),
148149
'/wt_session.* is None/')
149150

@@ -153,7 +154,7 @@ def test_close_connection1(self):
153154
"""
154155
conn = self.conn
155156
self.close_conn()
156-
self.assertRaisesHavingMessage(RuntimeError,
157+
self.assertRaisesHavingMessage(self.expected_exception,
157158
lambda: conn.open_session(None),
158159
'/wt_connection.* is None/')
159160

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python
2+
#
3+
# Public Domain 2014-present MongoDB, Inc.
4+
# Public Domain 2008-2014 WiredTiger, Inc.
5+
#
6+
# This is free and unencumbered software released into the public domain.
7+
#
8+
# Anyone is free to copy, modify, publish, use, compile, sell, or
9+
# distribute this software, either in source code form or as a compiled
10+
# binary, for any purpose, commercial or non-commercial, and by any
11+
# means.
12+
#
13+
# In jurisdictions that recognize copyright laws, the author or authors
14+
# of this software dedicate any and all copyright interest in the
15+
# software to the public domain. We make this dedication for the benefit
16+
# of the public at large and to the detriment of our heirs and
17+
# successors. We intend this dedication to be an overt act of
18+
# relinquishment in perpetuity of all present and future rights to this
19+
# software under copyright law.
20+
#
21+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24+
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27+
# OTHER DEALINGS IN THE SOFTWARE.
28+
29+
import wiredtiger
30+
import wttest
31+
from wtscenario import make_scenarios
32+
33+
# test_compact15.py
34+
# This test checks that foreground compaction requires a URI.
35+
class test_compact15(wttest.WiredTigerTestCase):
36+
uri = 'table:test_compact15'
37+
38+
uris = [
39+
('valid_uri', dict(valid_uri=True)),
40+
('invalid_uri', dict(valid_uri=False))
41+
]
42+
scenarios = make_scenarios(uris)
43+
44+
def test_compact15(self):
45+
self.session.create(self.uri)
46+
47+
if self.valid_uri:
48+
self.session.compact(self.uri, None)
49+
else:
50+
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda:
51+
self.session.compact(None, None),
52+
'/Compaction requires a URI/')

src/third_party/wiredtiger/test/suite/test_cursor_compare.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@
2626
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2727
# OTHER DEALINGS IN THE SOFTWARE.
2828

29-
import wiredtiger, wttest
29+
import sys, wiredtiger, wttest
3030
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
3131
from wtscenario import make_scenarios
3232

3333
# Test cursor comparisons.
3434
class test_cursor_comparison(wttest.WiredTigerTestCase):
3535
name = 'test_compare'
36+
# Note: SWIG generates a TypeError instead of a RuntimeError for several cases.
37+
# The same error on all platforms would be better.
38+
expected_exception = TypeError if sys.platform.startswith('darwin') else RuntimeError
3639

3740
types = [
3841
('file', dict(type='file:', lsm=False, dataset=SimpleDataSet)),
@@ -114,7 +117,7 @@ def test_cursor_comparison(self):
114117
wiredtiger.WiredTigerError, lambda: cX.compare(c1), msg)
115118
msg = '/wt_cursor.* is None/'
116119
self.assertRaisesHavingMessage(
117-
RuntimeError, lambda: cX.compare(None), msg)
120+
self.expected_exception, lambda: cX.compare(None), msg)
118121
if ix0_0 != None:
119122
self.assertEqual(ix0_0.compare(ix0_1), 0)
120123
ix0_1.reset()
@@ -203,7 +206,7 @@ def test_cursor_equality(self):
203206
wiredtiger.WiredTigerError, lambda: cX.equals(c1), msg)
204207
msg = '/wt_cursor.* is None/'
205208
self.assertRaisesHavingMessage(
206-
RuntimeError, lambda: cX.equals(None), msg)
209+
self.expected_exception, lambda: cX.equals(None), msg)
207210
if ix0_0 != None:
208211
self.assertTrue(ix0_0.equals(ix0_1))
209212
ix0_1.reset()

0 commit comments

Comments
 (0)