summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2021-06-16 05:45:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-16 06:06:19 +0000
commit0cc007969408affcec1e845261f83dcace27b579 (patch)
tree8b1aad94c8ba698562f799583c691195c67d063b
parent94868225b6a648a4d73b7cabcafb50a43e359e71 (diff)
downloadmongo-0cc007969408affcec1e845261f83dcace27b579.tar.gz
Import wiredtiger: 363c7384edce63df337f110492c6424c5f13a451 from branch mongodb-5.0
ref: 916a7defd8..363c7384ed for: 5.1.0 WT-7443 Add error message when bulk cursor can't get exclusive access to dhandle
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_file.c5
-rwxr-xr-xsrc/third_party/wiredtiger/test/suite/test_bulk01.py5
-rwxr-xr-xsrc/third_party/wiredtiger/test/suite/test_bulk03.py66
4 files changed, 75 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 285b1611f83..13670219790 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-5.0",
- "commit": "916a7defd830a64d57bdaad4b1f8522d77fe3e0c"
+ "commit": "363c7384edce63df337f110492c6424c5f13a451"
}
diff --git a/src/third_party/wiredtiger/src/cursor/cur_file.c b/src/third_party/wiredtiger/src/cursor/cur_file.c
index 04e53e5b4f2..878b1449c27 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_file.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_file.c
@@ -833,6 +833,11 @@ __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, c
session, ret = __wt_session_get_btree_ckpt(session, uri, cfg, flags));
else
ret = __wt_session_get_btree_ckpt(session, uri, cfg, flags);
+
+ /* Check whether the exclusive open for a bulk load succeeded. */
+ if (bulk && ret == EBUSY)
+ WT_RET_MSG(session, EBUSY, "bulk-load is only supported on newly created objects");
+
WT_RET(ret);
WT_ERR(__curfile_create(session, owner, cfg, bulk, bitmap, cursorp));
diff --git a/src/third_party/wiredtiger/test/suite/test_bulk01.py b/src/third_party/wiredtiger/test/suite/test_bulk01.py
index a39deac3866..c65ea704a21 100755
--- a/src/third_party/wiredtiger/test/suite/test_bulk01.py
+++ b/src/third_party/wiredtiger/test/suite/test_bulk01.py
@@ -211,8 +211,9 @@ class test_bulk_load(wttest.WiredTigerTestCase):
cursor = self.session.open_cursor(uri, None)
cursor[simple_key(cursor, 1)] = simple_value(cursor, 1)
# Don't close the insert cursor, we want EBUSY.
- self.assertRaises(wiredtiger.WiredTigerError,
- lambda: self.session.open_cursor(uri, None, "bulk"))
+ msg = '/bulk-load is only supported on newly created objects/'
+ self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
+ lambda: self.session.open_cursor(uri, None, "bulk"), msg)
if __name__ == '__main__':
wttest.run()
diff --git a/src/third_party/wiredtiger/test/suite/test_bulk03.py b/src/third_party/wiredtiger/test/suite/test_bulk03.py
new file mode 100755
index 00000000000..730960264ef
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_bulk03.py
@@ -0,0 +1,66 @@
+#!/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.
+#
+# test_bulk03.py
+# This test module is designed to check that colgroup bulk-cursor meets expectations in terms
+# of error codes and error messages.
+#
+
+import os
+import wiredtiger, wttest
+from wtdataset import SimpleDataSet, simple_key, simple_value
+from wtscenario import make_scenarios
+
+# Smoke test bulk-load.
+class test_colgroup_bulk_load(wttest.WiredTigerTestCase):
+ basename = 'test_schema01'
+ tablename = 'table:' + basename
+ cgname = 'colgroup:' + basename
+ err_msg = '/bulk-load is only supported on newly created objects/'
+
+ # Test that bulk-load objects cannot be opened by other cursors.
+ def test_bulk_load_busy_cols(self):
+ # Create a table with columns.
+ self.session.create(self.tablename, 'key_format=5s,value_format=HQ,' +
+ 'columns=(country,year,population),' +
+ 'colgroups=(year,population)')
+
+ # Create a column group.
+ self.session.create(self.cgname + ':year', 'columns=(year)')
+ self.session.create(self.cgname + ':population', 'columns=(population)')
+
+ # Create a column cursor.
+ self.session.open_cursor(self.tablename, None)
+
+ # Create a second column cursor in bulk mode. Don't close the insert cursor, we want EBUSY
+ # and the error message.
+ self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
+ lambda: self.session.open_cursor(self.tablename, None, "bulk"), self.err_msg)
+
+if __name__ == '__main__':
+ wttest.run()