You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2019/05/08 18:22:55 UTC

[kudu] branch master updated (7fffbc8 -> 0850930)

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

alexey pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git.


    from 7fffbc8  docs: added contributing section for new third-party dependencies
     new 5c776b0  [master_path_handlers] fix build on macOS
     new 0850930  [easy_json] a small cleanup on templated methods

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/master/master_path_handlers.cc |  7 +++-
 src/kudu/util/easy_json.cc              | 73 ++++++++++++++++-----------------
 2 files changed, 41 insertions(+), 39 deletions(-)


[kudu] 02/02: [easy_json] a small cleanup on templated methods

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 085093081bc8a7a57b52bae0b04d7ee3cf63b755
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Tue May 7 15:59:04 2019 -0700

    [easy_json] a small cleanup on templated methods
    
    This is a small cleanup on the explicit instantiations of template
    methods in EasyJson class.  Relying on the deduction of the template
    arguments by compiler, it's possible to reduce the clutter.
    
    This patch contains no functional changes.
    
    Change-Id: I7a735baaa2352d8572887e4bb764fb5382da2f92
    Reviewed-on: http://gerrit.cloudera.org:8080/13280
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
---
 src/kudu/util/easy_json.cc | 73 ++++++++++++++++++++++------------------------
 1 file changed, 35 insertions(+), 38 deletions(-)

diff --git a/src/kudu/util/easy_json.cc b/src/kudu/util/easy_json.cc
index 9057b50..42d0324 100644
--- a/src/kudu/util/easy_json.cc
+++ b/src/kudu/util/easy_json.cc
@@ -26,6 +26,7 @@
 #include <rapidjson/rapidjson.h>
 #include <rapidjson/stringbuffer.h>
 #include <rapidjson/writer.h>
+// IWYU pragma: no_include <rapidjson/encodings.h>
 
 using rapidjson::SizeType;
 using rapidjson::Value;
@@ -82,18 +83,17 @@ EasyJson& EasyJson::operator=(T val) {
   *value_ = val;
   return *this;
 }
