quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject [1/2] incubator-quickstep git commit: Provided more info for the OutOfMemory exception. [Forced Update!]
Date Thu, 23 Feb 2017 09:07:00 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/hdfs_text_scan b21c85b6f -> c575048c1 (forced update)


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/hdfs_text_scan
Commit: 4be8e91a4acddab22f4d71f62b4247863ddc766f
Parents: f5c063a
Author: Zuyu Zhang <zuyuz@apache.org>
Authored: Thu Feb 23 01:06:37 2017 -0800
Committer: Zuyu Zhang <zuyuz@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)


Mime
View raw message