diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2014-06-26 12:40:00 -0400 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2014-06-26 12:40:00 -0400 |
commit | a12fda3f0f0ab26bc94a95a703090ac78aeeffb0 (patch) | |
tree | 1b73b070ccae2d9888b4b359c3295639925a9fa1 /bench | |
parent | 7b60f6e917a429e71675ff262e316f706a0ad25f (diff) | |
download | mongo-a12fda3f0f0ab26bc94a95a703090ac78aeeffb0.tar.gz |
Move connection close/reopen to its own function called by start_run.
Diffstat (limited to 'bench')
-rw-r--r-- | bench/wtperf/wtperf.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c index 3d33a28f332..f04edd03d70 100644 --- a/bench/wtperf/wtperf.c +++ b/bench/wtperf/wtperf.c @@ -1338,6 +1338,13 @@ retry: if ((ret = cfg->conn->async_new_op(cfg->conn, lprintf(cfg, 0, 1, "Compact completed in %.2f seconds", secs); assert(tables == 0); } + return (0); +} + +static int +close_reopen(CONFIG *cfg) +{ + int ret; /* * Reopen the connection. We do this so that the workload phase always @@ -1345,13 +1352,11 @@ retry: if ((ret = cfg->conn->async_new_op(cfg->conn, * be identified. This is particularly important for LSM, where the * merge algorithm is more aggressive for read-only trees. */ - if ((ret = cfg->conn->close(cfg->conn, NULL)) != 0) { + /* cfg->conn is released no matter the return value from close(). */ + ret = cfg->conn->close(cfg->conn, NULL); + cfg->conn = NULL; + if (ret != 0) { lprintf(cfg, ret, 0, "Closing the connection failed"); - - /* - * Don't repeat the close in our caller based on the failure. - */ - cfg->conn = NULL; return (ret); } if ((ret = wiredtiger_open( @@ -1372,7 +1377,6 @@ retry: if ((ret = cfg->conn->async_new_op(cfg->conn, return (ret); } } - return (0); } @@ -1801,6 +1805,13 @@ start_run(CONFIG *cfg) /* Optional workload. */ if (cfg->workers_cnt != 0 && (cfg->run_time != 0 || cfg->run_ops != 0)) { + /* + * If we have a workload, close and reopen the connection so + * that LSM can detect read-only workloads. + */ + if (close_reopen(cfg) != 0) + goto err; + /* Didn't create, set insert count. */ if (cfg->create == 0 && find_table_count(cfg) != 0) goto err; |