diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-06-18 17:21:15 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-06-18 17:21:15 +1000 |
commit | ab8eba816d1bf0f878dee3e51f73af3695c85fec (patch) | |
tree | 3f1fdb9268695000e5438d120a1421c462745ea7 | |
parent | bac863900f3d97cfa4311e6c5b9930c1b785e941 (diff) | |
download | mongo-ab8eba816d1bf0f878dee3e51f73af3695c85fec.tar.gz |
Generalize the cursor "overwrite" configuration to apply to insert, update and remove. Default to true, so LSM is no longer a special case.
refs #512
-rw-r--r-- | dist/api_data.py | 11 | ||||
-rw-r--r-- | src/btree/bt_cursor.c | 44 | ||||
-rw-r--r-- | src/config/config.c | 27 | ||||
-rw-r--r-- | src/config/config_def.c | 2 | ||||
-rw-r--r-- | src/cursor/cur_file.c | 4 | ||||
-rw-r--r-- | src/cursor/cur_stat.c | 4 | ||||
-rw-r--r-- | src/cursor/cur_std.c | 21 | ||||
-rw-r--r-- | src/cursor/cur_table.c | 2 | ||||
-rw-r--r-- | src/include/extern.h | 3 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 11 | ||||
-rw-r--r-- | src/lsm/lsm_cursor.c | 8 | ||||
-rw-r--r-- | src/schema/schema_drop.c | 2 | ||||
-rw-r--r-- | src/session/session_api.c | 2 | ||||
-rw-r--r-- | src/session/session_dhandle.c | 2 | ||||
-rw-r--r-- | src/txn/txn.c | 2 | ||||
-rw-r--r-- | test/format/ops.c | 20 | ||||
-rw-r--r-- | test/suite/test_index01.py | 8 | ||||
-rw-r--r-- | test/suite/test_overwrite.py | 8 | ||||
-rw-r--r-- | test/suite/test_truncate02.py | 6 |
19 files changed, 94 insertions, 93 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index 28b1dd73f6e..2daa7be7124 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -416,13 +416,16 @@ methods = { Config('next_random', 'false', r''' configure the cursor to return a pseudo-random record from the object; valid only for row-store cursors. Cursors - configured with next_random only support the WT_CURSOR::next + configured with \c next_random only support the WT_CURSOR::next and WT_CURSOR::close methods. See @ref cursor_random for details''', type='boolean'), - Config('overwrite', 'false', r''' - change the behavior of the cursor's insert method to overwrite - previously existing values''', + Config('overwrite', 'true', r''' + configures whether the cursor's insert, update and remove + methods check the existing state of the record. If \c overwrite + is \c false, WT_CURSOR::insert fails with ::WT_DUPLICATE_KEY + if the record exists, WT_CURSOR::update and WT_CURSOR::remove + fail with ::WT_NOTFOUND if the record does not exist''', type='boolean'), Config('raw', 'false', r''' ignore the encodings for the key and value, manage data as if diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index 7cb35dabe0e..8f1d39defb1 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -294,13 +294,10 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); cbt->iface.recno = 0; /* - * If WT_CURSTD_OVERWRITE set, insert/update the key/value pair. - * - * If WT_CURSTD_OVERWRITE not set, fail if the key exists, else - * insert the key/value pair. Creating a record past the end - * of the tree in a fixed-length column-store implicitly fills - * the gap with empty records. Fail in that case, the record - * exists. + * If not overwriting, fail if the key exists. Creating a + * record past the end of the tree in a fixed-length + * column-store implicitly fills the gap with empty records. + * Fail in that case, the record exists. */ if (!F_ISSET(cursor, WT_CURSTD_OVERWRITE) && ((cbt->compare == 0 && !__cursor_invalid(cbt)) || @@ -312,13 +309,11 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); cbt->iface.recno = cbt->recno; break; case BTREE_ROW: + WT_ERR(__wt_row_search(session, cbt, 1)); /* - * If WT_CURSTD_OVERWRITE not set, fail if the key exists, else - * insert the key/value pair. - * - * If WT_CURSTD_OVERWRITE set, insert/update the key/value pair. + * If not overwriting, fail if the key exists, else insert the + * key/value pair. */ - WT_ERR(__wt_row_search(session, cbt, 1)); if (cbt->compare == 0 && !__cursor_invalid(cbt) && !F_ISSET(cursor, WT_CURSTD_OVERWRITE)) @@ -396,6 +391,12 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); err: if (ret == WT_RESTART) goto retry; + /* + * If the cursor is configured to overwrite and the record is not + * found, that is exactly what we want. + */ + if (F_ISSET(cursor, WT_CURSTD_OVERWRITE) && ret == WT_NOTFOUND) + ret = 0; WT_TRET(__cursor_func_resolve(cbt, ret)); return (ret); } @@ -438,20 +439,25 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); WT_ERR(__wt_col_search(session, cbt, 1)); /* - * Update the record if it exists. Creating a record past the - * end of the tree in a fixed-length column-store implicitly - * fills the gap with empty records. Update the record in that - * case, the record exists. + * If not overwriting, fail if the key doesn't exist. Update + * the record if it exists. Creating a record past the end of + * the tree in a fixed-length column-store implicitly fills the + * gap with empty records. Update the record in that case, the + * record exists. */ - if ((cbt->compare != 0 || __cursor_invalid(cbt)) && + if (!F_ISSET(cursor, WT_CURSTD_OVERWRITE) && + (cbt->compare != 0 || __cursor_invalid(cbt)) && !__cursor_fix_implicit(btree, cbt)) WT_ERR(WT_NOTFOUND); ret = __wt_col_modify(session, cbt, 3); break; case BTREE_ROW: - /* Update the record if it exists. */ WT_ERR(__wt_row_search(session, cbt, 1)); - if (cbt->compare != 0 || __cursor_invalid(cbt)) + /* + * If not overwriting, fail if the key does not exist. + */ + if (!F_ISSET(cursor, WT_CURSTD_OVERWRITE) && + (cbt->compare != 0 || __cursor_invalid(cbt))) WT_ERR(WT_NOTFOUND); ret = __wt_row_modify(session, cbt, 0); break; diff --git a/src/config/config.c b/src/config/config.c index e28817b89e2..6d6ff795f61 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -685,30 +685,29 @@ __wt_config_getones(WT_SESSION_IMPL *session, } /* - * __wt_config_gets_defno -- - * Given a NULL-terminated list of configuration strings, and if the - * application supplied any configuration strings, find the final value for - * a given string key + * __wt_config_gets_def -- + * Performance hack: skip parsing config strings by hard-coding defaults. + * + * It's expensive to repeatedly parse configuration strings, so don't do + * it unless it's necessary in performance paths like cursor creation. + * Assume the second configuration string is the application's + * configuration string, and if it's not set (which is true most of the + * time), then use the supplied default value. This makes it faster to + * open cursors when checking for obscure open configuration strings like + * "next_random". */ int -__wt_config_gets_defno(WT_SESSION_IMPL *session, - const char **cfg, const char *key, WT_CONFIG_ITEM *value) +__wt_config_gets_def(WT_SESSION_IMPL *session, + const char **cfg, const char *key, int def, WT_CONFIG_ITEM *value) { static const WT_CONFIG_ITEM false_value = { "", 0, 0, WT_CONFIG_ITEM_NUM }; /* - * This is a performance hack: it's expensive to repeatedly parse - * configuration strings, so don't do it unless it's necessary in - * performance paths like cursor creation. Assume the second - * configuration string is the application's configuration string, and - * if it's not set (which is true most of the time), then assume the - * default answer is "false", and return that. This makes it much - * faster to open cursors when checking for obscure open configuration - * strings like "next_random". */ *value = false_value; + value->val = def; if (cfg == NULL || cfg[0] == NULL || cfg[1] == NULL) return (0); else if (cfg[2] == NULL) diff --git a/src/config/config_def.c b/src/config/config_def.c index dada9471738..77a47c9ac1e 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -356,7 +356,7 @@ static const WT_CONFIG_ENTRY config_entries[] = { NULL }, { "session.open_cursor", - "append=0,bulk=0,checkpoint=,dump=,next_random=0,overwrite=0,raw=0," + "append=0,bulk=0,checkpoint=,dump=,next_random=0,overwrite=,raw=0," "statistics_clear=0,statistics_fast=0,target=", confchk_session_open_cursor }, diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index 86568f665ec..1123d34f69b 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -322,7 +322,7 @@ __wt_curfile_create(WT_SESSION_IMPL *session, * random_retrieval * Random retrieval cursors only support next, reset and close. */ - WT_ERR(__wt_config_gets_defno(session, cfg, "next_random", &cval)); + WT_ERR(__wt_config_gets_def(session, cfg, "next_random", 0, &cval)); if (cval.val != 0) { __wt_cursor_set_notsup(cursor); cursor->next = __curfile_next_random; @@ -358,7 +358,7 @@ __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri, flags = 0; - WT_RET(__wt_config_gets_defno(session, cfg, "bulk", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "bulk", 0, &cval)); if (cval.type == WT_CONFIG_ITEM_BOOL || (cval.type == WT_CONFIG_ITEM_NUM && (cval.val == 0 || cval.val == 1))) { diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c index 4c344340c6c..77d3826ddd7 100644 --- a/src/cursor/cur_stat.c +++ b/src/cursor/cur_stat.c @@ -415,10 +415,10 @@ __wt_curstat_open(WT_SESSION_IMPL *session, cst = NULL; flags = 0; - WT_RET(__wt_config_gets_defno(session, cfg, "statistics_clear", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "statistics_clear", 0, &cval)); if (cval.val != 0) LF_SET(WT_STATISTICS_CLEAR); - WT_RET(__wt_config_gets_defno(session, cfg, "statistics_fast", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "statistics_fast", 0, &cval)); if (cval.val != 0) LF_SET(WT_STATISTICS_FAST); diff --git a/src/cursor/cur_std.c b/src/cursor/cur_std.c index 85f472f0017..58c5ec74246 100644 --- a/src/cursor/cur_std.c +++ b/src/cursor/cur_std.c @@ -412,14 +412,11 @@ __cursor_runtime_config(WT_CURSOR *cursor, const char *cfg[]) * added for data-source cursors, or, this call needs to return an * error in the case of a data-source cursor. */ - if ((ret = - __wt_config_gets_defno(session, cfg, "overwrite", &cval)) == 0) { - if (cval.val) - F_SET(cursor, WT_CURSTD_OVERWRITE); - else - F_CLR(cursor, WT_CURSTD_OVERWRITE); - } - WT_RET_NOTFOUND_OK(ret); + WT_RET(__wt_config_gets_def(session, cfg, "overwrite", 1, &cval)); + if (cval.val) + F_SET(cursor, WT_CURSTD_OVERWRITE); + else + F_CLR(cursor, WT_CURSTD_OVERWRITE); return (0); } @@ -525,7 +522,7 @@ __wt_cursor_init(WT_CURSOR *cursor, * The append flag is only relevant to column stores. */ if (WT_CURSOR_RECNO(cursor)) { - WT_RET(__wt_config_gets_defno(session, cfg, "append", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "append", 0, &cval)); if (cval.val != 0) F_SET(cursor, WT_CURSTD_APPEND); } @@ -534,7 +531,7 @@ __wt_cursor_init(WT_CURSOR *cursor, * checkpoint * Checkpoint cursors are read-only. */ - WT_RET(__wt_config_gets_defno(session, cfg, "checkpoint", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "checkpoint", 0, &cval)); if (cval.len != 0) { cursor->insert = __wt_cursor_notsup; cursor->update = __wt_cursor_notsup; @@ -542,7 +539,7 @@ __wt_cursor_init(WT_CURSOR *cursor, } /* dump */ - WT_RET(__wt_config_gets_defno(session, cfg, "dump", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "dump", 0, &cval)); if (cval.len != 0) { /* * Dump cursors should not have owners: only the top-level @@ -559,7 +556,7 @@ __wt_cursor_init(WT_CURSOR *cursor, cdump = NULL; /* raw */ - WT_RET(__wt_config_gets_defno(session, cfg, "raw", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "raw", 0, &cval)); if (cval.val != 0) F_SET(cursor, WT_CURSTD_RAW); diff --git a/src/cursor/cur_table.c b/src/cursor/cur_table.c index 3f6a4f668af..4d40cb2e7ca 100644 --- a/src/cursor/cur_table.c +++ b/src/cursor/cur_table.c @@ -781,7 +781,7 @@ __wt_curtable_open(WT_SESSION_IMPL *session, * random_retrieval * Random retrieval cursors only support next, reset and close. */ - WT_ERR(__wt_config_gets_defno(session, cfg, "next_random", &cval)); + WT_ERR(__wt_config_gets_def(session, cfg, "next_random", 0, &cval)); if (cval.val != 0) { __wt_cursor_set_notsup(cursor); cursor->next = __curtable_next_random; diff --git a/src/include/extern.h b/src/include/extern.h index 23041d8fdcd..d08bd934219 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -490,9 +490,10 @@ extern int __wt_config_getones(WT_SESSION_IMPL *session, const char *config, const char *key, WT_CONFIG_ITEM *value); -extern int __wt_config_gets_defno(WT_SESSION_IMPL *session, +extern int __wt_config_gets_def(WT_SESSION_IMPL *session, const char **cfg, const char *key, + int def, WT_CONFIG_ITEM *value); extern int __wt_config_subgetraw(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cfg, diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 128282c9695..a8f24229a2d 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -588,12 +588,15 @@ struct __wt_session { * "hex"\, \c "print"; default empty.} * @config{next_random, configure the cursor to return a pseudo-random * record from the object; valid only for row-store cursors. Cursors - * configured with next_random only support the WT_CURSOR::next and + * configured with \c next_random only support the WT_CURSOR::next and * WT_CURSOR::close methods. See @ref cursor_random for details., a * boolean flag; default \c false.} - * @config{overwrite, change the behavior of the cursor's insert method - * to overwrite previously existing values., a boolean flag; default \c - * false.} + * @config{overwrite, configures whether the cursor's insert\, update + * and remove methods check the existing state of the record. If \c + * overwrite is \c false\, WT_CURSOR::insert fails with + * ::WT_DUPLICATE_KEY if the record exists\, WT_CURSOR::update and + * WT_CURSOR::remove fail with ::WT_NOTFOUND if the record does not + * exist., a boolean flag; default \c true.} * @config{raw, ignore the encodings for the key and value\, manage data * as if the formats were \c "u". See @ref cursor_raw for details., a * boolean flag; default \c false.} diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index 1ab558b21cc..abbdc35fdba 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -1099,14 +1099,6 @@ __wt_clsm_open(WT_SESSION_IMPL *session, STATIC_ASSERT(offsetof(WT_CURSOR_LSM, iface) == 0); WT_ERR(__wt_cursor_init(cursor, cursor->uri, owner, cfg, cursorp)); - /* - * LSM cursors default to overwrite: if no setting was supplied, turn - * it on. - */ - if (cfg == NULL || cfg[1] == NULL || __wt_config_getones( - session, cfg[1], "overwrite", &cval) == WT_NOTFOUND) - F_SET(cursor, WT_CURSTD_OVERWRITE); - if (0) { err: if (lsm_tree != NULL) __wt_lsm_tree_release(session, lsm_tree); diff --git a/src/schema/schema_drop.c b/src/schema/schema_drop.c index 7b18a8e10fa..91a15f477d6 100644 --- a/src/schema/schema_drop.c +++ b/src/schema/schema_drop.c @@ -165,7 +165,7 @@ __wt_schema_drop(WT_SESSION_IMPL *session, const char *uri, const char *cfg[]) WT_DECL_RET; int force; - WT_RET(__wt_config_gets_defno(session, cfg, "force", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "force", 0, &cval)); force = (cval.val != 0); WT_RET(__wt_meta_track_on(session)); diff --git a/src/session/session_api.c b/src/session/session_api.c index 588a2966880..e569eaa9696 100644 --- a/src/session/session_api.c +++ b/src/session/session_api.c @@ -154,7 +154,7 @@ __session_reconfigure(WT_SESSION *wt_session, const char *config) WT_TRET(__session_reset_cursors(session)); - WT_ERR(__wt_config_gets_defno(session, cfg, "isolation", &cval)); + WT_ERR(__wt_config_gets_def(session, cfg, "isolation", 0, &cval)); if (cval.len != 0) { if (!F_ISSET(S2C(session), WT_CONN_TRANSACTIONAL)) WT_ERR_MSG(session, EINVAL, diff --git a/src/session/session_dhandle.c b/src/session/session_dhandle.c index 7ec01598616..4cd2cf2b4b6 100644 --- a/src/session/session_dhandle.c +++ b/src/session/session_dhandle.c @@ -169,7 +169,7 @@ __wt_session_get_btree_ckpt(WT_SESSION_IMPL *session, * that never open a checkpoint call the underlying function directly. */ WT_RET_NOTFOUND_OK( - __wt_config_gets_defno(session, cfg, "checkpoint", &cval)); + __wt_config_gets_def(session, cfg, "checkpoint", 0, &cval)); if (cval.len != 0) { /* * The internal checkpoint name is special, find the last diff --git a/src/txn/txn.c b/src/txn/txn.c index e2519d39f3a..968ac8f22f3 100644 --- a/src/txn/txn.c +++ b/src/txn/txn.c @@ -208,7 +208,7 @@ __wt_txn_begin(WT_SESSION_IMPL *session, const char *cfg[]) WT_ASSERT(session, txn_state->id == WT_TXN_NONE); - WT_RET(__wt_config_gets_defno(session, cfg, "isolation", &cval)); + WT_RET(__wt_config_gets_def(session, cfg, "isolation", 0, &cval)); if (cval.len == 0) txn->isolation = session->isolation; else diff --git a/test/format/ops.c b/test/format/ops.c index 53181569b97..6a13faee367 100644 --- a/test/format/ops.c +++ b/test/format/ops.c @@ -512,7 +512,7 @@ nextprev(WT_CURSOR *cursor, int next, int *notfoundp) } if (ret != 0 && ret != WT_NOTFOUND) die(ret, "%s", which); - *notfoundp = ret == WT_NOTFOUND; + *notfoundp = (ret == WT_NOTFOUND); if (!SINGLETHREADED) return; @@ -790,21 +790,19 @@ row_remove(WT_CURSOR *cursor, WT_ITEM *key, uint64_t keyno, int *notfoundp) g.wt_api, session, "%-10s%" PRIu64, "remove", keyno); cursor->set_key(cursor, key); - ret = cursor->remove(cursor); + /* We use the cursor in overwrite mode, check for existence. */ + if ((ret = cursor->search(cursor)) == 0) + ret = cursor->remove(cursor); if (ret != 0 && ret != WT_NOTFOUND) die(ret, "row_remove: remove %" PRIu64 " by key", keyno); - *notfoundp = ret == WT_NOTFOUND; + *notfoundp = (ret == WT_NOTFOUND); if (!SINGLETHREADED) return; bdb_remove(keyno, ¬found); - /* LSM trees don't check for existence if "overwrite" is set. */ - if (strncmp(cursor->uri, "lsm:", 4) == 0) - *notfoundp = notfound; - else - (void)notfound_chk("row_remove", ret, notfound, keyno); + (void)notfound_chk("row_remove", ret, notfound, keyno); } /* @@ -825,10 +823,12 @@ col_remove(WT_CURSOR *cursor, WT_ITEM *key, uint64_t keyno, int *notfoundp) g.wt_api, session, "%-10s%" PRIu64, "remove", keyno); cursor->set_key(cursor, keyno); - ret = cursor->remove(cursor); + /* We use the cursor in overwrite mode, check for existence. */ + if ((ret = cursor->search(cursor)) == 0) + ret = cursor->remove(cursor); if (ret != 0 && ret != WT_NOTFOUND) die(ret, "col_remove: remove %" PRIu64 " by key", keyno); - *notfoundp = ret == WT_NOTFOUND; + *notfoundp = (ret == WT_NOTFOUND); if (!SINGLETHREADED) return; diff --git a/test/suite/test_index01.py b/test/suite/test_index01.py index c696ce494a3..149b5836750 100644 --- a/test/suite/test_index01.py +++ b/test/suite/test_index01.py @@ -85,7 +85,7 @@ class test_index01(wttest.WiredTigerTestCase): def insert(self, *cols): self.pr('insert') - cursor = self.cursor() + cursor = self.cursor(config='overwrite=false') cursor.set_key(*cols[:2]) cursor.set_value(*cols[2:]) self.assertEqual(cursor.insert(), 0) @@ -101,7 +101,7 @@ class test_index01(wttest.WiredTigerTestCase): def update(self, *cols): self.pr('update') - cursor = self.cursor() + cursor = self.cursor(config='overwrite=false') cursor.set_key(*cols[:2]) cursor.set_value(*cols[2:]) self.assertEqual(cursor.update(), 0) @@ -109,7 +109,7 @@ class test_index01(wttest.WiredTigerTestCase): def update_nonexistent(self, *cols): self.pr('update') - cursor = self.cursor() + cursor = self.cursor(config='overwrite=false') cursor.set_key(*cols[:2]) cursor.set_value(*cols[2:]) self.assertEqual(cursor.update(), wiredtiger.WT_NOTFOUND) @@ -117,7 +117,7 @@ class test_index01(wttest.WiredTigerTestCase): def remove(self, name, ID): self.pr('remove') - cursor = self.cursor() + cursor = self.cursor(config='overwrite=false') cursor.set_key(name, ID) self.assertEqual(cursor.remove(), 0) cursor.close() diff --git a/test/suite/test_overwrite.py b/test/suite/test_overwrite.py index 8524c3e324b..ee8842e4a2e 100644 --- a/test/suite/test_overwrite.py +++ b/test/suite/test_overwrite.py @@ -41,12 +41,12 @@ class test_overwrite(wttest.WiredTigerTestCase): # Test configuration of a cursor for overwrite. def test_overwrite(self): simple_populate(self, self.uri, 'key_format=' + self.fmt, 100) - cursor = self.session.open_cursor(self.uri, None, None) + cursor = self.session.open_cursor(self.uri, None, "overwrite=false") cursor.set_key(key_populate(cursor, 10)) cursor.set_value('XXXXXXXXXX') self.assertRaises(wiredtiger.WiredTigerError, lambda: cursor.insert()) - cursor = self.session.open_cursor(self.uri, None, "overwrite") + cursor = self.session.open_cursor(self.uri, None, "overwrite=true") cursor.set_key(key_populate(cursor, 10)) cursor.set_value('XXXXXXXXXX') cursor.insert() @@ -54,13 +54,13 @@ class test_overwrite(wttest.WiredTigerTestCase): # Test duplicating a cursor with overwrite. def test_overwrite_reconfig(self): simple_populate(self, self.uri, 'key_format=' + self.fmt, 100) - cursor = self.session.open_cursor(self.uri, None) + cursor = self.session.open_cursor(self.uri, None, "overwrite=false") cursor.set_key(key_populate(cursor, 10)) cursor.set_value('XXXXXXXXXX') self.assertRaises(wiredtiger.WiredTigerError, lambda: cursor.insert()) cursor.set_key(key_populate(cursor, 10)) - dupc = self.session.open_cursor(None, cursor, "overwrite") + dupc = self.session.open_cursor(None, cursor, "overwrite=true") dupc.set_value('XXXXXXXXXX') dupc.insert() diff --git a/test/suite/test_truncate02.py b/test/suite/test_truncate02.py index 24cb8ce9316..fb0172a4c54 100644 --- a/test/suite/test_truncate02.py +++ b/test/suite/test_truncate02.py @@ -128,7 +128,7 @@ class test_truncate_fast_delete(wttest.WiredTigerTestCase): # Optionally add a few overflow records so we block fast delete on # those pages. if self.overflow: - cursor = self.session.open_cursor(uri, None) + cursor = self.session.open_cursor(uri, None, 'overwrite=false') for i in range(1, self.nentries, 3123): cursor.set_key(key_populate(cursor, i)) cursor.set_value(value_populate(cursor, i)) @@ -140,7 +140,7 @@ class test_truncate_fast_delete(wttest.WiredTigerTestCase): # Optionally read/write a few rows before truncation. if self.readbefore or self.writebefore: - cursor = self.session.open_cursor(uri, None) + cursor = self.session.open_cursor(uri, None, 'overwrite=false') if self.readbefore: for i in range(1, self.nentries, 737): cursor.set_key(key_populate(cursor, i)) @@ -164,7 +164,7 @@ class test_truncate_fast_delete(wttest.WiredTigerTestCase): # Optionally read/write a few rows after truncation. if self.readafter or self.writeafter: - cursor = self.session.open_cursor(uri, None) + cursor = self.session.open_cursor(uri, None, 'overwrite=false') if self.readafter: for i in range(1, self.nentries, 1123): cursor.set_key(key_populate(cursor, i)) |