Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary lock in isVisibleNoLock check #4623

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/include/storage/store/node_group_collection.h
Original file line number Diff line number Diff line change
@@ -36,6 +36,9 @@ class NodeGroupCollection {
const auto lock = nodeGroups.lock();
return nodeGroups.getNumGroups(lock);
}
common::node_group_idx_t getNumNodeGroupsNoLock() const {
return nodeGroups.getNumGroupsNoLock();
}
NodeGroup* getNodeGroupNoLock(const common::node_group_idx_t groupIdx) {
KU_ASSERT(nodeGroups.getGroupNoLock(groupIdx)->getNodeGroupIdx() == groupIdx);
return nodeGroups.getGroupNoLock(groupIdx);
2 changes: 1 addition & 1 deletion src/storage/store/node_table.cpp
Original file line number Diff line number Diff line change
@@ -593,7 +593,7 @@ bool NodeTable::isVisible(const Transaction* transaction, offset_t offset) const

bool NodeTable::isVisibleNoLock(const Transaction* transaction, offset_t offset) const {
auto [nodeGroupIdx, offsetInGroup] = StorageUtils::getNodeGroupIdxAndOffsetInChunk(offset);
if (nodeGroupIdx >= nodeGroups->getNumNodeGroups()) {
if (nodeGroupIdx >= nodeGroups->getNumNodeGroupsNoLock()) {
return false;
}
auto* nodeGroup = getNodeGroupNoLock(nodeGroupIdx);