summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/btree/bt_cursor.c12
-rw-r--r--src/btree/bt_read.c11
-rw-r--r--src/btree/bt_split.c2
-rw-r--r--src/cursor/cur_file.c2
-rw-r--r--src/include/extern.h2
5 files changed, 15 insertions, 14 deletions
diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c
index b0340e8d24c..0cabf13f1f1 100644
--- a/src/btree/bt_cursor.c
+++ b/src/btree/bt_cursor.c
@@ -1160,14 +1160,22 @@ __wt_btcur_open(WT_CURSOR_BTREE *cbt)
* Close a btree cursor.
*/
int
-__wt_btcur_close(WT_CURSOR_BTREE *cbt)
+__wt_btcur_close(WT_CURSOR_BTREE *cbt, int lowlevel)
{
WT_DECL_RET;
WT_SESSION_IMPL *session;
session = (WT_SESSION_IMPL *)cbt->iface.session;
- ret = __curfile_leave(cbt);
+ /*
+ * The in-memory split and lookaside file code creates low-level btree
+ * cursors to search/modify leaf pages. Those cursors don't hold hazard
+ * pointers, nor are they counted in the session handle's cursor count.
+ * Skip the usual cursor tear-down in that case.
+ */
+ if (!lowlevel)
+ ret = __curfile_leave(cbt);
+
__wt_buf_free(session, &cbt->_row_key);
__wt_buf_free(session, &cbt->_tmp);
diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c
index f9d1c84c367..4dfb920b3ed 100644
--- a/src/btree/bt_read.c
+++ b/src/btree/bt_read.c
@@ -325,15 +325,8 @@ __las_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref,
}
err: WT_TRET(__wt_las_cursor_close(session, &cursor, saved_flags));
-
- /*
- * KEITH: don't release the page, we don't have a hazard pointer on it;
- * why is this is necessary, why doesn't __split_multi_inmem have the
- * same problem?
- */
- cbt.ref = NULL;
-
- WT_WITH_DHANDLE(session, read_dhandle, tret = __wt_btcur_close(&cbt));
+ WT_WITH_DHANDLE(
+ session, read_dhandle, tret = __wt_btcur_close(&cbt, 1));
WT_TRET(tret);
/*
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c
index 65ef2c81090..23896884b70 100644
--- a/src/btree/bt_split.c
+++ b/src/btree/bt_split.c
@@ -759,7 +759,7 @@ __split_multi_inmem(
page->modify->first_dirty_txn = WT_TXN_FIRST;
err: /* Free any resources that may have been cached in the cursor. */
- WT_TRET(__wt_btcur_close(&cbt));
+ WT_TRET(__wt_btcur_close(&cbt, 1));
__wt_scr_free(session, &key);
return (ret);
diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c
index a9f3124149e..8ebf53e595b 100644
--- a/src/cursor/cur_file.c
+++ b/src/cursor/cur_file.c
@@ -369,7 +369,7 @@ __curfile_close(WT_CURSOR *cursor)
__wt_buf_free(session, &cbulk->last);
}
- WT_TRET(__wt_btcur_close(cbt));
+ WT_TRET(__wt_btcur_close(cbt, 0));
if (cbt->btree != NULL) {
/* Increment the data-source's in-use counter. */
__wt_cursor_dhandle_decr_use(session);
diff --git a/src/include/extern.h b/src/include/extern.h
index 91f017233f9..28e85ade4cb 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -103,7 +103,7 @@ extern int __wt_btcur_equals( WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, in
extern int __wt_btcur_range_truncate(WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop);
extern void __wt_btcur_init(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt);
extern void __wt_btcur_open(WT_CURSOR_BTREE *cbt);
-extern int __wt_btcur_close(WT_CURSOR_BTREE *cbt);
+extern int __wt_btcur_close(WT_CURSOR_BTREE *cbt, int lowlevel);
extern int __wt_debug_set_verbose(WT_SESSION_IMPL *session, const char *v);
extern int __wt_debug_addr_print( WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size);
extern int __wt_debug_addr(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size, const char *ofile);