mirror of
https://github.com/postgres/postgres.git
synced 2025-10-07 00:12:29 -04:00
Add assert and log message to visibilitymap_set
Add an assert to visibilitymap_set() that the provided heap buffer is exclusively locked, which is expected. Also, enhance the debug logging message to specify which VM flags were set. Based on a related suggestion by Kirill Reshke on an in-progress patchset. Author: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CALdSSPhAU56g1gGVT0%2BwG8RrSWE6qW8TOfNJS1HNAWX6wPgbFA%40mail.gmail.com
This commit is contained in:
parent
6ede13d1b5
commit
e3d5ddb7ca
@ -255,7 +255,8 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
|
||||
uint8 status;
|
||||
|
||||
#ifdef TRACE_VISIBILITYMAP
|
||||
elog(DEBUG1, "vm_set %s %d", RelationGetRelationName(rel), heapBlk);
|
||||
elog(DEBUG1, "vm_set flags 0x%02X for %s %d",
|
||||
flags, RelationGetRelationName(rel), heapBlk);
|
||||
#endif
|
||||
|
||||
Assert(InRecovery || XLogRecPtrIsInvalid(recptr));
|
||||
@ -269,6 +270,8 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
|
||||
if (BufferIsValid(heapBuf) && BufferGetBlockNumber(heapBuf) != heapBlk)
|
||||
elog(ERROR, "wrong heap buffer passed to visibilitymap_set");
|
||||
|
||||
Assert(!BufferIsValid(heapBuf) || BufferIsExclusiveLocked(heapBuf));
|
||||
|
||||
/* Check that we have the right VM page pinned */
|
||||
if (!BufferIsValid(vmBuf) || BufferGetBlockNumber(vmBuf) != mapBlock)
|
||||
elog(ERROR, "wrong VM buffer passed to visibilitymap_set");
|
||||
|
Loading…
x
Reference in New Issue
Block a user