diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-03-10 15:05:13 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-03-10 15:05:13 -0400 |
commit | b697d2a50dfd271100fe1d2bc1f54845f02c15c1 (patch) | |
tree | fabf41b2063db2766d2ff078047779b16d413323 /src/cursor/cur_stat.c | |
parent | ac1c9aab785e743757fc92cec52ad0a94a48106d (diff) | |
download | mongo-b697d2a50dfd271100fe1d2bc1f54845f02c15c1.tar.gz |
Don't test for invalid keys in search until we've initialized the
cursor, intializing the cursor is what sets the information that allows
us to detect invalid keys. (This isn't necessary at the moment because
we can never see an uninitialized cursor in WT_CURSOR.search, but it's
safer to do it this way in case of a future change reverses that.)
Diffstat (limited to 'src/cursor/cur_stat.c')
-rw-r--r-- | src/cursor/cur_stat.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c index 47a57055a45..436febf4baa 100644 --- a/src/cursor/cur_stat.c +++ b/src/cursor/cur_stat.c @@ -285,9 +285,6 @@ __curstat_search(WT_CURSOR *cursor) WT_CURSOR_NEEDKEY(cursor); F_CLR(cursor, WT_CURSTD_VALUE_SET | WT_CURSTD_VALUE_SET); - if (cst->key < WT_STAT_KEY_MIN(cst) || cst->key > WT_STAT_KEY_MAX(cst)) - WT_ERR(WT_NOTFOUND); - /* Initialize on demand. */ if (cst->notinitialized) { WT_ERR(__wt_curstat_init( @@ -295,6 +292,9 @@ __curstat_search(WT_CURSOR *cursor) cst->notinitialized = 0; } + if (cst->key < WT_STAT_KEY_MIN(cst) || cst->key > WT_STAT_KEY_MAX(cst)) + WT_ERR(WT_NOTFOUND); + cst->v = cst->stats_first[WT_STAT_KEY_OFFSET(cst)].v; WT_ERR(__curstat_print_value(session, cst->v, &cst->pv)); F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); |