You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by tm...@apache.org on 2019/02/12 04:06:55 UTC

[impala] 01/05: IMPALA-8177: Log DDL failures in coordinator logs

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

tmarshall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit fa604fb5059307321a174db02469b4f5fb78410f
Author: Bharath Vissapragada <bh...@cloudera.com>
AuthorDate: Fri Feb 8 11:29:55 2019 -0800

    IMPALA-8177: Log DDL failures in coordinator logs
    
    If a DDL fails for some reason, it helps to log the failure message in
    the coordinator logs so that we can differentiate between failed and
    successful DDL queries.
    
    For ex:
    
    [0d66cd6004b4:21000] default> drop database foo;
    Query: drop database foo
    ERROR: ImpalaRuntimeException: Error making 'dropDatabase' RPC to Hive Metastore:
    CAUSED BY: NoSuchObjectException: foo
    ----- coordinator logs -------
    I0208 12:13:26.251695 25474 Frontend.java:1242] 704e86fff482c0b5:f0501f9400000000] Analyzing query: drop database foo
    I0208 12:13:26.253773 25474 Frontend.java:1282] 704e86fff482c0b5:f0501f9400000000] Analysis finished.
    I0208 12:13:26.419946 25474 client-request-state.cc:176] 704e86fff482c0b5:f0501f9400000000] ImpalaRuntimeException: Error making 'dropDatabase' RPC to Hive Metastore:
    CAUSED BY: NoSuchObjectException: foo
    I0208 12:13:26.419992 25474 impala-server.cc:1142] 704e86fff482c0b5:f0501f9400000000] UnregisterQuery(): query_id=704e86fff482c0b5:f0501f9400000000
    I0208 12:13:26.419997 25474 impala-server.cc:1249] 704e86fff482c0b5:f0501f9400000000] Cancel(): query_id=704e86fff482c0b5:f0501f9400000000
    -------------------------------
    
    Testing: Verified manually by running a few DDLs that fail and then inspecting
    the coordinator log file.
    
    Change-Id: Ie89291ee27156c701e07cea44ad3ee07ec54ab42
    Reviewed-on: http://gerrit.cloudera.org:8080/12414
    Reviewed-by: Bharath Vissapragada <bh...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/common/status.h                 | 9 +++++++++
 be/src/service/client-request-state.cc | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/be/src/common/status.h b/be/src/common/status.h
index 3fd5b5b..41f7663 100644
--- a/be/src/common/status.h
+++ b/be/src/common/status.h
@@ -359,6 +359,15 @@ std::ostream& operator<<(std::ostream& os, const Status& status);
     if (UNLIKELY(!_status.ok())) return _status; \
   } while (false)
 
+#define LOG_AND_RETURN_IF_ERROR(stmt) \
+  do { \
+    const ::impala::Status& _status = (stmt); \
+    if (UNLIKELY(!_status.ok()))  { \
+      LOG(INFO) << _status.GetDetail(); \
+      return _status; \
+    } \
+  } while (false)
+
 #define RETURN_VOID_IF_ERROR(stmt)                     \
   do {                                                 \
     if (UNLIKELY(!(stmt).ok())) return;                \
diff --git a/be/src/service/client-request-state.cc b/be/src/service/client-request-state.cc
index bac6c1c..b1070bd 100644
--- a/be/src/service/client-request-state.cc
+++ b/be/src/service/client-request-state.cc
@@ -21,6 +21,7 @@
 #include <limits>
 #include <gutil/strings/substitute.h>
 
+#include "common/status.h"
 #include "exec/kudu-util.h"
 #include "kudu/rpc/rpc_controller.h"
 #include "runtime/backend-client.h"
@@ -183,7 +184,7 @@ Status ClientRequestState::Exec(TExecRequest* exec_request) {
     }
     case TStmtType::DDL: {
       DCHECK(exec_request_.__isset.catalog_op_request);
-      RETURN_IF_ERROR(ExecDdlRequest());
+      LOG_AND_RETURN_IF_ERROR(ExecDdlRequest());
       break;
     }
     case TStmtType::LOAD: {