You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by bi...@apache.org on 2018/10/09 23:18:21 UTC

[5/8] impala git commit: IMPALA-7675: Fix the error handling of UpdateTableUsage() RPC

IMPALA-7675: Fix the error handling of UpdateTableUsage() RPC

UpdateTableUsage() is logically a one-way RPC and the status object in
TUpdateTableUsageResponse is set only if there is an error at RPC
layer. This patch fixes the incorrect error handling that leads to
NullPointerException in ImpaladTableUsageTracer.

Change-Id: Iccba4c6f4696ef08bc8a614ae13f62b5e445917b
Reviewed-on: http://gerrit.cloudera.org:8080/11603
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


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

Branch: refs/heads/master
Commit: 122c3667dac4a604adbe6dbe90030f8801b579bc
Parents: d05f73f
Author: Tianyi Wang <tw...@cloudera.com>
Authored: Fri Oct 5 18:24:09 2018 -0700
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Tue Oct 9 06:09:24 2018 +0000

----------------------------------------------------------------------
 be/src/service/fe-support.cc                                     | 4 ++--
 .../java/org/apache/impala/catalog/ImpaladTableUsageTracker.java | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/122c3667/be/src/service/fe-support.cc
----------------------------------------------------------------------
diff --git a/be/src/service/fe-support.cc b/be/src/service/fe-support.cc
index b933c7d..5dd06de 100644
--- a/be/src/service/fe-support.cc
+++ b/be/src/service/fe-support.cc
@@ -540,7 +540,7 @@ Java_org_apache_impala_service_FeSupport_NativeUpdateTableUsage(
   if (!status.ok()) {
     LOG(ERROR) << status.GetDetail();
     status.AddDetail("Error making an RPC call to Catalog server.");
-    status.ToThrift(&result.status);
+    status.SetTStatus(&result);
   }
 
   jbyteArray result_bytes = nullptr;
@@ -583,7 +583,7 @@ Java_org_apache_impala_service_FeSupport_NativeGetPartitionStats(
   Status status = catalog_op_executor.GetPartitionStats(request, &result);
   if (!status.ok()) {
     LOG(ERROR) << status.GetDetail();
-    status.ToThrift(&result.status);
+    status.SetTStatus(&result);
   }
   jbyteArray result_bytes = nullptr;
   THROW_IF_ERROR_RET(SerializeThriftMsg(env, &result, &result_bytes), env,

http://git-wip-us.apache.org/repos/asf/impala/blob/122c3667/fe/src/main/java/org/apache/impala/catalog/ImpaladTableUsageTracker.java
----------------------------------------------------------------------
diff --git a/fe/src/main/java/org/apache/impala/catalog/ImpaladTableUsageTracker.java b/fe/src/main/java/org/apache/impala/catalog/ImpaladTableUsageTracker.java
index 45ba1ab..2d6ccda 100644
--- a/fe/src/main/java/org/apache/impala/catalog/ImpaladTableUsageTracker.java
+++ b/fe/src/main/java/org/apache/impala/catalog/ImpaladTableUsageTracker.java
@@ -107,8 +107,7 @@ public class ImpaladTableUsageTracker {
             FeSupport.NativeUpdateTableUsage(new TSerializer().serialize(reqToSend));
         TUpdateTableUsageResponse resp = new TUpdateTableUsageResponse();
         JniUtil.deserializeThrift(new TBinaryProtocol.Factory(), resp, byteResp);
-        if (resp.status.isSetStatus_code() &&
-            !resp.status.status_code.equals(TErrorCode.OK)) {
+        if (resp.isSetStatus() && !resp.status.status_code.equals(TErrorCode.OK)) {
           LOG.warn(
               updateFailureMessage + Joiner.on("\n").join(resp.status.getError_msgs()));
         }