You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 14, 2026. It is now read-only.
I guess that in order to call pin()/unpin() in a control block, the latch must be held, otherwise there is no synchronization with other parts of the code that manually set the pin_cnt of a control block. I have tried to replace pin()/unpin() for latch_acquire()/latch_release() but I was getting some weird runtime error related with lock_elision, maybe this is an architecture issue.
Anyway, maybe a proper implementation of the buffer manager can ignore the pin()/unpin() protocol and rely only on shared latches (rwlock, for example).
void page_cleaner_base::flush_workspace(size_t from, size_t to)
{
if (from - to == 0) {
return;
}
// Flush log to guarantee WAL property
W_COERCE(smlevel_0::log->flush(_clean_lsn));
W_COERCE(smlevel_0::vol->write_many_pages(
_workspace[from].pid, &(_workspace[from]), to - from));
for (size_t i = from; i < to; ++i) {
bf_idx idx = _workspace_cb_indexes[i];
bf_tree_cb_t &cb = _bufferpool->get_cb(idx);
// Assertion below may fail for decoupled cleaner, and it's OK
// w_assert1(i == from || _workspace[i].pid == _workspace[i - 1].pid + 1);
cb.pin();
if (cb._pid == _workspace[i].pid && cb.get_clean_lsn() < _clean_lsn) {
cb.set_clean_lsn(_clean_lsn);
}
cb.unpin();
}
}
I guess that in order to call pin()/unpin() in a control block, the latch must be held, otherwise there is no synchronization with other parts of the code that manually set the pin_cnt of a control block. I have tried to replace pin()/unpin() for latch_acquire()/latch_release() but I was getting some weird runtime error related with lock_elision, maybe this is an architecture issue.
Anyway, maybe a proper implementation of the buffer manager can ignore the pin()/unpin() protocol and rely only on shared latches (rwlock, for example).