From 61c4f0a86e25118025bb81c41a00b9df04eb7ef2 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Thu, 17 Jul 2014 17:00:47 -0400 Subject: 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. --- src/btree/bt_curnext.c | 2 +- src/btree/bt_curprev.c | 2 +- src/btree/bt_cursor.c | 20 ++++++++------------ src/btree/col_srch.c | 2 +- src/btree/row_srch.c | 4 ++-- 5 files changed, 13 insertions(+), 17 deletions(-) (limited to 'src/btree') diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c index dc729e748b6..caf3f9f369a 100644 --- a/src/btree/bt_curnext.c +++ b/src/btree/bt_curnext.c @@ -464,6 +464,6 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating) } err: if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } diff --git a/src/btree/bt_curprev.c b/src/btree/bt_curprev.c index 8ad57002a29..4767762b564 100644 --- a/src/btree/bt_curprev.c +++ b/src/btree/bt_curprev.c @@ -555,6 +555,6 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating) } err: if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index d2aac361ab3..64ff0bd9c69 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -268,7 +268,6 @@ __cursor_row_modify( int __wt_btcur_reset(WT_CURSOR_BTREE *cbt) { - WT_DECL_RET; WT_SESSION_IMPL *session; session = (WT_SESSION_IMPL *)cbt->iface.session; @@ -276,10 +275,7 @@ __wt_btcur_reset(WT_CURSOR_BTREE *cbt) WT_STAT_FAST_CONN_INCR(session, cursor_reset); WT_STAT_FAST_DATA_INCR(session, cursor_reset); - ret = __curfile_leave(cbt); - __cursor_search_clear(cbt); - - return (ret); + return (__cursor_reset(cbt)); } /* @@ -325,7 +321,7 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt) ret = WT_NOTFOUND; err: if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } @@ -405,7 +401,7 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) } err: if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); if (exactp != NULL && (ret == 0 || ret == WT_NOTFOUND)) *exactp = exact; return (ret); @@ -501,7 +497,7 @@ err: if (ret == WT_RESTART) if (ret == 0) WT_TRET(__curfile_leave(cbt)); if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } @@ -547,7 +543,7 @@ err: if (ret == WT_RESTART) goto retry; WT_TRET(__curfile_leave(cbt)); if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } @@ -620,7 +616,7 @@ err: if (ret == WT_RESTART) ret = 0; if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } @@ -707,7 +703,7 @@ err: if (ret == WT_RESTART) WT_TRET(__wt_kv_return(session, cbt, cbt->modify_update)); if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } @@ -745,7 +741,7 @@ __wt_btcur_next_random(WT_CURSOR_BTREE *cbt) WT_ERR(__wt_btcur_search_near(cbt, 0)); err: if (ret != 0) - WT_TRET(__cursor_error_resolve(cbt)); + WT_TRET(__cursor_reset(cbt)); return (ret); } diff --git a/src/btree/col_srch.c b/src/btree/col_srch.c index d824339d1a0..e44dd3fce67 100644 --- a/src/btree/col_srch.c +++ b/src/btree/col_srch.c @@ -28,7 +28,7 @@ __wt_col_search(WT_SESSION_IMPL *session, btree = S2BT(session); - __cursor_search_clear(cbt); + __cursor_pos_clear(cbt); /* * In the service of eviction splits, we're only searching a single leaf diff --git a/src/btree/row_srch.c b/src/btree/row_srch.c index 9c391be2149..ad83ed005c6 100644 --- a/src/btree/row_srch.c +++ b/src/btree/row_srch.c @@ -147,7 +147,7 @@ __wt_row_search(WT_SESSION_IMPL *session, rip = NULL; match = 0; /* -Wuninitialized */ - __cursor_search_clear(cbt); + __cursor_pos_clear(cbt); /* * The row-store search routine uses a different comparison API. @@ -425,7 +425,7 @@ __wt_row_random(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt) btree = S2BT(session); - __cursor_search_clear(cbt); + __cursor_pos_clear(cbt); restart: /* Walk the internal pages of the tree. */ -- cgit v1.2.1