You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by zu...@apache.org on 2017/03/06 20:18:03 UTC

[06/38] incubator-quickstep git commit: Provided more info for the OutOfMemory exception.

Provided more info for the OutOfMemory exception.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/4be8e91a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/4be8e91a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/4be8e91a

Branch: refs/heads/reorder-partitioned-hash-join
Commit: 4be8e91a4acddab22f4d71f62b4247863ddc766f
Parents: f5c063a
Author: Zuyu Zhang <zu...@apache.org>
Authored: Thu Feb 23 01:06:37 2017 -0800
Committer: Zuyu Zhang <zu...@apache.org>
Committed: Thu Feb 23 01:06:37 2017 -0800

----------------------------------------------------------------------
 storage/StorageErrors.cpp  |  6 ++++++
 storage/StorageErrors.hpp  | 12 +++++++++++-
 storage/StorageManager.cpp |  2 +-
 3 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4be8e91a/storage/StorageErrors.cpp
----------------------------------------------------------------------
diff --git a/storage/StorageErrors.cpp b/storage/StorageErrors.cpp
index 310ee4c..81bd997 100644
--- a/storage/StorageErrors.cpp
+++ b/storage/StorageErrors.cpp
@@ -41,6 +41,12 @@ FileWriteError::FileWriteError(const std::string &filename)
   message_.append(filename);
 }
 
+OutOfMemory::OutOfMemory(const std::size_t num_slots)
+    : message_("OutOfMemory: The system has run out of memory when allocating ") {
+  message_.append(std::to_string(num_slots));
+  message_.append(" slots");
+}
+
 TupleTooLargeForBlock::TupleTooLargeForBlock(const std::size_t tuple_size)
     : tuple_size_(tuple_size),
       message_("TupleTooLargeForBlock: ") {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4be8e91a/storage/StorageErrors.hpp
----------------------------------------------------------------------
diff --git a/storage/StorageErrors.hpp b/storage/StorageErrors.hpp
index 67a3e42..b87f04e 100644
--- a/storage/StorageErrors.hpp
+++ b/storage/StorageErrors.hpp
@@ -141,9 +141,19 @@ class MalformedBlock : public std::exception {
  **/
 class OutOfMemory : public std::exception {
  public:
+  /**
+   * @brief Constructor.
+   *
+   * @param num_slots The number of slots to allocate.
+   **/
+  explicit OutOfMemory(const std::size_t num_slots);
+
   virtual const char* what() const throw() {
-    return "OutOfMemory: The system has run out of memory";
+    return message_.c_str();
   }
+
+ private:
+  std::string message_;
 };
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4be8e91a/storage/StorageManager.cpp
----------------------------------------------------------------------
diff --git a/storage/StorageManager.cpp b/storage/StorageManager.cpp
index 6f7d38b..783ccfe 100644
--- a/storage/StorageManager.cpp
+++ b/storage/StorageManager.cpp
@@ -757,7 +757,7 @@ void* StorageManager::allocateSlots(const std::size_t num_slots,
 #endif
 
   if (slots == nullptr) {
-    throw OutOfMemory();
+    throw OutOfMemory(num_slots);
   }
 
 #if defined(QUICKSTEP_HAVE_LIBNUMA)