diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-27 14:31:35 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-27 14:31:35 +1100 |
commit | 69955652146b90854c95f7b7d0a266c948b59fc0 (patch) | |
tree | 855f363757252e7aa254cf84b0b649863700f9b8 /src | |
parent | ad2500b3d87a4761bc27dacfd9321a7feea280ca (diff) | |
parent | 39dfd21030ac08e425213f9bc382877dff9458da (diff) | |
download | mongo-69955652146b90854c95f7b7d0a266c948b59fc0.tar.gz |
Merge branch 'develop' into SERVER-21553
Diffstat (limited to 'src')
-rw-r--r-- | src/cursor/cur_file.c | 3 | ||||
-rw-r--r-- | src/include/cursor.h | 9 | ||||
-rw-r--r-- | src/include/cursor.i | 20 |
3 files changed, 23 insertions, 9 deletions
diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index 7c18b59fded..330feb29289 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -439,6 +439,9 @@ __wt_curfile_create(WT_SESSION_IMPL *session, cursor->value_format = btree->value_format; cbt->btree = btree; + if (session->dhandle->checkpoint != NULL) + F_SET(cbt, WT_CBT_NO_TXN); + if (bulk) { F_SET(cursor, WT_CURSTD_BULK); diff --git a/src/include/cursor.h b/src/include/cursor.h index 0a3842efd45..54787d2227b 100644 --- a/src/include/cursor.h +++ b/src/include/cursor.h @@ -197,7 +197,14 @@ struct __wt_cursor_btree { #define WT_CBT_ITERATE_NEXT 0x04 /* Next iteration configuration */ #define WT_CBT_ITERATE_PREV 0x08 /* Prev iteration configuration */ #define WT_CBT_MAX_RECORD 0x10 /* Col-store: past end-of-table */ -#define WT_CBT_SEARCH_SMALLEST 0x20 /* Row-store: small-key insert list */ +#define WT_CBT_NO_TXN 0x20 /* Non-transactional cursor + (e.g. on a checkpoint) */ +#define WT_CBT_SEARCH_SMALLEST 0x40 /* Row-store: small-key insert list */ + +#define WT_CBT_POSITION_MASK /* Flags associated with position */ \ + (WT_CBT_ITERATE_APPEND | WT_CBT_ITERATE_NEXT | WT_CBT_ITERATE_PREV | \ + WT_CBT_MAX_RECORD | WT_CBT_SEARCH_SMALLEST) + uint8_t flags; }; diff --git a/src/include/cursor.i b/src/include/cursor.i index 9dd280534b4..18581e6b805 100644 --- a/src/include/cursor.i +++ b/src/include/cursor.i @@ -41,11 +41,7 @@ __cursor_pos_clear(WT_CURSOR_BTREE *cbt) cbt->cip_saved = NULL; cbt->rip_saved = NULL; - /* - * Don't clear the active flag, it's owned by the cursor enter/leave - * functions. - */ - F_CLR(cbt, ~WT_CBT_ACTIVE); + F_CLR(cbt, WT_CBT_POSITION_MASK); } /* @@ -93,7 +89,8 @@ __curfile_enter(WT_CURSOR_BTREE *cbt) session = (WT_SESSION_IMPL *)cbt->iface.session; - WT_RET(__cursor_enter(session)); + if (!F_ISSET(cbt, WT_CBT_NO_TXN)) + WT_RET(__cursor_enter(session)); F_SET(cbt, WT_CBT_ACTIVE); return (0); } @@ -112,7 +109,8 @@ __curfile_leave(WT_CURSOR_BTREE *cbt) /* If the cursor was active, deactivate it. */ if (F_ISSET(cbt, WT_CBT_ACTIVE)) { - __cursor_leave(session); + if (!F_ISSET(cbt, WT_CBT_NO_TXN)) + __cursor_leave(session); F_CLR(cbt, WT_CBT_ACTIVE); } @@ -262,7 +260,13 @@ __cursor_func_init(WT_CURSOR_BTREE *cbt, bool reenter) if (!F_ISSET(cbt, WT_CBT_ACTIVE)) WT_RET(__curfile_enter(cbt)); - __wt_txn_cursor_op(session); + + /* + * If this is an ordinary transactional cursor, make sure we are set up + * to read. + */ + if (!F_ISSET(cbt, WT_CBT_NO_TXN)) + __wt_txn_cursor_op(session); return (0); } |