| 5366 | } |
| 5367 | |
| 5368 | inline BufferDesc* BCBHashTable::find(const PageNumber& page) const |
| 5369 | { |
| 5370 | auto& list = m_chains[hash(page)]; |
| 5371 | |
| 5372 | #ifndef HASH_USE_CDS_LIST |
| 5373 | QUE que_inst = list.que_forward; |
| 5374 | for (; que_inst != &list; que_inst = que_inst->que_forward) |
| 5375 | { |
| 5376 | BufferDesc* bdb = BLOCK(que_inst, BufferDesc, bdb_que); |
| 5377 | if (bdb->bdb_page == page) |
| 5378 | return bdb; |
| 5379 | } |
| 5380 | |
| 5381 | #else // HASH_USE_CDS_LIST |
| 5382 | auto ptr = list.get(page); |
| 5383 | if (!ptr.empty()) |
| 5384 | { |
| 5385 | fb_assert(ptr->second != nullptr); |
| 5386 | #ifdef DEV_BUILD |
| 5387 | // Original libcds have no update(key, value), use this code with it, |
| 5388 | // see also comment in get_buffer() |
| 5389 | while (ptr->second == nullptr) |
| 5390 | cds::backoff::pause(); |
| 5391 | #endif |
| 5392 | if (ptr->second->bdb_page == page) |
| 5393 | return ptr->second; |
| 5394 | } |
| 5395 | #endif |
| 5396 | |
| 5397 | return nullptr; |
| 5398 | } |
| 5399 | |
| 5400 | inline BufferDesc* BCBHashTable::emplace(BufferDesc* bdb, const PageNumber& page, bool remove) |
| 5401 | { |
no test coverage detected