mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 03:52:15 +00:00
fix race + assert
This commit is contained in:
parent
c0975b4031
commit
8cd434fb15
@ -342,18 +342,19 @@ void CacheDictionary::prepareAnswer(
|
||||
PresentIdHandler && on_cell_updated,
|
||||
AbsentIdHandler && on_id_not_found) const
|
||||
{
|
||||
const ProfilingScopedWriteRWLock write_lock{rw_lock, ProfileEvents::DictCacheLockWriteNs};
|
||||
|
||||
/// Prepare answer
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
|
||||
for (const auto & id : update_unit_ptr->requested_ids)
|
||||
{
|
||||
const auto find_result = findCellIdx(id, now);
|
||||
assert(find_result.valid);
|
||||
const auto & cell_idx = find_result.cell_idx;
|
||||
auto & cell = cells[cell_idx];
|
||||
const auto was_id_updated = update_unit_ptr->found_ids_mask_ptr->at(id);
|
||||
|
||||
const ProfilingScopedWriteRWLock write_lock{rw_lock, ProfileEvents::DictCacheLockWriteNs};
|
||||
|
||||
if (was_id_updated)
|
||||
{
|
||||
on_cell_updated(id, find_result.cell_idx);
|
||||
|
Loading…
Reference in New Issue
Block a user