You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mz...@apache.org on 2019/08/27 20:36:08 UTC

[mesos] branch 1.9.x updated: Revert "Updated the boost library." and depedent commits.

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

mzhu pushed a commit to branch 1.9.x
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/1.9.x by this push:
     new 7475bf3  Revert "Updated the boost library." and depedent commits.
7475bf3 is described below

commit 7475bf39314554975b9cf1487cc59f09c3deaa99
Author: Meng Zhu <mz...@mesosphere.io>
AuthorDate: Tue Aug 27 13:22:37 2019 -0700

    Revert "Updated the boost library." and depedent commits.
    
    This reverts commit 25070f232a9bb97d1b78f8a7e5b774bbd50654f9,
    95201cbe4dc87eae2fde5754d16f5effbb6c1974,
    and 73033130de7872c6f240b9b05dced039d7666138.
---
 3rdparty/boost-1.65.0.tar.gz          | Bin 1202770 -> 1814636 bytes
 3rdparty/boost.md                     |   2 +-
 3rdparty/cmake/Versions.cmake         |   2 +-
 include/mesos/resource_quantities.hpp |  33 +++++++++++----------------------
 include/mesos/resources.hpp           |  20 ++++++++------------
 include/mesos/v1/resources.hpp        |  20 ++++++++------------
 src/common/resource_quantities.cpp    |  34 ++++++++++++++++++++++++----------
 7 files changed, 53 insertions(+), 58 deletions(-)

diff --git a/3rdparty/boost-1.65.0.tar.gz b/3rdparty/boost-1.65.0.tar.gz
index b09d185..e9f02d7 100644
Binary files a/3rdparty/boost-1.65.0.tar.gz and b/3rdparty/boost-1.65.0.tar.gz differ
diff --git a/3rdparty/boost.md b/3rdparty/boost.md
index d6e482f..e6373f2 100644
--- a/3rdparty/boost.md
+++ b/3rdparty/boost.md
@@ -34,7 +34,7 @@ See: http://www.boost.org/doc/libs/1_65_0/tools/bcp/doc/html/index.html
 # Update 3rdparty/cmake/Versions.cmake with the new version and
 #  its SHA-256 hash. You can obtain the hash as follows, make sure
 #  to do this on the stripped release:
-  $ openssl sha256 3rdparty/boost-1.65.0.tar.gz
+  $ openssl sha -sha256 3rdparty/boost-1.65.0.tar.gz
 
 
 # Update this README if needed.
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index 9376616..0788e61 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -1,5 +1,5 @@
 set(BOOST_VERSION           "1.65.0")
-set(BOOST_HASH              "SHA256=607a5ce234ba8bdf30764eec233fd91211c0228e4cb6bd3f389e6f269bd9aea2")
+set(BOOST_HASH              "SHA256=0442df595dc56e7da11665120ce9d92ec40c192eb060488131b346bac0938ba3")
 set(CONCURRENTQUEUE_VERSION "7b69a8f")
 set(CONCURRENTQUEUE_HASH    "SHA256=B2741A1FB2172C2A829503A85D5EE7548BE7ED04236A3FD1EFD2B6088E065CB7")
 set(CSI_V0_VERSION          "0.2.0")
diff --git a/include/mesos/resource_quantities.hpp b/include/mesos/resource_quantities.hpp
index 8195d5e..cdb3427 100644
--- a/include/mesos/resource_quantities.hpp
+++ b/include/mesos/resource_quantities.hpp
@@ -19,8 +19,7 @@
 
 #include <string>
 #include <utility>
-
-#include <boost/container/small_vector.hpp>
+#include <vector>
 
 #include <mesos/mesos.hpp>
 
@@ -119,10 +118,10 @@ public:
   ResourceQuantities& operator=(const ResourceQuantities& that) = default;
   ResourceQuantities& operator=(ResourceQuantities&& that) = default;
 
-  typedef boost::container::small_vector_base<
-      std::pair<std::string, Value::Scalar> >::const_iterator iterator;
-  typedef boost::container::small_vector_base<
-      std::pair<std::string, Value::Scalar> >::const_iterator const_iterator;
+  typedef std::vector<std::pair<std::string, Value::Scalar>>::const_iterator
+    iterator;
+  typedef std::vector<std::pair<std::string, Value::Scalar>>::const_iterator
+    const_iterator;
 
   // NOTE: Non-`const` `iterator`, `begin()` and `end()` are __intentionally__
   // defined with `const` semantics in order to prevent mutation during
