summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/btree/bt_cursor.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-08-28 16:02:38 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-08-28 16:02:38 +1000
commita7338c436160e259d0b20058f0a9ae4b442ca102 (patch)
treebfc887ab328328c72face3d1afc99530a89584ff /src/third_party/wiredtiger/src/btree/bt_cursor.c
parentf51b43f0fbabe121c18387d8bfbb187a2c6efdee (diff)
downloadmongo-a7338c436160e259d0b20058f0a9ae4b442ca102.tar.gz
Import wiredtiger-wiredtiger-2.6.1-633-g0cccab3.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/bt_cursor.c')
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_cursor.c97
1 files changed, 59 insertions, 38 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c
index 0aed5940533..9f41e3ae684 100644
--- a/src/third_party/wiredtiger/src/btree/bt_cursor.c
+++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c
@@ -549,8 +549,11 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
WT_ILLEGAL_VALUE_ERR(session);
}
-err: if (ret == WT_RESTART)
+err: if (ret == WT_RESTART) {
+ WT_STAT_FAST_CONN_INCR(session, cursor_restart);
+ WT_STAT_FAST_DATA_INCR(session, cursor_restart);
goto retry;
+ }
/* Insert doesn't maintain a position across calls, clear resources. */
if (ret == 0)
WT_TRET(__curfile_leave(cbt));
@@ -624,8 +627,11 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
WT_ILLEGAL_VALUE_ERR(session);
}
-err: if (ret == WT_RESTART)
+err: if (ret == WT_RESTART) {
+ WT_STAT_FAST_CONN_INCR(session, cursor_restart);
+ WT_STAT_FAST_DATA_INCR(session, cursor_restart);
goto retry;
+ }
WT_TRET(__curfile_leave(cbt));
if (ret != 0)
WT_TRET(__cursor_reset(cbt));
@@ -702,8 +708,11 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
WT_ILLEGAL_VALUE_ERR(session);
}
-err: if (ret == WT_RESTART)
+err: if (ret == WT_RESTART) {
+ WT_STAT_FAST_CONN_INCR(session, cursor_restart);
+ WT_STAT_FAST_DATA_INCR(session, cursor_restart);
goto retry;
+ }
/*
* If the cursor is configured to overwrite and the record is not
* found, that is exactly what we want.
@@ -790,8 +799,11 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
WT_ILLEGAL_VALUE_ERR(session);
}
-err: if (ret == WT_RESTART)
+err: if (ret == WT_RESTART) {
+ WT_STAT_FAST_CONN_INCR(session, cursor_restart);
+ WT_STAT_FAST_DATA_INCR(session, cursor_restart);
goto retry;
+ }
/*
* If successful, point the cursor at internal copies of the data. We
@@ -993,22 +1005,27 @@ __cursor_truncate(WT_SESSION_IMPL *session,
* instantiated the end cursor, so we know that page is pinned in memory
* and we can proceed without concern.
*/
- do {
- WT_RET(__wt_btcur_remove(start));
- /*
- * Reset ret each time through so that we don't loop forever in
- * the cursor equals case.
- */
- for (ret = 0;;) {
- if (stop != NULL && __cursor_equals(start, stop))
- break;
- if ((ret = __wt_btcur_next(start, 1)) != 0)
- break;
- start->compare = 0; /* Exact match */
- if ((ret = rmfunc(session, start, 1)) != 0)
- break;
- }
- } while (ret == WT_RESTART);
+retry: WT_RET(__wt_btcur_remove(start));
+
+ /*
+ * Reset ret each time through so that we don't loop forever in
+ * the cursor equals case.
+ */
+ for (ret = 0;;) {
+ if (stop != NULL && __cursor_equals(start, stop))
+ break;
+ if ((ret = __wt_btcur_next(start, 1)) != 0)
+ break;
+ start->compare = 0; /* Exact match */
+ if ((ret = rmfunc(session, start, 1)) != 0)
+ break;
+ }
+
+ if (ret == WT_RESTART) {
+ WT_STAT_FAST_CONN_INCR(session, cursor_restart);
+ WT_STAT_FAST_DATA_INCR(session, cursor_restart);
+ goto retry;
+ }
WT_RET_NOTFOUND_OK(ret);
return (0);
@@ -1042,24 +1059,28 @@ __cursor_truncate_fix(WT_SESSION_IMPL *session,
* other thread of control; in that case, repeat the full search to
* refresh the page's modification information.
*/
- do {
- WT_RET(__wt_btcur_remove(start));
- /*
- * Reset ret each time through so that we don't loop forever in
- * the cursor equals case.
- */
- for (ret = 0;;) {
- if (stop != NULL && __cursor_equals(start, stop))
- break;
- if ((ret = __wt_btcur_next(start, 1)) != 0)
- break;
- start->compare = 0; /* Exact match */
- value = (uint8_t *)start->iface.value.data;
- if (*value != 0 &&
- (ret = rmfunc(session, start, 1)) != 0)
- break;
- }
- } while (ret == WT_RESTART);
+retry: WT_RET(__wt_btcur_remove(start));
+ /*
+ * Reset ret each time through so that we don't loop forever in
+ * the cursor equals case.
+ */
+ for (ret = 0;;) {
+ if (stop != NULL && __cursor_equals(start, stop))
+ break;
+ if ((ret = __wt_btcur_next(start, 1)) != 0)
+ break;
+ start->compare = 0; /* Exact match */
+ value = (uint8_t *)start->iface.value.data;
+ if (*value != 0 &&
+ (ret = rmfunc(session, start, 1)) != 0)
+ break;
+ }
+
+ if (ret == WT_RESTART) {
+ WT_STAT_FAST_CONN_INCR(session, cursor_restart);
+ WT_STAT_FAST_DATA_INCR(session, cursor_restart);
+ goto retry;
+ }
WT_RET_NOTFOUND_OK(ret);
return (0);