Skip to content

Commit dd582d2

Browse files
YaacovHazanyaacovhazan-Redislabs
authored andcommitted
fix issue #104 arbitrary command with run count (#105)
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()
1 parent f55b4b6 commit dd582d2

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

memtier_benchmark.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,13 +1018,6 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
10181018
threads.push_back(t);
10191019
}
10201020

1021-
// if user configure arbitrary commands, we use one of the thread's protocol to format and prepare it
1022-
for (unsigned int i=0; i<cfg->arbitrary_commands->size(); i++) {
1023-
if (!threads.front()->m_protocol->format_arbitrary_command(cfg->arbitrary_commands->at(i))) {
1024-
exit(1);
1025-
}
1026-
}
1027-
10281021
// launch threads
10291022
fprintf(stderr, "[RUN #%u] Launching threads now...\n", run_id);
10301023
for (std::vector<cg_thread*>::iterator i = threads.begin(); i != threads.end(); i++) {
@@ -1163,6 +1156,19 @@ int main(int argc, char *argv[])
11631156
fprintf(stderr, "===================================================\n");
11641157
}
11651158

1159+
// if user configure arbitrary commands, format and prepare it
1160+
for (unsigned int i=0; i<cfg.arbitrary_commands->size(); i++) {
1161+
abstract_protocol* tmp_protocol = protocol_factory(cfg.protocol);
1162+
assert(tmp_protocol != NULL);
1163+
1164+
if (!tmp_protocol->format_arbitrary_command(cfg.arbitrary_commands->at(i))) {
1165+
exit(1);
1166+
}
1167+
1168+
delete tmp_protocol;
1169+
}
1170+
1171+
11661172
#ifdef USE_TLS
11671173
// Initialize OpenSSL only if we're really going to use it.
11681174
if (cfg.tls) {

0 commit comments

Comments
 (0)