| 5155 | /* This is used by PageGetLSN(). */ |
| 5156 | #ifdef USE_ASSERT_CHECKING |
| 5157 | bool |
| 5158 | BufferLockHeldByMe(Page page) |
| 5159 | { |
| 5160 | char *pagePtr = page; |
| 5161 | |
| 5162 | /* |
| 5163 | * We only want to assert that we hold a lock on the page contents if the |
| 5164 | * page is shared (i.e. it is one of the BufferBlocks). |
| 5165 | */ |
| 5166 | if (BufferBlocks <= pagePtr && |
| 5167 | pagePtr < (BufferBlocks + NBuffers * BLCKSZ)) |
| 5168 | { |
| 5169 | BufferDesc *hdr = GetBufferDescriptor((pagePtr - BufferBlocks) / BLCKSZ); |
| 5170 | return LWLockHeldByMe(BufferDescriptorGetContentLock(hdr)); |
| 5171 | } |
| 5172 | return true; |
| 5173 | } |
| 5174 | #endif |
no test coverage detected