kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject kudu git commit: Clean up tablet-copy error message
Date Wed, 17 May 2017 20:45:53 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 0d7e2c630 -> fd1f1699f


Clean up tablet-copy error message

The error message when tablet-copy is unauthorized was misleading.

before:

Remote error: Unable to begin tablet copy session: Not authorized:
unauthorized access to method: BeginTabletCopySession: Invalid argument:
Unable to decode tablet copy RPC error message: message: "Not
authorized: unauthorized access to method: BeginTabletCopySession" code:
ERROR_APPLICATION

after:

Remote error: Unable to begin tablet copy session: Not authorized:
unauthorized access to method: BeginTabletCopySession

Change-Id: I39292d55af96dd20b7a26f02972c2013b6e1f95e
Reviewed-on: http://gerrit.cloudera.org:8080/6912
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: fd1f1699fda1d5e7031b7613fbc211d9d3ed4140
Parents: 0d7e2c6
Author: Dan Burkert <danburkert@apache.org>
Authored: Wed May 17 11:10:15 2017 -0700
Committer: Dan Burkert <danburkert@apache.org>
Committed: Wed May 17 20:45:38 2017 +0000

----------------------------------------------------------------------
 src/kudu/tserver/tablet_copy_client.cc | 26 ++++++++++----------------
 src/kudu/tserver/tablet_copy_client.h  |  4 ----
 2 files changed, 10 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/fd1f1699/src/kudu/tserver/tablet_copy_client.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_client.cc b/src/kudu/tserver/tablet_copy_client.cc
index b5450ec..3cb2936 100644
--- a/src/kudu/tserver/tablet_copy_client.cc
+++ b/src/kudu/tserver/tablet_copy_client.cc
@@ -326,27 +326,21 @@ Status TabletCopyClient::Abort() {
   return Status::OK();
 }
 
-// Decode the remote error into a human-readable Status object.
-Status TabletCopyClient::ExtractRemoteError(const rpc::ErrorStatusPB& remote_error) {
-  if (PREDICT_TRUE(remote_error.HasExtension(TabletCopyErrorPB::tablet_copy_error_ext)))
{
-    const TabletCopyErrorPB& error =
-        remote_error.GetExtension(TabletCopyErrorPB::tablet_copy_error_ext);
-    return StatusFromPB(error.status()).CloneAndPrepend("Received error code " +
-              TabletCopyErrorPB::Code_Name(error.code()) + " from remote service");
-  } else {
-    return Status::InvalidArgument("Unable to decode tablet copy RPC error message",
-                                   SecureShortDebugString(remote_error));
-  }
-}
-
 // Enhance a RemoteError Status message with additional details from the remote.
 Status TabletCopyClient::UnwindRemoteError(const Status& status,
                                            const rpc::RpcController& controller) {
-  if (!status.IsRemoteError()) {
+  if (!status.IsRemoteError() ||
+      !controller.error_response()->HasExtension(TabletCopyErrorPB::tablet_copy_error_ext))
{
     return status;
   }
-  Status extension_status = ExtractRemoteError(*controller.error_response());
-  return status.CloneAndAppend(extension_status.ToString());
+
+  const TabletCopyErrorPB& error =
+    controller.error_response()->GetExtension(TabletCopyErrorPB::tablet_copy_error_ext);
+
+  return status.CloneAndAppend(
+      strings::Substitute("$0: received error code $1 from remote service",
+                          TabletCopyErrorPB::Code_Name(error.code()),
+                          StatusFromPB(error.status()).ToString()));
 }
 
 void TabletCopyClient::UpdateStatusMessage(const string& message) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/fd1f1699/src/kudu/tserver/tablet_copy_client.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_client.h b/src/kudu/tserver/tablet_copy_client.h
index 85a2149..0340e6f 100644
--- a/src/kudu/tserver/tablet_copy_client.h
+++ b/src/kudu/tserver/tablet_copy_client.h
@@ -124,10 +124,6 @@ class TabletCopyClient {
     kFinished,
   };
 
-  // Extract the embedded Status message from the given ErrorStatusPB.
-  // The given ErrorStatusPB must extend TabletCopyErrorPB.
-  static Status ExtractRemoteError(const rpc::ErrorStatusPB& remote_error);
-
   static Status UnwindRemoteError(const Status& status, const rpc::RpcController&
controller);
 
   // Update the bootstrap StatusListener with a message.


Mime
View raw message