From 193f8d79f22423bad4974a41e88279614382bab6 Mon Sep 17 00:00:00 2001 From: mbutrovich Date: Wed, 13 Jun 2018 13:22:23 -0400 Subject: [PATCH] Minor refactor and comment changes. --- src/catalog/manager.cpp | 4 ++-- src/common/container/cuckoo_map.cpp | 4 ---- src/include/catalog/manager.h | 4 ++-- src/include/common/container/lock_free_array.h | 6 +++++- src/include/storage/storage_manager.h | 8 ++++---- src/storage/storage_manager.cpp | 6 +++--- src/storage/tile_group.cpp | 3 +-- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/catalog/manager.cpp b/src/catalog/manager.cpp index ebf723b78c9..4795673b7c6 100644 --- a/src/catalog/manager.cpp +++ b/src/catalog/manager.cpp @@ -33,12 +33,12 @@ Manager &Manager::GetInstance() { //===--------------------------------------------------------------------===// void Manager::AddIndirectionArray( - const oid_t &oid, std::shared_ptr location) { + const oid_t oid, std::shared_ptr location) { // add/update the catalog reference to the indirection array auto ret = indirection_array_locator_[oid] = location; } -void Manager::DropIndirectionArray(const oid_t &oid) { +void Manager::DropIndirectionArray(const oid_t oid) { // drop the catalog reference to the tile group indirection_array_locator_[oid] = empty_indirection_array_; } diff --git a/src/common/container/cuckoo_map.cpp b/src/common/container/cuckoo_map.cpp index ea375361070..72bb1505f7a 100644 --- a/src/common/container/cuckoo_map.cpp +++ b/src/common/container/cuckoo_map.cpp @@ -128,10 +128,6 @@ template class CuckooMap, std::shared_ptr>; // Used in StatementCacheManager template class CuckooMap; -// Used in InternalTypes -template class CuckooMap; - // Used in TransactionLevelGCManager template class CuckooMap>; diff --git a/src/include/catalog/manager.h b/src/include/catalog/manager.h index bf4698fb83d..db39dca80d5 100644 --- a/src/include/catalog/manager.h +++ b/src/include/catalog/manager.h @@ -52,10 +52,10 @@ class Manager { oid_t GetCurrentIndirectionArrayId() { return indirection_array_oid_; } - void AddIndirectionArray(const oid_t &oid, + void AddIndirectionArray(const oid_t oid, std::shared_ptr location); - void DropIndirectionArray(const oid_t &oid); + void DropIndirectionArray(const oid_t oid); void ClearIndirectionArray(void); diff --git a/src/include/common/container/lock_free_array.h b/src/include/common/container/lock_free_array.h index 1f84cba372a..29c0b0c7951 100644 --- a/src/include/common/container/lock_free_array.h +++ b/src/include/common/container/lock_free_array.h @@ -63,7 +63,11 @@ class LockFreeArray { // Exists ? bool Contains(const ValueType &value); - // Find offset of an element + /** + * Finds the offset of an element given its value + * @param value Element to search the array for + * @return -1 if element not found, offset of element otherwise + */ ssize_t Lookup(const ValueType &value); private: diff --git a/src/include/storage/storage_manager.h b/src/include/storage/storage_manager.h index ff68935e24b..cf123d69ada 100644 --- a/src/include/storage/storage_manager.h +++ b/src/include/storage/storage_manager.h @@ -106,27 +106,27 @@ class StorageManager { oid_t GetNumLiveTileGroups() const { return num_live_tile_groups_.load(); } - void SetNextTileGroupId(const oid_t &next_oid) { tile_group_oid_ = next_oid; } + void SetNextTileGroupId(const oid_t next_oid) { tile_group_oid_ = next_oid; } /** * @brief Adds/updates the TileGroup in Manager's oid->TileGroup* map * @param oid[in] Global oid of the TileGroup to be added/updated * @param location[in] Smart pointer to the TileGroup to be registered */ - void AddTileGroup(const oid_t &oid, + void AddTileGroup(const oid_t oid, std::shared_ptr location); /** * @brief Removes the TileGroup from Manager's oid->TileGroup* map * @param oid[in] Global oid of the TileGroup to be removed */ - void DropTileGroup(const oid_t &oid); + void DropTileGroup(const oid_t oid); /** * @brief Gets a smart pointer to a TileGroup based on its global oid * @param oid[in] Global oid of the TileGroup to be accessed * @return Smart pointer to the TileGroup. Can be nullptr if TileGroup * does not exist in the Manager's map (for example: TileGroup dropped) */ - std::shared_ptr GetTileGroup(const oid_t &oid); + std::shared_ptr GetTileGroup(const oid_t oid); void ClearTileGroup(void); diff --git a/src/storage/storage_manager.cpp b/src/storage/storage_manager.cpp index 43e8796c198..f36cccde3b0 100644 --- a/src/storage/storage_manager.cpp +++ b/src/storage/storage_manager.cpp @@ -121,7 +121,7 @@ bool StorageManager::RemoveDatabaseFromStorageManager(oid_t database_oid) { // OBJECT MAP //===--------------------------------------------------------------------===// -void StorageManager::AddTileGroup(const oid_t &oid, +void StorageManager::AddTileGroup(const oid_t oid, std::shared_ptr location) { // do this check first, so that count is not updated yet if (!tile_group_locator_.Contains(oid)) { @@ -131,14 +131,14 @@ void StorageManager::AddTileGroup(const oid_t &oid, tile_group_locator_.Upsert(oid, location); } -void StorageManager::DropTileGroup(const oid_t &oid) { +void StorageManager::DropTileGroup(const oid_t oid) { // drop the catalog reference to the tile group if (tile_group_locator_.Erase(oid)) { num_live_tile_groups_.fetch_sub(1); } } -std::shared_ptr StorageManager::GetTileGroup(const oid_t &oid) { +std::shared_ptr StorageManager::GetTileGroup(const oid_t oid) { std::shared_ptr location; if (tile_group_locator_.Find(oid, location)) { return location; diff --git a/src/storage/tile_group.cpp b/src/storage/tile_group.cpp index eb0470bb1bc..17c4cbae432 100644 --- a/src/storage/tile_group.cpp +++ b/src/storage/tile_group.cpp @@ -56,8 +56,7 @@ TileGroup::TileGroup(BackendType backend_type, } TileGroup::~TileGroup() { - // Drop references on all tiles - // LOG_DEBUG("TileGroup %d destructed!", tile_group_id); + LOG_TRACE("TileGroup %d destructed!", tile_group_id); // clean up tile group header delete tile_group_header;