kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject kudu git commit: move HashAlgorithm from common.proto to hash.proto
Date Fri, 02 Nov 2018 21:07:22 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 137775bdd -> 6548ea5b2


move HashAlgorithm from common.proto to hash.proto

Commit 8af288a26 added a dependency from the bloom filter code onto common,
creating a circular dependency. Normally that's caught by cmake, but the
commit didn't actually establish the util->common dependency in cmake, which
meant that the underlying parallelism of the build (and whether it was a
clean or incremental build) dictated whether common.pb.h was present on-disk
at the time that bloom_filter.h was included.

This patch resolves the circular dependency by moving the HashAlgorithm enum
out of common.proto and into a new hash.proto within util. An alternative
would be to move the bloom filter code itself into common, but as it isn't
specific to Kudu, I think util is a better home for it.

Change-Id: I2b0a4077335de75dfed6aa1c6d78d9e197250976
Reviewed-on: http://gerrit.cloudera.org:8080/11865
Reviewed-by: Grant Henke <granthenke@apache.org>
Reviewed-by: Andrew Wong <awong@cloudera.com>
Tested-by: Adar Dembo <adar@cloudera.com>


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

Branch: refs/heads/master
Commit: 6548ea5b22dee052cee80f328f1afdbdf0ab15f4
Parents: 137775b
Author: Adar Dembo <adar@cloudera.com>
Authored: Fri Nov 2 11:45:16 2018 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Fri Nov 2 21:06:57 2018 +0000

----------------------------------------------------------------------
 src/kudu/common/CMakeLists.txt |  8 ++++----
 src/kudu/common/common.proto   |  8 +-------
 src/kudu/util/CMakeLists.txt   | 29 ++++++++++++++++++++++-------
 src/kudu/util/bloom_filter.h   |  2 +-
 src/kudu/util/hash.proto       | 27 +++++++++++++++++++++++++++
 5 files changed, 55 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/6548ea5b/src/kudu/common/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/common/CMakeLists.txt b/src/kudu/common/CMakeLists.txt
