summaryrefslogtreecommitdiff
path: root/bench/wtperf/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'bench/wtperf/config.c')
-rw-r--r--bench/wtperf/config.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/bench/wtperf/config.c b/bench/wtperf/config.c
index 47e052d6055..721b41432cb 100644
--- a/bench/wtperf/config.c
+++ b/bench/wtperf/config.c
@@ -95,6 +95,8 @@ config_assign(CONFIG *dest, const CONFIG *src)
*pstr = newstr;
}
}
+
+ STAILQ_INIT(&dest->stone_head);
return (0);
}
@@ -122,6 +124,7 @@ config_free(CONFIG *cfg)
free(cfg->uris);
}
+ cleanup_truncate_config(cfg);
free(cfg->ckptthreads);
free(cfg->popthreads);
free(cfg->base_uri);
@@ -243,6 +246,28 @@ config_threads(CONFIG *cfg, const char *config, size_t len)
goto err;
continue;
}
+ if (STRING_MATCH("truncate", k.str, k.len)) {
+ if ((workp->truncate = v.val) != 1)
+ goto err;
+ /* There can only be one Truncate thread. */
+ if (cfg->has_truncate != 0) {
+ goto err;
+ }
+ cfg->has_truncate = 1;
+ continue;
+ }
+ if (STRING_MATCH("truncate_pct", k.str, k.len)) {
+ if (v.val <= 0)
+ goto err;
+ workp->truncate_pct = (uint64_t)v.val;
+ continue;
+ }
+ if (STRING_MATCH("truncate_count", k.str, k.len)) {
+ if (v.val <= 0)
+ goto err;
+ workp->truncate_count = (uint64_t)v.val;
+ continue;
+ }
goto err;
}
if (ret == WT_NOTFOUND)
@@ -253,9 +278,21 @@ config_threads(CONFIG *cfg, const char *config, size_t len)
scan = NULL;
if (ret != 0)
goto err;
-
- if (workp->insert == 0 &&
- workp->read == 0 && workp->update == 0)
+ if (workp->insert == 0 && workp->read == 0 &&
+ workp->update == 0 && workp->truncate == 0)
+ goto err;
+ /* Why run with truncate if we don't want any truncation. */
+ if (workp->truncate != 0 &&
+ workp->truncate_pct == 0 && workp->truncate_count == 0)
+ goto err;
+ if (workp->truncate != 0 &&
+ (workp->truncate_pct < 1 || workp->truncate_pct > 99))
+ goto err;
+ /* Truncate should have its own exclusive thread. */
+ if (workp->truncate != 0 && workp->threads > 1)
+ goto err;
+ if (workp->truncate != 0 &&
+ (workp->insert > 0 || workp->read > 0 || workp->update > 0))
goto err;
cfg->workers_cnt += (u_int)workp->threads;
}
@@ -640,9 +677,11 @@ config_print(CONFIG *cfg)
for (i = 0, workp = cfg->workload;
i < cfg->workload_cnt; ++i, ++workp)
printf("\t\t%" PRId64 " threads (inserts=%" PRId64
- ", reads=%" PRId64 ", updates=%" PRId64 ")\n",
+ ", reads=%" PRId64 ", updates=%" PRId64
+ ", truncates=% " PRId64 ")\n",
workp->threads,
- workp->insert, workp->read, workp->update);
+ workp->insert, workp->read,
+ workp->update, workp->truncate);
}
printf("\t" "Checkpoint threads, interval: %" PRIu32 ", %" PRIu32 "\n",