diff options
author | Keith Bostic <keith@wiredtiger.com> | 2014-07-17 17:00:47 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2014-07-17 17:00:47 -0400 |
commit | 61c4f0a86e25118025bb81c41a00b9df04eb7ef2 (patch) | |
tree | 860cc97c85cb1d26114a894570f38c34d04fe46a /src/include/cursor.i | |
parent | d16d7229ea2d13733d2d637e0e80f7f25d011a6e (diff) | |
download | mongo-61c4f0a86e25118025bb81c41a00b9df04eb7ef2.tar.gz |
Rename __cursor_search_clear __cursor_pos_clear; it's the code that
clears a cursor's location, and is no longer unique to the search
functions.
Change __cursor_error_resolve cursor error resolution to clear the
cursor's location even if we see a failure from the cursor "leave"
function (probably a bad return from releasing a page), keeping the
cursor's location isn't likely to make anything better.
sename __cursor_error_resolve to __cursor_reset, it's a combination of
"leave the API" and "clear the cursor's location"; now that it clears
the cursor location regardless of the return from the cursor "leave"
function, we can call it from the WT_CURSOR.reset code, they're the
same.
Diffstat (limited to 'src/include/cursor.i')
-rw-r--r-- | src/include/cursor.i | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/include/cursor.i b/src/include/cursor.i index f2713ad87d1..3f551efa17c 100644 --- a/src/include/cursor.i +++ b/src/include/cursor.i @@ -17,11 +17,11 @@ __cursor_set_recno(WT_CURSOR_BTREE *cbt, uint64_t v) } /* - * __cursor_search_clear -- - * Reset the cursor's state for a search. + * __cursor_pos_clear -- + * Reset the cursor's location. */ static inline void -__cursor_search_clear(WT_CURSOR_BTREE *cbt) +__cursor_pos_clear(WT_CURSOR_BTREE *cbt) { /* Our caller should have released any page held by this cursor. */ cbt->ref = NULL; @@ -148,22 +148,21 @@ __cursor_func_init(WT_CURSOR_BTREE *cbt, int reenter) } /* - * __cursor_error_resolve -- - * Resolve the cursor's state for return on error. + * __cursor_reset -- + * Reset the cursor. */ static inline int -__cursor_error_resolve(WT_CURSOR_BTREE *cbt) +__cursor_reset(WT_CURSOR_BTREE *cbt) { + WT_DECL_RET; + /* - * On error, we can't iterate, so clear the cursor's position and - * release any page references we're holding. + * The cursor is leaving the API, and no longer holds any position, + * generally called to clean up the cursor after an error. */ - WT_RET(__curfile_leave(cbt)); - - /* Clear the cursor's search state. */ - __cursor_search_clear(cbt); - - return (0); + ret = __curfile_leave(cbt); + __cursor_pos_clear(cbt); + return (ret); } /* |