Skip to content

Commit

Permalink
WT-2046 - Add a counter for search restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
daveh86 committed Aug 19, 2015
1 parent ada57c1 commit a4e8df1
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 112 deletions.
2 changes: 2 additions & 0 deletions dist/stat_data.py
Expand Up @@ -333,6 +333,7 @@ def __init__(self, name, desc, flags=''):
CursorStat('cursor_prev', 'cursor prev calls'),
CursorStat('cursor_remove', 'cursor remove calls'),
CursorStat('cursor_reset', 'cursor reset calls'),
CursorStat('cursor_restart', 'number operations restarted'),
CursorStat('cursor_search', 'cursor search calls'),
CursorStat('cursor_search_near', 'cursor search near calls'),
CursorStat('cursor_update', 'cursor update calls'),
Expand Down Expand Up @@ -373,6 +374,7 @@ def __init__(self, name, desc, flags=''):
CursorStat('cursor_remove', 'remove calls'),
CursorStat('cursor_remove_bytes', 'cursor-remove key bytes removed'),
CursorStat('cursor_reset', 'reset calls'),
CursorStat('cursor_restart', 'number operations restarted'),
CursorStat('cursor_search', 'search calls'),
CursorStat('cursor_search_near', 'search near calls'),
CursorStat('cursor_update', 'update calls'),
Expand Down
28 changes: 24 additions & 4 deletions src/btree/bt_cursor.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1008,6 +1020,10 @@ __cursor_truncate(WT_SESSION_IMPL *session,
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);
}
} while (ret == WT_RESTART);

WT_RET_NOTFOUND_OK(ret);
Expand Down Expand Up @@ -1059,6 +1075,10 @@ __cursor_truncate_fix(WT_SESSION_IMPL *session,
(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);
}
} while (ret == WT_RESTART);

WT_RET_NOTFOUND_OK(ret);
Expand Down
2 changes: 2 additions & 0 deletions src/include/stat.h
Expand Up @@ -289,6 +289,7 @@ struct __wt_connection_stats {
int64_t cursor_prev;
int64_t cursor_remove;
int64_t cursor_reset;
int64_t cursor_restart;
int64_t cursor_search;
int64_t cursor_search_near;
int64_t cursor_update;
Expand Down Expand Up @@ -444,6 +445,7 @@ struct __wt_dsrc_stats {
int64_t cursor_remove;
int64_t cursor_remove_bytes;
int64_t cursor_reset;
int64_t cursor_restart;
int64_t cursor_search;
int64_t cursor_search_near;
int64_t cursor_update;
Expand Down

0 comments on commit a4e8df1

Please sign in to comment.