-template EasyJson& EasyJson::operator=<bool>(bool val);
-template EasyJson& EasyJson::operator=<int32_t>(int32_t val);
-template EasyJson& EasyJson::operator=<int64_t>(int64_t val);
-template EasyJson& EasyJson::operator=<uint32_t>(uint32_t val);
-template EasyJson& EasyJson::operator=<uint64_t>(uint64_t val);
-template EasyJson& EasyJson::operator=<double>(double val);
-template<> EasyJson& EasyJson::operator=<const char*>(const char* val) {
+template EasyJson& EasyJson::operator=(bool val);
+template EasyJson& EasyJson::operator=(int32_t val);
+template EasyJson& EasyJson::operator=(int64_t val);
+template EasyJson& EasyJson::operator=(uint32_t val);
+template EasyJson& EasyJson::operator=(uint64_t val);
+template EasyJson& EasyJson::operator=(double val);
+template<> EasyJson& EasyJson::operator=(const char* val) {
   value_->SetString(val, alloc_->allocator());
   return *this;
 }
-template<> EasyJson& EasyJson::operator=<EasyJson::ComplexTypeInitializer>(
-    EasyJson::ComplexTypeInitializer val) {
+template<> EasyJson& EasyJson::operator=(EasyJson::ComplexTypeInitializer val) {
   if (val == kObject) {
     value_->SetObject();
   } else if (val == kArray) {
@@ -123,16 +123,15 @@ template<typename T>
 EasyJson EasyJson::Set(const string& key, T val) {
   return (Get(key) = val);
 }
-template EasyJson EasyJson::Set<bool>(const string& key, bool val);
-template EasyJson EasyJson::Set<int32_t>(const string& key, int32_t val);
-template EasyJson EasyJson::Set<int64_t>(const string& key, int64_t val);
-template EasyJson EasyJson::Set<uint32_t>(const string& key, uint32_t val);
-template EasyJson EasyJson::Set<uint64_t>(const string& key, uint64_t val);
-template EasyJson EasyJson::Set<double>(const string& key, double val);
-template EasyJson EasyJson::Set<const char*>(const string& key, const char* val);
-template EasyJson EasyJson::Set<EasyJson::ComplexTypeInitializer>(
-    const string& key,
-    EasyJson::ComplexTypeInitializer val);
+template EasyJson EasyJson::Set(const string& key, bool val);
+template EasyJson EasyJson::Set(const string& key, int32_t val);
+template EasyJson EasyJson::Set(const string& key, int64_t val);
+template EasyJson EasyJson::Set(const string& key, uint32_t val);
+template EasyJson EasyJson::Set(const string& key, uint64_t val);
+template EasyJson EasyJson::Set(const string& key, double val);
+template EasyJson EasyJson::Set(const string& key, const char* val);
+template EasyJson EasyJson::Set(const string& key,
+                                EasyJson::ComplexTypeInitializer val);
 
 EasyJson EasyJson::Set(int index, const string& val) {
   return (Get(index) = val);
@@ -141,16 +140,15 @@ template<typename T>
 EasyJson EasyJson::Set(int index, T val) {
   return (Get(index) = val);
 }
-template EasyJson EasyJson::Set<bool>(int index, bool val);
-template EasyJson EasyJson::Set<int32_t>(int index, int32_t val);
-template EasyJson EasyJson::Set<int64_t>(int index, int64_t val);
-template EasyJson EasyJson::Set<uint32_t>(int index, uint32_t val);
-template EasyJson EasyJson::Set<uint64_t>(int index, uint64_t val);
-template EasyJson EasyJson::Set<double>(int index, double val);
-template EasyJson EasyJson::Set<const char*>(int index, const char* val);
-template EasyJson EasyJson::Set<EasyJson::ComplexTypeInitializer>(
-    int index,
-    EasyJson::ComplexTypeInitializer val);
+template EasyJson EasyJson::Set(int index, bool val);
+template EasyJson EasyJson::Set(int index, int32_t val);
+template EasyJson EasyJson::Set(int index, int64_t val);
+template EasyJson EasyJson::Set(int index, uint32_t val);
+template EasyJson EasyJson::Set(int index, uint64_t val);
+template EasyJson EasyJson::Set(int index, double val);
+template EasyJson EasyJson::Set(int index, const char* val);
+template EasyJson EasyJson::Set(int index,
+                                EasyJson::ComplexTypeInitializer val);
 
 EasyJson EasyJson::PushBack(const string& val) {
   if (!value_->IsArray()) {
@@ -168,13 +166,13 @@ EasyJson EasyJson::PushBack(T val) {
   value_->PushBack(val, alloc_->allocator());
   return EasyJson(&(*value_)[value_->Size() - 1], alloc_);
 }
-template EasyJson EasyJson::PushBack<bool>(bool val);
-template EasyJson EasyJson::PushBack<int32_t>(int32_t val);
-template EasyJson EasyJson::PushBack<int64_t>(int64_t val);
-template EasyJson EasyJson::PushBack<uint32_t>(uint32_t val);
-template EasyJson EasyJson::PushBack<uint64_t>(uint64_t val);
-template EasyJson EasyJson::PushBack<double>(double val);
-template<> EasyJson EasyJson::PushBack<const char*>(const char* val) {
+template EasyJson EasyJson::PushBack(bool val);
+template EasyJson EasyJson::PushBack(int32_t val);
+template EasyJson EasyJson::PushBack(int64_t val);
+template EasyJson EasyJson::PushBack(uint32_t val);
+template EasyJson EasyJson::PushBack(uint64_t val);
+template EasyJson EasyJson::PushBack(double val);
+template<> EasyJson EasyJson::PushBack(const char* val) {
   if (!value_->IsArray()) {
     value_->SetArray();
   }
@@ -182,8 +180,7 @@ template<> EasyJson EasyJson::PushBack<const char*>(const char* val) {
   value_->PushBack(push_val, alloc_->allocator());
   return EasyJson(&(*value_)[value_->Size() - 1], alloc_);
 }
-template<> EasyJson EasyJson::PushBack<EasyJson::ComplexTypeInitializer>(
-    EasyJson::ComplexTypeInitializer val) {
+template<> EasyJson EasyJson::PushBack(EasyJson::ComplexTypeInitializer val) {
   if (!value_->IsArray()) {
     value_->SetArray();
   }


[kudu] 01/02: [master_path_handlers] fix build on macOS

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5c776b0fa74c3938849a91c0afc5c9d8a4f40087
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Wed May 8 00:30:33 2019 -0700

    [master_path_handlers] fix build on macOS
    
    A stopgap solution for EasyJson in case when 'size_t' is not the same
    type as 'uint64_t'.  As an alternative, it would be possible to handle
    that in a more generic way in easy_json.cc, but std::enable_if is not
    applicable there.  The option of putting explicit instantiation of
    template member function after its specialization and avoiding
    a warning (-Winstantiation-after-specialization) might be a way to go.
    
    This is a follow-up to fd6155fc00de48d17a65aafd79fbbad584a4f837.
    
    After the patch mentioned above, but prior to this fix, an attempt to
    build on macOS would fail with a linker error like below:
    
    Undefined symbols for architecture x86_64:
      "kudu::EasyJson& kudu::EasyJson::operator=<unsigned long>(unsigned long)", referenced from:
          kudu::master::MasterPathHandlers::HandleTablePage(kudu::WebCallbackRegistry::WebRequest const&, kudu::WebCallbackRegistry::WebResponse*) in master_path_handlers.cc.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    Change-Id: Ica806031be9af6cc31d9654d3eaa7ac98f616420
    Reviewed-on: http://gerrit.cloudera.org:8080/13281
    Tested-by: Kudu Jenkins
    Reviewed-by: Will Berkeley <wd...@gmail.com>
---
 src/kudu/master/master_path_handlers.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/kudu/master/master_path_handlers.cc b/src/kudu/master/master_path_handlers.cc
index a8d81f7..61abf90 100644
--- a/src/kudu/master/master_path_handlers.cc
+++ b/src/kudu/master/master_path_handlers.cc
@@ -328,7 +328,12 @@ void MasterPathHandlers::HandleTablePage(const Webserver::WebRequest& req,
       (*output)["error"] = Substitute("Unable to decode schema: $0", s.ToString());
       return;
     }
-    (*output)["column_count"] = schema.num_columns();
+    // On platforms where !std::is_same<size_t, uint64_t>::value
+    // (e.g., on macOS 'size_t' is a typedef for 'unsigned long',
+    // but 'uint64_t' is a typedef for 'unsigned long long'),
+    // EasyJson does not have appropriate assignment operator defined. Adding
+    // a static_cast<uint64_t> here is a reasonable stopgap for those cases.
+    (*output)["column_count"] = static_cast<uint64_t>(schema.num_columns());
     s = PartitionSchema::FromPB(l.data().pb.partition_schema(), schema, &partition_schema);
     if (!s.ok()) {
       (*output)["error"] =