Skip to content

Commit

Permalink
fix issue #104 arbitrary command with run count (#105)
Browse files Browse the repository at this point in the history
when using the arbitrary command with run count, the
format_arbitrary_command() called for each run, causing to
the data to be corrupted.

moving the function to be called once at main()
  • Loading branch information
YaacovHazan authored and yaacovhazan-Redislabs committed Dec 11, 2019
1 parent f55b4b6 commit dd582d2
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions memtier_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,13 +1018,6 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
threads.push_back(t);
}

// if user configure arbitrary commands, we use one of the thread's protocol to format and prepare it
for (unsigned int i=0; i<cfg->arbitrary_commands->size(); i++) {
if (!threads.front()->m_protocol->format_arbitrary_command(cfg->arbitrary_commands->at(i))) {
exit(1);
}
}

// launch threads
fprintf(stderr, "[RUN #%u] Launching threads now...\n", run_id);
for (std::vector<cg_thread*>::iterator i = threads.begin(); i != threads.end(); i++) {
Expand Down Expand Up @@ -1163,6 +1156,19 @@ int main(int argc, char *argv[])
fprintf(stderr, "===================================================\n");
}

// if user configure arbitrary commands, format and prepare it
for (unsigned int i=0; i<cfg.arbitrary_commands->size(); i++) {
abstract_protocol* tmp_protocol = protocol_factory(cfg.protocol);
assert(tmp_protocol != NULL);

if (!tmp_protocol->format_arbitrary_command(cfg.arbitrary_commands->at(i))) {
exit(1);
}

delete tmp_protocol;
}


#ifdef USE_TLS
// Initialize OpenSSL only if we're really going to use it.
if (cfg.tls) {
Expand Down

0 comments on commit dd582d2

Please sign in to comment.