Limit short versions of KUDU_* macros to Kudu source.

So far we allowed short versions of Kudu macros in Impala by
defining KUDU_HEADERS_USE_SHORT_STATUS_MACROS in all compilation units.
I.e. DCHECK_OK meant KUDU_DCHECK_OK. This is a problem when we want to
define our own DCHECK_OK for an Impala Status object.

This commit limits KUDU_HEADERS_USE_SHORT_STATUS_MACROS to the Kudu
source files.

Unfortunately KUDU_HEADERS_USE_SHORT_STATUS_MACROS also controls some
Kudu log macros, e.g. KUDU_LOG. With the macro KUDU_LOG is defined to
LOG (glog). Without the macro KUDU_LOG is not defined, the Kudu library
expects that the clients will include 'kudu/client/stubs.h' which will
define KUDU_LOG to kudu::internal_logging::CerrLog. So far Impala didn't
use stubs.h (we define KUDU_HEADERS_NO_STUBS), and I think we still want
to use glog.
So in 'common/logging.h' I defined the KUDU logging macros to glog
macros (like if KUDU_HEADERS_USE_SHORT_STATUS_MACROS was still defined).

Change-Id: I06a65353d2a9eecf956e4ceb8d21eda2eebc69d5
Reviewed-on: http://gerrit.cloudera.org:8080/15596
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Zoltan Borok-Nagy
2020-03-30 17:40:46 +02:00
committed by Impala Public Jenkins
parent ebbe52b4be
commit d9a38c0bac
6 changed files with 15 additions and 6 deletions

View File

@@ -213,11 +213,9 @@ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${RULE_LAUNCH_PREFIX})
# Thrift requires these definitions for some types that we use
add_definitions(-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DHAVE_NETDB_H)
# Kudu flags. 1. Enable non KUDU_* prefixes for status macros to allow Kudu code to
# compile without changing the macro. 2. Enable full support for all backing types of
# kudu::Slices. 3. Don't include stubs.h
add_definitions(-DKUDU_HEADERS_USE_SHORT_STATUS_MACROS -DKUDU_HEADERS_USE_RICH_SLICE
-DKUDU_HEADERS_NO_STUBS)
# Kudu flags. 1. Enable full support for all backing types of kudu::Slices.
# 2. Don't include stubs.h
add_definitions(-DKUDU_HEADERS_USE_RICH_SLICE -DKUDU_HEADERS_NO_STUBS)
# Set clang flags for cross-compiling to IR.
# IR_COMPILE is #defined for the cross compile to remove code that bloats the IR.

View File

@@ -68,6 +68,11 @@
DCHECK(a == b) << "[ " #a " = " << static_cast<int>(a) << " , " #b " = " \
<< static_cast<int>(b) << " ]"
/// Define Kudu logging macros to use glog macros.
#define KUDU_LOG LOG
#define KUDU_CHECK CHECK
#define KUDU_DCHECK DCHECK
namespace impala {
/// IR modules don't use these methods, and can't see the google namespace used in
/// GetFullLogFilename()'s prototype.

View File

@@ -39,6 +39,8 @@ ADD_EXPORTABLE_LIBRARY(rpc_introspection_proto
DEPS ${RPC_INTROSPECTION_PROTO_LIBS}
NONLINK_DEPS ${RPC_INTROSPECTION_PROTO_TGTS})
add_definitions(-DKUDU_HEADERS_USE_SHORT_STATUS_MACROS)
### RPC library
set(KRPC_SRCS
acceptor_pool.cc

View File

@@ -29,6 +29,8 @@ if(NOT APPLE)
target_link_libraries(krb5_realm_override dl)
endif()
add_definitions(-DKUDU_HEADERS_USE_SHORT_STATUS_MACROS)
##############################
# token_proto
##############################

View File

@@ -29,6 +29,8 @@ ADD_EXPORTABLE_LIBRARY(util_compression_proto
DEPS protobuf
NONLINK_DEPS ${UTIL_COMPRESSION_PROTO_TGTS})
add_definitions(-DKUDU_HEADERS_USE_SHORT_STATUS_MACROS)
#######################################
# hash_proto
#######################################

View File

@@ -231,7 +231,7 @@ kudu::Status RunSpnegoStep(
string resp_token_b64;
bool is_complete;
RETURN_NOT_OK(kudu::gssapi::SpnegoStep(
KUDU_RETURN_NOT_OK(kudu::gssapi::SpnegoStep(
neg_token, &resp_token_b64, &is_complete, authn_user));
if (!resp_token_b64.empty()) {