This is an automated email from the ASF dual-hosted git repository.

zhaoliwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new f98f16e  fix: fix bug that benchmark can't exit (#834)
f98f16e is described below

commit f98f16ef1b11deaef8a284e9af40fd1af7e5b4db
Author: levy5307 <[email protected]>
AuthorDate: Fri Nov 5 14:55:22 2021 +0800

    fix: fix bug that benchmark can't exit (#834)
---
 src/test/bench_test/benchmark.cpp | 9 +++++----
 src/test/bench_test/main.cpp      | 4 +++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/test/bench_test/benchmark.cpp 
b/src/test/bench_test/benchmark.cpp
index 9c424fd..2189cb1 100644
--- a/src/test/bench_test/benchmark.cpp
+++ b/src/test/bench_test/benchmark.cpp
@@ -20,6 +20,7 @@
 #include <sstream>
 #include <pegasus/client.h>
 #include <dsn/dist/fmt_logging.h>
+#include <dsn/c/app_model.h>
 
 #include "benchmark.h"
 #include "rand.h"
@@ -116,7 +117,7 @@ void benchmark::write_random(thread_arg *thread)
                 break;
             } else if (ret != ::pegasus::PERR_TIMEOUT || try_count > 3) {
                 fmt::print(stderr, "Set returned an error: {}\n", 
_client->get_error_string(ret));
-                exit(1);
+                dsn_exit(1);
             } else {
                 fmt::print(stderr, "Set timeout, retry({})\n", try_count);
             }
@@ -153,7 +154,7 @@ void benchmark::read_random(thread_arg *thread)
                 break;
             } else if (ret != ::pegasus::PERR_TIMEOUT || try_count > 3) {
                 fmt::print(stderr, "Get returned an error: {}\n", 
_client->get_error_string(ret));
-                exit(1);
+                dsn_exit(1);
             } else {
                 fmt::print(stderr, "Get timeout, retry({})\n", try_count);
             }
@@ -186,7 +187,7 @@ void benchmark::delete_random(thread_arg *thread)
                 break;
             } else if (ret != ::pegasus::PERR_TIMEOUT || try_count > 3) {
                 fmt::print(stderr, "Del returned an error: {}\n", 
_client->get_error_string(ret));
-                exit(1);
+                dsn_exit(1);
             } else {
                 fmt::print(stderr, "Get timeout, retry({})\n", try_count);
             }
@@ -215,7 +216,7 @@ operation_type benchmark::get_operation_type(const 
std::string &name)
         op_type = kDelete;
     } else if (!name.empty()) { // No error message for empty name
         fmt::print(stderr, "unknown benchmark '{}'\n", name);
-        exit(1);
+        dsn_exit(1);
     }
 
     return op_type;
diff --git a/src/test/bench_test/main.cpp b/src/test/bench_test/main.cpp
index 47d5d32..5b98b3f 100644
--- a/src/test/bench_test/main.cpp
+++ b/src/test/bench_test/main.cpp
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <pegasus/client.h>
 #include <dsn/dist/fmt_logging.h>
+#include <dsn/c/app_model.h>
 
 #include "benchmark.h"
 
@@ -47,5 +48,6 @@ int main(int argc, char **argv)
         return -1;
     }
 
-    return db_bench_tool(argv[1]);
+    auto result = db_bench_tool(argv[1]);
+    dsn_exit(result);
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to