summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/btree/bt_cursor.c89
-rw-r--r--src/include/api.h4
2 files changed, 49 insertions, 44 deletions
diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c
index 984ae62d419..15a88bdd7bd 100644
--- a/src/btree/bt_cursor.c
+++ b/src/btree/bt_cursor.c
@@ -935,25 +935,30 @@ __cursor_truncate(WT_SESSION_IMPL *session,
* and we can proceed without concern.
*/
if (start == NULL) {
- while (ret == 0) {
+ do {
WT_RET(__wt_btcur_remove(stop));
- WT_RESTART_RETRY(__wt_btcur_prev(stop, 1), ret);
- if (ret != 0)
- break;
- stop->compare = 0; /* Exact match */
- WT_RESTART_RETRY(rmfunc(session, stop, 1), ret);
- }
+ for (;;) {
+ if ((ret = __wt_btcur_prev(stop, 1)) != 0)
+ break;
+ stop->compare = 0; /* Exact match */
+ if ((ret = rmfunc(session, stop, 1)) != 0)
+ break;
+ }
+ } while (ret == WT_RESTART);
} else {
- WT_RET(__wt_btcur_remove(start));
- while (ret == 0) {
- if (stop != NULL && __cursor_equals(start, stop))
- break;
- WT_RESTART_RETRY(__wt_btcur_next(start, 1), ret);
- if (ret != 0)
- break;
- start->compare = 0; /* Exact match */
- WT_RESTART_RETRY(rmfunc(session, start, 1), ret);
- }
+ do {
+ WT_RET(__wt_btcur_remove(start));
+ 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);
}
WT_RET_NOTFOUND_OK(ret);
@@ -989,30 +994,34 @@ __cursor_truncate_fix(WT_SESSION_IMPL *session,
* refresh the page's modification information.
*/
if (start == NULL) {
- WT_RET(__wt_btcur_remove(stop));
- while (ret == 0) {
- WT_RESTART_RETRY(__wt_btcur_prev(stop, 1), ret);
- if (ret != 0)
- break;
- stop->compare = 0; /* Exact match */
- value = (uint8_t *)stop->iface.value.data;
- if (*value != 0)
- WT_RESTART_RETRY(rmfunc(session, stop, 1), ret);
- }
+ do {
+ WT_RET(__wt_btcur_remove(stop));
+ for (;;) {
+ if ((ret = __wt_btcur_prev(stop, 1)) != 0)
+ break;
+ stop->compare = 0; /* Exact match */
+ value = (uint8_t *)stop->iface.value.data;
+ if (*value != 0 &&
+ (ret = rmfunc(session, stop, 1)) != 0)
+ break;
+ }
+ } while (ret == WT_RESTART);
} else {
- WT_RET(__wt_btcur_remove(start));
- while (ret == 0) {
- if (stop != NULL && __cursor_equals(start, stop))
- break;
- WT_RESTART_RETRY(__wt_btcur_next(start, 1), ret);
- if (ret != 0)
- break;
- start->compare = 0; /* Exact match */
- value = (uint8_t *)start->iface.value.data;
- if (*value != 0)
- WT_RESTART_RETRY(
- rmfunc(session, start, 1), ret);
- }
+ do {
+ WT_RET(__wt_btcur_remove(start));
+ 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);
}
WT_RET_NOTFOUND_OK(ret);
diff --git a/src/include/api.h b/src/include/api.h
index 81bc4f800af..e610b3b3e1b 100644
--- a/src/include/api.h
+++ b/src/include/api.h
@@ -127,7 +127,3 @@
#define ASYNCOP_API_CALL(conn, s, n) \
s = (conn)->default_session; \
API_CALL_NOCONF(s, asyncop, n, NULL, NULL)
-
-#define WT_RESTART_RETRY(call, ret) do { \
- ret = (call); \
-} while (ret == WT_RESTART)