kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [3/3] kudu git commit: [util] more information on fault injection
Date Tue, 20 Nov 2018 17:05:51 GMT
[util] more information on fault injection

Log more information on injected fault: name of the process and PID.
That helps to parse concatenated logs: e.g., that useful in parsing
logs from scenarios run via dist-test.

Change-Id: Id0f094006a89fd271091d1bde13d301ea359ae61
Reviewed-on: http://gerrit.cloudera.org:8080/11960
Tested-by: Kudu Jenkins
Reviewed-by: Will Berkeley <wdberkeley@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/e2cfbbf6
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/e2cfbbf6
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/e2cfbbf6

Branch: refs/heads/master
Commit: e2cfbbf6bc56f1dcf6d7402b813f41c09711a3e8
Parents: 77c729d
Author: Alexey Serbin <alexey@apache.org>
Authored: Mon Nov 19 21:00:45 2018 -0800
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Tue Nov 20 16:59:58 2018 +0000

----------------------------------------------------------------------
 src/kudu/util/fault_injection.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/e2cfbbf6/src/kudu/util/fault_injection.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/fault_injection.cc b/src/kudu/util/fault_injection.cc
index 6638bb6..2432872 100644
--- a/src/kudu/util/fault_injection.cc
+++ b/src/kudu/util/fault_injection.cc
@@ -20,11 +20,14 @@
 #include <unistd.h>
 
 #include <ostream>
+#include <string>
 
+#include <gflags/gflags.h>
 #include <glog/logging.h>
 
 #include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/once.h"
+#include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/debug/leakcheck_disabler.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/random.h"
@@ -54,7 +57,9 @@ void DoMaybeFault(const char* fault_str, double fraction) {
   if (PREDICT_TRUE(g_random->NextDoubleFraction() >= fraction)) {
     return;
   }
-  LOG(ERROR) << "Injecting fault: " << fault_str << " (process will exit)";
+  LOG(ERROR) << strings::Substitute(
+      "injecting fault for $0 (pid $1): $2 (process will exit)",
+      google::ProgramInvocationShortName(), getpid(), fault_str);
   // _exit will exit the program without running atexit handlers. This more
   // accurately simulates a crash.
   _exit(kExitStatus);


Mime
View raw message