diff options
author | daveh86 <howsdav@gmail.com> | 2015-07-30 11:43:11 +1000 |
---|---|---|
committer | daveh86 <howsdav@gmail.com> | 2015-07-30 11:46:10 +1000 |
commit | 43c2dc42686150a8e7568d2f2081fea0f5a9973a (patch) | |
tree | 82e0d9f95f45a41002bd8b3f4d52be2ff938e03c /bench/wtperf/wtperf_truncate.c | |
parent | 0bdf7dd49d0cd024f4b64518519c2cdb3b12f87c (diff) | |
download | mongo-43c2dc42686150a8e7568d2f2081fea0f5a9973a.tar.gz |
wtperf_truncate - Change error handling in run_truncate slightly.
Diffstat (limited to 'bench/wtperf/wtperf_truncate.c')
-rw-r--r-- | bench/wtperf/wtperf_truncate.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/bench/wtperf/wtperf_truncate.c b/bench/wtperf/wtperf_truncate.c index 9f0b5b1b6a8..12b72d865df 100644 --- a/bench/wtperf/wtperf_truncate.c +++ b/bench/wtperf/wtperf_truncate.c @@ -122,7 +122,7 @@ run_truncate(CONFIG *cfg, CONFIG_THREAD *thread, TRUNCATE_CONFIG *trunc_cfg; TRUNCATE_QUEUE_ENTRY *truncate_item; char *truncate_key; - int ret; + int ret, t_ret; ret = 0; trunc_cfg = &thread->trunc_cfg; @@ -162,26 +162,29 @@ run_truncate(CONFIG *cfg, CONFIG_THREAD *thread, truncate_item = STAILQ_FIRST(&cfg->stone_head); trunc_cfg->num_stones--; STAILQ_REMOVE_HEAD(&cfg->stone_head, q); + free(truncate_item->key); + free(truncate_item); + truncate_item = NULL; + cursor->set_key(cursor,truncate_item->key); if ((ret = cursor->search(cursor)) != 0) { lprintf(cfg, ret, 0, "Truncate search: failed"); - return (ret); + goto err; } if ((ret = session->truncate(session, NULL, NULL, cursor, NULL)) != 0) { lprintf(cfg, ret, 0, "Truncate: failed"); - return (ret); + goto err; } - if ((ret = cursor->reset(cursor)) != 0) { - lprintf(cfg, ret, 0, "Cursor reset failed"); - return (ret); - } + *truncatedp = 1; trunc_cfg->expected_total -= truncate_item->diff; - free(truncate_item->key); - free(truncate_item); - truncate_item = NULL; + +err: if ((t_ret = cursor->reset(cursor)) != 0) { + lprintf(cfg, t_ret, 0, "Cursor reset failed"); + return (t_ret); + } return (ret); } |