Skip to content

Commit

Permalink
Don't call chunk_manager_t::initialize() before transitioning chunk t…
Browse files Browse the repository at this point in the history
…o owned state (#1015)
  • Loading branch information
senderista authored Oct 14, 2021
1 parent dbfc5c1 commit 67b393c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions production/db/inc/memory_manager/memory_structures.inc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ void chunk_manager_metadata_t::synchronize_allocation_metadata()

void chunk_manager_metadata_t::clear()
{
// NB: We cannot clear the chunk state and version!
shared_lock.clear();
last_allocation_metadata.store({});
std::fill(allocated_slots_bitmap, allocated_slots_bitmap + c_slot_bitmap_size_in_words, 0);
Expand Down
6 changes: 4 additions & 2 deletions production/db/memory_manager/src/memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ chunk_offset_t memory_manager_t::allocate_unused_chunk()

// Now try to claim this chunk.
chunk_manager_t chunk_manager;
chunk_manager.initialize(allocated_chunk_offset);
// NB: We cannot call initialize() here because we don't own the chunk yet!
chunk_manager.load(allocated_chunk_offset);
// REVIEW: the memory manager should call
// update_chunk_allocation_status() directly instead of delegating
// it to chunk_manager_t::allocate_chunk().
Expand Down Expand Up @@ -153,7 +154,8 @@ chunk_offset_t memory_manager_t::allocate_used_chunk()

auto available_chunk_offset = static_cast<chunk_offset_t>(found_index);
chunk_manager_t chunk_manager;
chunk_manager.initialize(available_chunk_offset);
// NB: We cannot call initialize() here because we don't own the chunk yet!
chunk_manager.load(available_chunk_offset);
// REVIEW: the memory manager should call
// update_chunk_allocation_status() directly instead of delegating
// it to chunk_manager_t::allocate_chunk().
Expand Down

0 comments on commit 67b393c

Please sign in to comment.