index 1517f19..fd8d64f 100644
--- a/src/kudu/common/CMakeLists.txt
+++ b/src/kudu/common/CMakeLists.txt
@@ -22,7 +22,7 @@ PROTOBUF_GENERATE_CPP(
   PROTO_FILES common.proto)
 ADD_EXPORTABLE_LIBRARY(kudu_common_proto
   SRCS ${COMMON_PROTO_SRCS}
-  DEPS pb_util_proto protobuf util_compression_proto
+  DEPS hash_proto pb_util_proto protobuf util_compression_proto
   NONLINK_DEPS ${COMMON_PROTO_TGTS})
 
 PROTOBUF_GENERATE_CPP(
@@ -68,11 +68,11 @@ if ("${COMPILER_FAMILY}" STREQUAL "clang")
 endif()
 
 set(COMMON_LIBS
-  kudu_common_proto
   consensus_metadata_proto
-  wire_protocol_proto
+  gutil
+  kudu_common_proto
   kudu_util
-  gutil)
+  wire_protocol_proto)
 
 ADD_EXPORTABLE_LIBRARY(kudu_common
   SRCS ${COMMON_SRCS}

http://git-wip-us.apache.org/repos/asf/kudu/blob/6548ea5b/src/kudu/common/common.proto
----------------------------------------------------------------------
diff --git a/src/kudu/common/common.proto b/src/kudu/common/common.proto
index f0e9a33..ceb281d 100644
--- a/src/kudu/common/common.proto
+++ b/src/kudu/common/common.proto
@@ -29,6 +29,7 @@ package kudu;
 option java_package = "org.apache.kudu";
 
 import "kudu/util/compression/compression.proto";
+import "kudu/util/hash.proto";
 import "kudu/util/pb_util.proto";
 
 // If you add a new type keep in mind to add it to the end
@@ -285,13 +286,6 @@ enum ReplicaSelection {
   CLOSEST_REPLICA = 2;
 }
 
-// The hash algorithm used in bloom filter and hash bucket.
-enum HashAlgorithm {
-  UNKNOWN_HASH = 0;
-  MURMUR_HASH_2 = 1;
-  CITY_HASH = 2;
-}
-
 // The serialized format of a Kudu table partition schema.
 message PartitionSchemaPB {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/6548ea5b/src/kudu/util/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/util/CMakeLists.txt b/src/kudu/util/CMakeLists.txt
index 105b7ff..bf66dd8 100644
--- a/src/kudu/util/CMakeLists.txt
+++ b/src/kudu/util/CMakeLists.txt
@@ -30,6 +30,20 @@ ADD_EXPORTABLE_LIBRARY(util_compression_proto
   NONLINK_DEPS ${UTIL_COMPRESSION_PROTO_TGTS})
 
 #######################################
+# hash_proto
+#######################################
+
+PROTOBUF_GENERATE_CPP(
+  HASH_PROTO_SRCS HASH_PROTO_HDRS HASH_PROTO_TGTS
+  SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..
+  BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/../..
+  PROTO_FILES hash.proto)
+ADD_EXPORTABLE_LIBRARY(hash_proto
+  SRCS ${HASH_PROTO_SRCS}
+  DEPS protobuf
+  NONLINK_DEPS ${HASH_PROTO_TGTS})
+
+#######################################
 # histogram_proto
 #######################################
 
@@ -48,14 +62,14 @@ ADD_EXPORTABLE_LIBRARY(histogram_proto
 #######################################
 
 PROTOBUF_GENERATE_CPP(
-    MAINTENANCE_MANAGER_PROTO_SRCS MAINTENANCE_MANAGER_PROTO_HDRS MAINTENANCE_MANAGER_PROTO_TGTS
-    SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..
-    BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/../..
-    PROTO_FILES maintenance_manager.proto)
+  MAINTENANCE_MANAGER_PROTO_SRCS MAINTENANCE_MANAGER_PROTO_HDRS MAINTENANCE_MANAGER_PROTO_TGTS
+  SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..
+  BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/../..
+  PROTO_FILES maintenance_manager.proto)
 ADD_EXPORTABLE_LIBRARY(maintenance_manager_proto
-    SRCS ${MAINTENANCE_MANAGER_PROTO_SRCS}
-    DEPS protobuf
-    NONLINK_DEPS ${MAINTENANCE_MANAGER_PROTO_TGTS})
+  SRCS ${MAINTENANCE_MANAGER_PROTO_SRCS}
+  DEPS protobuf
+  NONLINK_DEPS ${MAINTENANCE_MANAGER_PROTO_TGTS})
 
 #######################################
 # pb_util_proto
@@ -220,6 +234,7 @@ set(UTIL_LIBS
   gflags
   glog
   gutil
+  hash_proto
   histogram_proto
   libev
   maintenance_manager_proto

http://git-wip-us.apache.org/repos/asf/kudu/blob/6548ea5b/src/kudu/util/bloom_filter.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/bloom_filter.h b/src/kudu/util/bloom_filter.h
index 0905fda..d395646 100644
--- a/src/kudu/util/bloom_filter.h
+++ b/src/kudu/util/bloom_filter.h
@@ -20,12 +20,12 @@
 #include <cstddef>
 #include <cstdint>
 
-#include "kudu/common/common.pb.h"
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/hash/city.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
 #include "kudu/util/bitmap.h"
+#include "kudu/util/hash.pb.h"
 #include "kudu/util/hash_util.h"
 #include "kudu/util/slice.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/6548ea5b/src/kudu/util/hash.proto
----------------------------------------------------------------------
diff --git a/src/kudu/util/hash.proto b/src/kudu/util/hash.proto
new file mode 100644
index 0000000..8a4ea28
--- /dev/null
+++ b/src/kudu/util/hash.proto
@@ -0,0 +1,27 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+syntax = "proto2";
+package kudu;
+
+option java_package = "org.apache.kudu";
+
+// Implemented hash algorithms.
+enum HashAlgorithm {
+  UNKNOWN_HASH = 0;
+  MURMUR_HASH_2 = 1;
+  CITY_HASH = 2;
+}


Mime
View raw message