Skip to content

Commit bd47080

Browse files
authored
fix: MakeIterator takes read latch twice in a thread (#663)
Signed-off-by: Alex Chi <[email protected]>
1 parent b7c78db commit bd47080

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/storage/table/table_heap.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ auto TableHeap::MakeIterator() -> TableIterator {
116116

117117
auto page_guard = bpm_->FetchPageRead(last_page_id);
118118
auto page = page_guard.As<TablePage>();
119-
return {this, {first_page_id_, 0}, {last_page_id, page->GetNumTuples()}};
119+
auto num_tuples = page->GetNumTuples();
120+
page_guard.Drop();
121+
return {this, {first_page_id_, 0}, {last_page_id, num_tuples}};
120122
}
121123

122124
auto TableHeap::MakeEagerIterator() -> TableIterator { return {this, {first_page_id_, 0}, {INVALID_PAGE_ID, 0}}; }

0 commit comments

Comments
 (0)