Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Commit

Permalink
Minor refactor and comment changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbutrovich committed Jun 13, 2018
1 parent 0cdcdb3 commit 193f8d7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/catalog/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ Manager &Manager::GetInstance() {
//===--------------------------------------------------------------------===//

void Manager::AddIndirectionArray(
const oid_t &oid, std::shared_ptr<storage::IndirectionArray> location) {
const oid_t oid, std::shared_ptr<storage::IndirectionArray> 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_;
}
Expand Down
4 changes: 0 additions & 4 deletions src/common/container/cuckoo_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ template class CuckooMap<std::shared_ptr<oid_t>, std::shared_ptr<oid_t>>;
// Used in StatementCacheManager
template class CuckooMap<StatementCache *, StatementCache *>;

// Used in InternalTypes
template class CuckooMap<ItemPointer, RWType, ItemPointerHasher,
ItemPointerComparator>;

// Used in TransactionLevelGCManager
template class CuckooMap<oid_t, std::shared_ptr<gc::RecycleStack>>;

Expand Down
4 changes: 2 additions & 2 deletions src/include/catalog/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<storage::IndirectionArray> location);

void DropIndirectionArray(const oid_t &oid);
void DropIndirectionArray(const oid_t oid);

void ClearIndirectionArray(void);

Expand Down
6 changes: 5 additions & 1 deletion src/include/common/container/lock_free_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/include/storage/storage_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<storage::TileGroup> 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<storage::TileGroup> GetTileGroup(const oid_t &oid);
std::shared_ptr<storage::TileGroup> GetTileGroup(const oid_t oid);

void ClearTileGroup(void);

Expand Down
6 changes: 3 additions & 3 deletions src/storage/storage_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<storage::TileGroup> location) {
// do this check first, so that count is not updated yet
if (!tile_group_locator_.Contains(oid)) {
Expand All @@ -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<storage::TileGroup> StorageManager::GetTileGroup(const oid_t &oid) {
std::shared_ptr<storage::TileGroup> StorageManager::GetTileGroup(const oid_t oid) {
std::shared_ptr<storage::TileGroup> location;
if (tile_group_locator_.Find(oid, location)) {
return location;
Expand Down
3 changes: 1 addition & 2 deletions src/storage/tile_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 193f8d7

Please sign in to comment.