quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject incubator-quickstep git commit: More informative error for BlockNotFound exception for debugging
Date Wed, 18 Apr 2018 19:41:14 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master 502960d06 -> 571e00907


More informative error for BlockNotFound exception for debugging


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

Branch: refs/heads/master
Commit: 571e00907fc416a490e20421853246efa21d80a8
Parents: 502960d
Author: Harshad Deshmukh <hbdeshmukh@apache.org>
Authored: Tue Apr 17 11:17:58 2018 -0500
Committer: Harshad Deshmukh <hbdeshmukh@apache.org>
Committed: Wed Apr 18 11:59:39 2018 -0500

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


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/571e0090/storage/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt
index fb09e49..e67269f 100644
--- a/storage/CMakeLists.txt
+++ b/storage/CMakeLists.txt
@@ -997,6 +997,8 @@ target_link_libraries(quickstep_storage_StorageBlockLayout
                       quickstep_storage_SubBlockTypeRegistry
                       quickstep_utility_Macros
                       ${PROTOBUF_LIBRARY})
+target_link_libraries(quickstep_storage_StorageErrors
+                      quickstep_storage_StorageBlockInfo)
 target_link_libraries(quickstep_storage_StorageBlockLayout_proto
                       ${PROTOBUF_LIBRARY})
 target_link_libraries(quickstep_storage_StorageManager

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/571e0090/storage/StorageErrors.hpp
----------------------------------------------------------------------
diff --git a/storage/StorageErrors.hpp b/storage/StorageErrors.hpp
index b87f04e..fbd4f76 100644
--- a/storage/StorageErrors.hpp
+++ b/storage/StorageErrors.hpp
@@ -24,6 +24,8 @@
 #include <exception>
 #include <string>
 
+#include "storage/StorageBlockInfo.hpp"
+
 namespace quickstep {
 
 /** \addtogroup Storage
@@ -61,9 +63,17 @@ class BlockMemoryTooSmall : public std::exception {
  **/
 class BlockNotFoundInMemory : public std::exception {
  public:
+  explicit BlockNotFoundInMemory(block_id id) {
+      message_ =  "BlockNotFoundInMemory: The block with ID "
+          + BlockIdUtil::ToString(id) + " was not found in memory";
+  }
+
   virtual const char* what() const throw() {
-    return "BlockNotFoundInMemory: The specified block was not found in memory";
+    return message_.c_str();
   }
+
+ private:
+  std::string message_;
 };
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/571e0090/storage/StorageManager.cpp
----------------------------------------------------------------------
diff --git a/storage/StorageManager.cpp b/storage/StorageManager.cpp
index 8f17455..e2efebf 100644
--- a/storage/StorageManager.cpp
+++ b/storage/StorageManager.cpp
@@ -428,7 +428,7 @@ void StorageManager::evictBlockOrBlob(const block_id block) {
 
     std::unordered_map<block_id, BlockHandle>::iterator block_it = blocks_.find(block);
     if (block_it == blocks_.end()) {
-      throw BlockNotFoundInMemory();
+      throw BlockNotFoundInMemory(block);
     }
     handle = block_it->second;
     blocks_.erase(block_it);


Mime
View raw message