diff options
author | Etienne Petrel <etienne.petrel@mongodb.com> | 2022-02-01 01:04:40 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-01 01:31:36 +0000 |
commit | 8791dfa5f44b5b1a0e1195436a03ac3ed2051b75 (patch) | |
tree | f5bda2e1b1c9010da4df9f0981b48dbb26c32319 | |
parent | 58ec1c6e482abb94cbe5b32183057bc59966c844 (diff) | |
download | mongo-8791dfa5f44b5b1a0e1195436a03ac3ed2051b75.tar.gz |
Import wiredtiger: 7ae2a8010828136e05b26861512ea73b6eb5e235 from branch mongodb-master
ref: fbbdde7db4..7ae2a80108
for: 5.3.0
WT-8248 Check for valid configuration key when using the WT_CURSOR.reconfigure API
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_std.c | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/api.h | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_cursor06.py | 9 |
4 files changed, 18 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index d7c5f64ef65..e47dba3e900 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": "fbbdde7db467f5e5ba820d80e17c25405a927589" + "commit": "7ae2a8010828136e05b26861512ea73b6eb5e235" } diff --git a/src/third_party/wiredtiger/src/cursor/cur_std.c b/src/third_party/wiredtiger/src/cursor/cur_std.c index 8858bca2b9a..0c7bbfb6f02 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_std.c +++ b/src/third_party/wiredtiger/src/cursor/cur_std.c @@ -1051,9 +1051,8 @@ __wt_cursor_reconfigure(WT_CURSOR *cursor, const char *config) WT_CONFIG_ITEM cval; WT_DECL_RET; WT_SESSION_IMPL *session; - const char *cfg[] = {config, NULL}; - CURSOR_API_CALL(cursor, session, reconfigure, NULL); + CURSOR_API_CALL_CONF(cursor, session, reconfigure, config, cfg, NULL); /* Reconfiguration resets the cursor. */ WT_ERR(cursor->reset(cursor)); diff --git a/src/third_party/wiredtiger/src/include/api.h b/src/third_party/wiredtiger/src/include/api.h index 7f18ccabcb1..892972e28e4 100644 --- a/src/third_party/wiredtiger/src/include/api.h +++ b/src/third_party/wiredtiger/src/include/api.h @@ -220,6 +220,13 @@ if (F_ISSET(cur, WT_CURSTD_CACHED)) \ WT_ERR(__wt_cursor_cached(cur)) +#define CURSOR_API_CALL_CONF(cur, s, n, config, cfg, bt) \ + (s) = CUR2S(cur); \ + SESSION_API_PREPARE_CHECK(s, WT_CURSOR, n); \ + API_CALL(s, WT_CURSOR, n, ((bt) == NULL) ? NULL : ((WT_BTREE *)(bt))->dhandle, config, cfg); \ + if (F_ISSET(cur, WT_CURSTD_CACHED)) \ + WT_ERR(__wt_cursor_cached(cur)) + #define CURSOR_API_CALL_PREPARE_ALLOWED(cur, s, n, bt) \ (s) = CUR2S(cur); \ API_CALL_NOCONF(s, WT_CURSOR, n, ((bt) == NULL) ? NULL : ((WT_BTREE *)(bt))->dhandle); \ diff --git a/src/third_party/wiredtiger/test/suite/test_cursor06.py b/src/third_party/wiredtiger/test/suite/test_cursor06.py index 1efa311ecd4..0c21aca771e 100644 --- a/src/third_party/wiredtiger/test/suite/test_cursor06.py +++ b/src/third_party/wiredtiger/test/suite/test_cursor06.py @@ -97,5 +97,14 @@ class test_cursor06(wttest.WiredTigerTestCase): cursor.update() cursor.close() + def test_reconfigure_invalid(self): + uri = self.type + self.name + self.populate(uri) + c = self.session.open_cursor(uri, None, None) + c.reconfigure("overwrite=1") + msg = '/Invalid argument/' + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: c.reconfigure("xxx=true"), msg) + if __name__ == '__main__': wttest.run() |