diff options
Diffstat (limited to 'bench/wtperf/config.c')
-rw-r--r-- | bench/wtperf/config.c | 67 |
1 files changed, 54 insertions, 13 deletions
diff --git a/bench/wtperf/config.c b/bench/wtperf/config.c index 2544bbd371c..e83d6fcceed 100644 --- a/bench/wtperf/config.c +++ b/bench/wtperf/config.c @@ -241,10 +241,6 @@ config_threads(CONFIG *cfg, const char *config, size_t len) goto err; continue; } - if (STRING_MATCH("throttle", k.str, k.len)) { - workp->throttle = (uint64_t)v.val; - continue; - } if (STRING_MATCH("insert", k.str, k.len) || STRING_MATCH("inserts", k.str, k.len)) { if ((workp->insert = v.val) < 0) @@ -262,20 +258,17 @@ config_threads(CONFIG *cfg, const char *config, size_t len) goto err; continue; } - if (STRING_MATCH("update", k.str, k.len) || - STRING_MATCH("updates", k.str, k.len)) { - if ((workp->update = v.val) < 0) - goto err; + if (STRING_MATCH("throttle", k.str, k.len)) { + workp->throttle = (uint64_t)v.val; 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) { + if (F_ISSET(cfg, CFG_TRUNCATE)) goto err; - } - cfg->has_truncate = 1; + F_SET(cfg, CFG_TRUNCATE); continue; } if (STRING_MATCH("truncate_pct", k.str, k.len)) { @@ -290,6 +283,29 @@ config_threads(CONFIG *cfg, const char *config, size_t len) workp->truncate_count = (uint64_t)v.val; continue; } + if (STRING_MATCH("update", k.str, k.len) || + STRING_MATCH("updates", k.str, k.len)) { + if ((workp->update = v.val) < 0) + goto err; + continue; + } + if (STRING_MATCH("update_delta", k.str, k.len)) { + if (v.type == WT_CONFIG_ITEM_STRING || + v.type == WT_CONFIG_ITEM_ID) { + if (strncmp(v.str, "rand", 4) != 0) + goto err; + /* Special random value */ + workp->update_delta = INT64_MAX; + F_SET(cfg, CFG_GROW); + } else { + workp->update_delta = v.val; + if (v.val > 0) + F_SET(cfg, CFG_GROW); + if (v.val < 0) + F_SET(cfg, CFG_SHRINK); + } + continue; + } goto err; } if (ret == WT_NOTFOUND) @@ -409,7 +425,12 @@ config_opt(CONFIG *cfg, WT_CONFIG_ITEM *k, WT_CONFIG_ITEM *v) *(uint32_t *)valueloc = (uint32_t)v->val; break; case CONFIG_STRING_TYPE: - if (v->type != WT_CONFIG_ITEM_STRING) { + /* + * Configuration parsing uses string/ID to distinguish + * between quoted and unquoted values. + */ + if (v->type != WT_CONFIG_ITEM_STRING && + v->type != WT_CONFIG_ITEM_ID) { fprintf(stderr, "wtperf: Error: " "bad string value for \'%.*s=%.*s\'\n", (int)k->len, k->str, (int)v->len, v->str); @@ -438,7 +459,8 @@ config_opt(CONFIG *cfg, WT_CONFIG_ITEM *k, WT_CONFIG_ITEM *v) STRING_MATCH("threads", k->str, k->len)) return (config_threads(cfg, v->str, v->len)); - if (v->type != WT_CONFIG_ITEM_STRING) { + if (v->type != WT_CONFIG_ITEM_STRING && + v->type != WT_CONFIG_ITEM_ID) { fprintf(stderr, "wtperf: Error: " "bad string value for \'%.*s=%.*s\'\n", (int)k->len, k->str, (int)v->len, v->str); @@ -672,6 +694,25 @@ config_sanity(CONFIG *cfg) return (EINVAL); } + if (cfg->value_sz_max < cfg->value_sz) { + if (F_ISSET(cfg, CFG_GROW)) { + fprintf(stderr, "value_sz_max %" PRIu32 + " must be greater than or equal to value_sz %" + PRIu32 "\n", cfg->value_sz_max, cfg->value_sz); + return (EINVAL); + } else + cfg->value_sz_max = cfg->value_sz; + } + if (cfg->value_sz_min > cfg->value_sz) { + if (F_ISSET(cfg, CFG_SHRINK)) { + fprintf(stderr, "value_sz_min %" PRIu32 + " must be less than or equal to value_sz %" + PRIu32 "\n", cfg->value_sz_min, cfg->value_sz); + return (EINVAL); + } else + cfg->value_sz_min = cfg->value_sz; + } + if (cfg->readonly && cfg->workload != NULL) for (i = 0, workp = cfg->workload; i < cfg->workload_cnt; ++i, ++workp) |