summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2016-01-22 15:50:52 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2016-01-22 15:50:52 +1100
commitd77c7fd4b2d67160ff0fc56d5459674fec7a1b73 (patch)
tree85bc9f2b4c934d6532544c1a56bcd044b99060de
parentf403c1d0ec3e6384512a4eff6ac968d6a604c06a (diff)
downloadmongo-d77c7fd4b2d67160ff0fc56d5459674fec7a1b73.tar.gz
WT-2342 implement review feedback.
-rw-r--r--bench/wtperf/idle_table_cycle.c22
-rw-r--r--bench/wtperf/wtperf.h2
2 files changed, 16 insertions, 8 deletions
diff --git a/bench/wtperf/idle_table_cycle.c b/bench/wtperf/idle_table_cycle.c
index 3337d396fe3..a05fe2c9576 100644
--- a/bench/wtperf/idle_table_cycle.c
+++ b/bench/wtperf/idle_table_cycle.c
@@ -80,7 +80,7 @@ cycle_idle_tables(void *arg)
return (NULL);
}
- for (cycle_count = 0; cfg->idle_cycle_run == 1; ++cycle_count) {
+ for (cycle_count = 0; cfg->idle_cycle_run; ++cycle_count) {
snprintf(uri, 512, "%s_cycle%07d", cfg->uris[0], cycle_count);
/* Don't busy cycle in this loop. */
__wt_sleep(1, 0);
@@ -96,6 +96,8 @@ cycle_idle_tables(void *arg)
/* Create a table. */
if ((ret = session->create(
session, uri, cfg->table_config)) != 0) {
+ if (ret == EBUSY)
+ continue;
lprintf(cfg, ret, 0,
"Table create failed in cycle_idle_tables.");
cfg->error = ret;
@@ -123,8 +125,14 @@ cycle_idle_tables(void *arg)
return (NULL);
start = stop;
- /* Drop the table. */
- if ((ret = session->drop(session, uri, NULL)) != 0) {
+ /*
+ * Drop the table. Keep retrying on EBUSY failure - it is an
+ * expected return when checkpoints are happening.
+ */
+ while ((ret = session->drop(session, uri, "force")) == EBUSY)
+ __wt_sleep(1, 0);
+
+ if (ret != 0 && ret != EBUSY) {
lprintf(cfg, ret, 0,
"Table drop failed in cycle_idle_tables.");
cfg->error = ret;
@@ -146,12 +154,12 @@ start_idle_table_cycle(CONFIG *cfg)
if (cfg->idle_table_cycle == 0)
return (0);
- cfg->idle_cycle_run = 1;
+ cfg->idle_cycle_run = true;
if ((ret = pthread_create(
&thread_id, NULL, cycle_idle_tables, cfg)) != 0) {
lprintf(
cfg, ret, 0, "Error creating idle table cycle thread.");
- cfg->idle_cycle_run = 0;
+ cfg->idle_cycle_run = false;
return (ret);
}
cfg->idle_table_cycle_thread = thread_id;
@@ -164,10 +172,10 @@ stop_idle_table_cycle(CONFIG *cfg)
{
int ret;
- if (cfg->idle_table_cycle == 0 || cfg->idle_cycle_run == 0)
+ if (cfg->idle_table_cycle == 0 || !cfg->idle_cycle_run)
return (0);
- cfg->idle_cycle_run = 0;
+ cfg->idle_cycle_run = false;
if ((ret = pthread_join(cfg->idle_table_cycle_thread, NULL)) != 0) {
lprintf(
cfg, ret, 0, "Error joining idle table cycle thread.");
diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h
index 3a03b68b116..ad71877fdcf 100644
--- a/bench/wtperf/wtperf.h
+++ b/bench/wtperf/wtperf.h
@@ -188,7 +188,7 @@ struct __config { /* Configuration structure */
volatile int in_warmup; /* Running warmup phase */
pthread_t idle_table_cycle_thread; /* Thread ID of idle cycle thread */
- volatile int idle_cycle_run; /* Signal idle cycle thread */
+ volatile bool idle_cycle_run; /* Signal idle cycle thread */
volatile uint32_t totalsec; /* total seconds running */