| 997 | } |
| 998 | |
| 999 | void TipCache::endSnapshot(thread_db* tdbb, SnapshotHandle handle, AttNumber attachmentId) |
| 1000 | { |
| 1001 | // Can only be called on initialized TipCache |
| 1002 | fb_assert(m_tpcHeader); |
| 1003 | GlobalTpcHeader* header = m_tpcHeader->getHeader(); |
| 1004 | |
| 1005 | // Lock mutex |
| 1006 | SharedMutexGuard guard(m_snapshots); |
| 1007 | |
| 1008 | // We don't care to perform remap here, because we release a slot that was |
| 1009 | // allocated by this process and we do not access any data past it during |
| 1010 | // deallocation. |
| 1011 | |
| 1012 | // Perform some sanity checks on a handle |
| 1013 | SnapshotList* snapshots = m_snapshots->getHeader(); |
| 1014 | SnapshotData* slot = snapshots->slots + handle; |
| 1015 | |
| 1016 | if (handle >= snapshots->slots_used.load(std::memory_order_relaxed)) |
| 1017 | ERR_bugcheck_msg("Incorrect snapshot deallocation - too few slots"); |
| 1018 | |
| 1019 | if (slot->attachment_id.load(std::memory_order_relaxed) != attachmentId) |
| 1020 | ERR_bugcheck_msg("Incorrect snapshot deallocation - attachment mismatch"); |
| 1021 | |
| 1022 | // Deallocate slot |
| 1023 | deallocateSnapshotSlot(handle); |
| 1024 | |
| 1025 | // Increment release event count |
| 1026 | header->snapshot_release_count++; |
| 1027 | } |
| 1028 | |
| 1029 | void TipCache::updateActiveSnapshots(thread_db* tdbb, ActiveSnapshots* activeSnapshots) |
| 1030 | { |
no test coverage detected