@@ -160,12 +159,7 @@ private:
 
   // List of name quantity pairs sorted by name.
   // Arithmetic and comparison operations benefit from this sorting.
-  //
-  // Pre-allocate space for first-class resources, plus some margins.
-  // This needs to be updated as introduce more first-class resources.
-  // [cpus, disk, gpus, mem, ports]
-  boost::container::small_vector<std::pair<std::string, Value::Scalar>, 7>
-    quantities;
+  std::vector<std::pair<std::string, Value::Scalar>> quantities;
 };
 
 
@@ -218,10 +212,10 @@ public:
   ResourceLimits& operator=(const ResourceLimits& that) = default;
   ResourceLimits& operator=(ResourceLimits&& that) = default;
 
-  typedef boost::container::small_vector_base<
-      std::pair<std::string, Value::Scalar> >::const_iterator iterator;
-  typedef boost::container::small_vector_base<
-      std::pair<std::string, Value::Scalar> >::const_iterator const_iterator;
+  typedef std::vector<std::pair<std::string, Value::Scalar>>::const_iterator
+    iterator;
+  typedef std::vector<std::pair<std::string, Value::Scalar>>::const_iterator
+    const_iterator;
 
   // NOTE: Non-`const` `iterator`, `begin()` and `end()` are __intentionally__
   // defined with `const` semantics in order to prevent mutation during
@@ -264,12 +258,7 @@ private:
 
   // List of name limit pairs sorted by name.
   // Arithmetic and comparison operations benefit from this sorting.
-  //
-  // Pre-allocate space for first-class resources, plus some margins.
-  // This needs to be updated as introduce more first-class resources.
-  // [cpus, disk, gpus, mem, ports]
-  boost::container::small_vector<std::pair<std::string, Value::Scalar>, 7>
-    limits;
+  std::vector<std::pair<std::string, Value::Scalar>> limits;
 };
 
 
diff --git a/include/mesos/resources.hpp b/include/mesos/resources.hpp
index b8aef28..e5e87a0 100644
--- a/include/mesos/resources.hpp
+++ b/include/mesos/resources.hpp
@@ -23,7 +23,6 @@
 #include <string>
 #include <vector>
 
-#include <boost/container/small_vector.hpp>
 #include <boost/iterator/indirect_iterator.hpp>
 
 #include <google/protobuf/repeated_field.h>
@@ -631,19 +630,21 @@ public:
   // iterators to prevent mutable access to the `Resource` objects.
 
   typedef boost::indirect_iterator<
-      boost::container::small_vector_base<Resource_Unsafe>::const_iterator>
+      std::vector<Resource_Unsafe>::const_iterator>
     const_iterator;
 
   const_iterator begin()
   {
-    const auto& self = *this;
-    return self.begin();
+    return static_cast<const std::vector<Resource_Unsafe>&>(
+               resourcesNoMutationWithoutExclusiveOwnership)
+      .begin();
   }
 
   const_iterator end()
   {
-    const auto& self = *this;
-    return self.end();
+    return static_cast<const std::vector<Resource_Unsafe>&>(
+               resourcesNoMutationWithoutExclusiveOwnership)
+      .end();
   }
 
   const_iterator begin() const
@@ -753,12 +754,7 @@ private:
   //
   // TODO(mzhu): Consider using `boost::intrusive_ptr` for
   // possibly better performance.
-  //
-  // We chose a size of 15 based on the fact that we have five first class
-  // resources (cpu, mem, disk, gpu and port). And 15 would allow one set of
-  // unreserved resources and two sets of reservations.
-  boost::container::small_vector<Resource_Unsafe, 15>
-    resourcesNoMutationWithoutExclusiveOwnership;
+  std::vector<Resource_Unsafe> resourcesNoMutationWithoutExclusiveOwnership;
 };
 
 
