Repository: kudu
Updated Branches:
refs/heads/master 0ce5ba594 -> 1c6687426
[c++compilation] fixed 'unused' warnings
Use DCHECK() instead of DCHECK_NOTNULL() as recommended by
glog/logging.h to avoid compilation warnings in release configuration.
An example of previously emitted warning:
src/kudu/common/wire_protocol.cc:599:18:
warning:
expression result unused [-Wunused-value]
DCHECK_NOTNULL(dst_schema);
^~~~~~~~~~
thirdparty/installed-deps/include/glog/logging.h:1044:30:
note:
expanded from macro 'DCHECK_NOTNULL'
Also, moved schema partitioning compatibility function under the
ifdef to fix the unused function warning.
Change-Id: If0a59ef51e5c5ea8be89109a48a57dc5abfde646
Reviewed-on: http://gerrit.cloudera.org:8080/4503
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/bad91010
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/bad91010
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/bad91010
Branch: refs/heads/master
Commit: bad910100a4ad3c44b944462838fdee31335e029
Parents: 0ce5ba5
Author: Alexey Serbin <[email protected]>
Authored: Wed Sep 21 19:11:17 2016 -0700
Committer: Alexey Serbin <[email protected]>
Committed: Thu Sep 22 04:30:27 2016 +0000
----------------------------------------------------------------------
src/kudu/client/meta_cache.h | 2 +-
src/kudu/codegen/row_projector.cc | 113 +++++++++++++++---------------
src/kudu/common/wire_protocol.cc | 2 +-
src/kudu/consensus/consensus.cc | 2 +-
src/kudu/consensus/raft_consensus.cc | 2 +-
src/kudu/rpc/rpc.cc | 5 +-
6 files changed, 62 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/bad91010/src/kudu/client/meta_cache.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/meta_cache.h b/src/kudu/client/meta_cache.h
index a46a8a8..3f70b95 100644
--- a/src/kudu/client/meta_cache.h
+++ b/src/kudu/client/meta_cache.h
@@ -283,7 +283,7 @@ class MetaCacheEntry {
// Returns the remote tablet, should only be called if this entry contains a
// tablet.
const scoped_refptr<RemoteTablet>& tablet() const {
- DCHECK_NOTNULL(tablet_.get());
+ DCHECK(tablet_);
DCHECK(Initialized());
return tablet_;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/bad91010/src/kudu/codegen/row_projector.cc
----------------------------------------------------------------------
diff --git a/src/kudu/codegen/row_projector.cc
b/src/kudu/codegen/row_projector.cc
index 507769c..c6076cf 100644
--- a/src/kudu/codegen/row_projector.cc
+++ b/src/kudu/codegen/row_projector.cc
@@ -392,68 +392,67 @@ bool ContainerEquals(const T& t1, const T& t2) {
return ContainerEquals(t1, t2, DefaultEquals());
}
-// This method defines what makes (base, projection) schema pairs compatible.
-// In other words, this method can be thought of as the equivalence relation
-// on the set of all well-formed (base, projection) schema pairs that
-// partitions the set into equivalence classes which will have the exact
-// same projection function code.
-//
-// This equivalence relation can be decomposed as:
-//
-// ProjectionsCompatible((base1, proj1), (base2, proj2)) :=
-// WELLFORMED(base1, proj1) &&
-// WELLFORMED(base2, proj2) &&
-// PROJEQUALS(base1, base2) &&
-// PROJEQUALS(proj1, proj2) &&
-// MAP(base1, proj1) == MAP(base2, proj2)
-//
-// where WELLFORMED checks that a projection is well-formed (i.e., a
-// kudu::RowProjector can be initialized with the schema pair), PROJEQUAL
-// is a relaxed version of the Schema::Equals() operator that is
-// independent of column names and column IDs, and MAP addresses
-// the actual dependency on column identification - which is the effect
-// that those attributes have on the RowProjector's mapping (i.e., different
-// names and IDs are ok, so long as the mapping is the same). Note that
-// key columns are not given any special meaning in projection. Physical types
-// and nullability of columns must be exactly equal between the two
-// schema pairs.
-//
-// Status::OK corresponds to true in the equivalence relation and other
-// statuses correspond to false, explaining why the projections are
-// incompatible.
-Status ProjectionsCompatible(const Schema& base1, const Schema& proj1,
- const Schema& base2, const Schema& proj2) {
- kudu::RowProjector rp1(&base1, &proj1), rp2(&base2, &proj2);
- RETURN_NOT_OK_PREPEND(rp1.Init(), "(base1, proj1) projection "
- "schema pair not well formed: ");
- RETURN_NOT_OK_PREPEND(rp2.Init(), "(base2, proj2) projection "
- "schema pair not well formed: ");
-
- if (!ContainerEquals(base1.columns(), base2.columns(),
- ColumnSchemaEqualsType())) {
- return Status::IllegalState("base schema types unequal");
- }
- if (!ContainerEquals(proj1.columns(), proj2.columns(),
- ColumnSchemaEqualsType())) {
- return Status::IllegalState("projection schema types unequal");
- }
-
- if (!ContainerEquals(rp1.base_cols_mapping(), rp2.base_cols_mapping())) {
- return Status::IllegalState("base column mappings do not match");
- }
- if (!ContainerEquals(rp1.projection_defaults(), rp2.projection_defaults())) {
- return Status::IllegalState("projection default indices do not match");
- }
-
- return Status::OK();
-}
-
} // anonymous namespace
Status RowProjector::Init() {
RETURN_NOT_OK(projector_.Init());
#ifndef NDEBUG
- RETURN_NOT_OK_PREPEND(ProjectionsCompatible(
+ // This method defines what makes (base, projection) schema pairs compatible.
+ // In other words, this method can be thought of as the equivalence relation
+ // on the set of all well-formed (base, projection) schema pairs that
+ // partitions the set into equivalence classes which will have the exact
+ // same projection function code.
+ //
+ // This equivalence relation can be decomposed as:
+ //
+ // ProjectionsCompatible((base1, proj1), (base2, proj2)) :=
+ // WELLFORMED(base1, proj1) &&
+ // WELLFORMED(base2, proj2) &&
+ // PROJEQUALS(base1, base2) &&
+ // PROJEQUALS(proj1, proj2) &&
+ // MAP(base1, proj1) == MAP(base2, proj2)
+ //
+ // where WELLFORMED checks that a projection is well-formed (i.e., a
+ // kudu::RowProjector can be initialized with the schema pair), PROJEQUAL
+ // is a relaxed version of the Schema::Equals() operator that is
+ // independent of column names and column IDs, and MAP addresses
+ // the actual dependency on column identification - which is the effect
+ // that those attributes have on the RowProjector's mapping (i.e., different
+ // names and IDs are ok, so long as the mapping is the same). Note that
+ // key columns are not given any special meaning in projection. Physical
types
+ // and nullability of columns must be exactly equal between the two
+ // schema pairs.
+ //
+ // Status::OK corresponds to true in the equivalence relation and other
+ // statuses correspond to false, explaining why the projections are
+ // incompatible.
+ auto compat_check = [](const Schema& base1, const Schema& proj1,
+ const Schema& base2, const Schema& proj2) {
+ kudu::RowProjector rp1(&base1, &proj1), rp2(&base2, &proj2);
+ RETURN_NOT_OK_PREPEND(rp1.Init(), "(base1, proj1) projection "
+ "schema pair not well formed: ");
+ RETURN_NOT_OK_PREPEND(rp2.Init(), "(base2, proj2) projection "
+ "schema pair not well formed: ");
+
+ if (!ContainerEquals(base1.columns(), base2.columns(),
+ ColumnSchemaEqualsType())) {
+ return Status::IllegalState("base schema types unequal");
+ }
+ if (!ContainerEquals(proj1.columns(), proj2.columns(),
+ ColumnSchemaEqualsType())) {
+ return Status::IllegalState("projection schema types unequal");
+ }
+
+ if (!ContainerEquals(rp1.base_cols_mapping(), rp2.base_cols_mapping())) {
+ return Status::IllegalState("base column mappings do not match");
+ }
+ if (!ContainerEquals(rp1.projection_defaults(),
rp2.projection_defaults())) {
+ return Status::IllegalState("projection default indices do not match");
+ }
+
+ return Status::OK();
+ };
+ RETURN_NOT_OK_PREPEND(compat_check(
*projector_.base_schema(), *projector_.projection(),
functions_->base_schema(), functions_->projection()),
"Codegenned row projector's schemas incompatible "
http://git-wip-us.apache.org/repos/asf/kudu/blob/bad91010/src/kudu/common/wire_protocol.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/wire_protocol.cc b/src/kudu/common/wire_protocol.cc
index 0cc417d..8815a2c 100644
--- a/src/kudu/common/wire_protocol.cc
+++ b/src/kudu/common/wire_protocol.cc
@@ -596,7 +596,7 @@ template<bool IS_NULLABLE, bool IS_VARLEN>
static void CopyColumn(const RowBlock& block, int col_idx,
int dst_col_idx, uint8_t* dst_base,
faststring* indirect_data, const Schema* dst_schema) {
- DCHECK_NOTNULL(dst_schema);
+ DCHECK(dst_schema);
ColumnBlock cblock = block.column_block(col_idx);
size_t row_stride = ContiguousRowHelper::row_size(*dst_schema);
uint8_t* dst = dst_base + dst_schema->column_offset(dst_col_idx);
http://git-wip-us.apache.org/repos/asf/kudu/blob/bad91010/src/kudu/consensus/consensus.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus.cc b/src/kudu/consensus/consensus.cc
index 04abe98..d93c25b 100644
--- a/src/kudu/consensus/consensus.cc
+++ b/src/kudu/consensus/consensus.cc
@@ -52,7 +52,7 @@ ConsensusRound::ConsensusRound(Consensus* consensus,
: consensus_(consensus),
replicate_msg_(replicate_msg),
bound_term_(-1) {
- DCHECK_NOTNULL(replicate_msg_.get());
+ DCHECK(replicate_msg_);
}
void ConsensusRound::NotifyReplicationFinished(const Status& status) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/bad91010/src/kudu/consensus/raft_consensus.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus.cc
b/src/kudu/consensus/raft_consensus.cc
index 77125e1..3b039d3 100644
--- a/src/kudu/consensus/raft_consensus.cc
+++ b/src/kudu/consensus/raft_consensus.cc
@@ -238,7 +238,7 @@ RaftConsensus::RaftConsensus(
term_metric_(metric_entity->FindOrCreateGauge(&METRIC_raft_term,
cmeta->current_term())),
parent_mem_tracker_(std::move(parent_mem_tracker)) {
- DCHECK_NOTNULL(log_.get());
+ DCHECK(log_);
state_.reset(new ReplicaState(options,
peer_uuid,
std::move(cmeta),
http://git-wip-us.apache.org/repos/asf/kudu/blob/bad91010/src/kudu/rpc/rpc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc.cc b/src/kudu/rpc/rpc.cc
index d626a46..64f318d 100644
--- a/src/kudu/rpc/rpc.cc
+++ b/src/kudu/rpc/rpc.cc
@@ -20,7 +20,6 @@
#include <boost/bind.hpp>
#include <string>
-#include "kudu/gutil/basictypes.h"
#include "kudu/gutil/strings/substitute.h"
#include "kudu/rpc/messenger.h"
#include "kudu/rpc/rpc_header.pb.h"
@@ -34,8 +33,8 @@ namespace kudu {
namespace rpc {
bool RpcRetrier::HandleResponse(Rpc* rpc, Status* out_status) {
- ignore_result(DCHECK_NOTNULL(rpc));
- ignore_result(DCHECK_NOTNULL(out_status));
+ DCHECK(rpc);
+ DCHECK(out_status);
// Always retry a TOO_BUSY error.
Status controller_status = controller_.status();