summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2013-06-18 09:49:15 -0400
committerKeith Bostic <keith@wiredtiger.com>2013-06-18 09:49:15 -0400
commit1983d6f3b90284cefae6ee4cd6efe883cbb51944 (patch)
tree4350c34a12bb70285364f87884c5d2f1111d5388
parenta6fd5896691d7c9b5e479435d731dacce79ffd03 (diff)
downloadmongo-1983d6f3b90284cefae6ee4cd6efe883cbb51944.tar.gz
If overwrite is the default, do the cheap test first, testing to see if
the cursor referenced item is valid is a more expensive test. Fix a comment.
-rw-r--r--src/btree/bt_cursor.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c
index 8f1d39defb1..d0b5efe29db 100644
--- a/src/btree/bt_cursor.c
+++ b/src/btree/bt_cursor.c
@@ -283,7 +283,6 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
* maximum possible record number so the search ends on the
* last page. The real record number is assigned by the
* serialized append operation.
- * __wt_col_append_serial_func
*/
if (F_ISSET(cursor, WT_CURSTD_APPEND))
cbt->iface.recno = UINT64_MAX;
@@ -314,9 +313,8 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
* If not overwriting, fail if the key exists, else insert the
* key/value pair.
*/
- if (cbt->compare == 0 &&
- !__cursor_invalid(cbt) &&
- !F_ISSET(cursor, WT_CURSTD_OVERWRITE))
+ if (!F_ISSET(cursor, WT_CURSTD_OVERWRITE) &&
+ cbt->compare == 0 && !__cursor_invalid(cbt))
WT_ERR(WT_DUPLICATE_KEY);
ret = __wt_row_modify(session, cbt, 0);