diff --git a/include/mesos/v1/resources.hpp b/include/mesos/v1/resources.hpp
index 3fbe7fb..6a9751a 100644
--- a/include/mesos/v1/resources.hpp
+++ b/include/mesos/v1/resources.hpp
@@ -23,7 +23,6 @@
 #include <string>
 #include <vector>
 
-#include <boost/container/small_vector.hpp>
 #include <boost/iterator/indirect_iterator.hpp>
 
 #include <google/protobuf/repeated_field.h>
@@ -626,19 +625,21 @@ public:
   // iterators to prevent mutable access to the `Resource` objects.
 
   typedef boost::indirect_iterator<
-      boost::container::small_vector_base<Resource_Unsafe>::const_iterator>
+      std::vector<Resource_Unsafe>::const_iterator>
     const_iterator;
 
   const_iterator begin()
   {
-    const auto& self = *this;
-    return self.begin();
+    return static_cast<const std::vector<Resource_Unsafe>&>(
+               resourcesNoMutationWithoutExclusiveOwnership)
+      .begin();
   }
 
   const_iterator end()
   {
-    const auto& self = *this;
-    return self.end();
+    return static_cast<const std::vector<Resource_Unsafe>&>(
+               resourcesNoMutationWithoutExclusiveOwnership)
+      .end();
   }
 
   const_iterator begin() const
@@ -748,12 +749,7 @@ private:
   //
   // TODO(mzhu): Consider using `boost::intrusive_ptr` for
   // possibly better performance.
-  //
-  // We chose a size of 15 based on the fact that we have five first class
-  // resources (cpu, mem, disk, gpu and port). And 15 would allow one set of
-  // unreserved resources and two sets of reservations.
-  boost::container::small_vector<Resource_Unsafe, 15>
-    resourcesNoMutationWithoutExclusiveOwnership;
+  std::vector<Resource_Unsafe> resourcesNoMutationWithoutExclusiveOwnership;
 };
 
 
diff --git a/src/common/resource_quantities.cpp b/src/common/resource_quantities.cpp
index 8f487fb..7c7ede3 100644
--- a/src/common/resource_quantities.cpp
+++ b/src/common/resource_quantities.cpp
@@ -131,7 +131,12 @@ ResourceQuantities ResourceQuantities::fromResources(const Resources& resources)
 }
 
 
-ResourceQuantities::ResourceQuantities() {}
+ResourceQuantities::ResourceQuantities()
+{
+  // Pre-reserve space for first-class resources.
+  // [cpus, disk, gpus, mem, ports]
+  quantities.reserve(5u);
+}
 
 
 ResourceQuantities::ResourceQuantities(
@@ -147,15 +152,17 @@ ResourceQuantities::ResourceQuantities(
 
 ResourceQuantities::const_iterator ResourceQuantities::begin()
 {
-  const auto& self = *this;
-  return self.begin();
+  return static_cast<const std::vector<std::pair<std::string, Value::Scalar>>&>(
+             quantities)
+    .begin();
 }
 
 
 ResourceQuantities::const_iterator ResourceQuantities::end()
 {
-  const auto& self = *this;
-  return self.end();
+  return static_cast<const std::vector<std::pair<std::string, Value::Scalar>>&>(
+             quantities)
+    .end();
 }
 
 
@@ -400,7 +407,12 @@ Try<ResourceLimits> ResourceLimits::fromString(const string& text)
 }
 
 
-ResourceLimits::ResourceLimits() {}
+ResourceLimits::ResourceLimits()
+{
+  // Pre-reserve space for first-class resources.
+  // [cpus, disk, gpus, mem, ports]
+  limits.reserve(5u);
+}
 
 
 ResourceLimits::ResourceLimits(
@@ -416,15 +428,17 @@ ResourceLimits::ResourceLimits(
 
 ResourceLimits::const_iterator ResourceLimits::begin()
 {
-  const auto& self = *this;
-  return self.begin();
+  return static_cast<const std::vector<std::pair<std::string, Value::Scalar>>&>(
+           limits)
+    .begin();
 }
 
 
 ResourceLimits::const_iterator ResourceLimits::end()
 {
-  const auto& self = *this;
-  return self.end();
+  return static_cast<const std::vector<std::pair<std::string, Value::Scalar>>&>(
+           limits)
+    .end();
 }