Skip to content

Commit 67b393c

Browse files
authored
Don't call chunk_manager_t::initialize() before transitioning chunk to owned state (#1015)
1 parent dbfc5c1 commit 67b393c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

production/db/inc/memory_manager/memory_structures.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ void chunk_manager_metadata_t::synchronize_allocation_metadata()
148148

149149
void chunk_manager_metadata_t::clear()
150150
{
151+
// NB: We cannot clear the chunk state and version!
151152
shared_lock.clear();
152153
last_allocation_metadata.store({});
153154
std::fill(allocated_slots_bitmap, allocated_slots_bitmap + c_slot_bitmap_size_in_words, 0);

production/db/memory_manager/src/memory_manager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ chunk_offset_t memory_manager_t::allocate_unused_chunk()
103103

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

154155
auto available_chunk_offset = static_cast<chunk_offset_t>(found_index);
155156
chunk_manager_t chunk_manager;
156-
chunk_manager.initialize(available_chunk_offset);
157+
// NB: We cannot call initialize() here because we don't own the chunk yet!
158+
chunk_manager.load(available_chunk_offset);
157159
// REVIEW: the memory manager should call
158160
// update_chunk_allocation_status() directly instead of delegating
159161
// it to chunk_manager_t::allocate_chunk().

0 commit comments

Comments
 (0)