kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject [4/6] incubator-kudu git commit: Add a way to include request ids in log-dump
Date Fri, 15 Jul 2016 00:57:46 GMT
Add a way to include request ids in log-dump

This adds a way to output the request ids, if they exist, in log-dump.cc.
This is helpful when debugging as it allows to see which writes the
request ids get associated with.

Change-Id: I88d7c65887a98544ee83b5b4bc0817bea7222131
Reviewed-on: http://gerrit.cloudera.org:8080/3612
Reviewed-by: David Ribeiro Alves <dralves@apache.org>
Tested-by: David Ribeiro Alves <dralves@apache.org>


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

Branch: refs/heads/master
Commit: 0412fa7686d70720b7ac67b66ae85dc832963636
Parents: ee38093
Author: David Alves <david.alves@cloudera.com>
Authored: Mon Jul 4 14:58:53 2016 -0700
Committer: David Ribeiro Alves <dralves@apache.org>
Committed: Fri Jul 15 00:05:41 2016 +0000

----------------------------------------------------------------------
 src/kudu/consensus/log-dump.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/0412fa76/src/kudu/consensus/log-dump.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log-dump.cc b/src/kudu/consensus/log-dump.cc
index e26d778..8bab8fc 100644
--- a/src/kudu/consensus/log-dump.cc
+++ b/src/kudu/consensus/log-dump.cc
@@ -28,6 +28,7 @@
 #include "kudu/consensus/log_reader.h"
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/numbers.h"
+#include "kudu/rpc/rpc_header.pb.h"
 #include "kudu/util/env.h"
 #include "kudu/util/flags.h"
 #include "kudu/util/logging.h"
@@ -104,7 +105,8 @@ void PrintIdOnly(const LogEntryPB& entry) {
 
 Status PrintDecodedWriteRequestPB(const string& indent,
                                   const Schema& tablet_schema,
-                                  const WriteRequestPB& write) {
+                                  const WriteRequestPB& write,
+                                  const rpc::RequestIdPB* request_id) {
   Schema request_schema;
   RETURN_NOT_OK(SchemaFromPB(write.schema(), &request_schema));
 
@@ -114,6 +116,8 @@ Status PrintDecodedWriteRequestPB(const string& indent,
   RETURN_NOT_OK(dec.DecodeOperations(&ops));
 
   cout << indent << "Tablet: " << write.tablet_id() << endl;
+  cout << indent << "RequestId: "
+      << (request_id ? request_id->ShortDebugString() : "None") << endl;
   cout << indent << "Consistency: "
        << ExternalConsistencyMode_Name(write.external_consistency_mode()) <<
endl;
   if (write.has_propagated_timestamp()) {
@@ -139,7 +143,11 @@ Status PrintDecoded(const LogEntryPB& entry, const Schema& tablet_schema)
{
 
     const ReplicateMsg& replicate = entry.replicate();
     if (replicate.op_type() == consensus::WRITE_OP) {
-      RETURN_NOT_OK(PrintDecodedWriteRequestPB(indent, tablet_schema, replicate.write_request()));
+      RETURN_NOT_OK(PrintDecodedWriteRequestPB(
+          indent,
+          tablet_schema,
+          replicate.write_request(),
+          replicate.has_request_id() ? &replicate.request_id() : nullptr));
     } else {
       cout << indent << replicate.ShortDebugString() << endl;
     }


Mime
View raw message