mirror of
https://github.com/postgres/postgres.git
synced 2025-05-28 00:03:23 -04:00
This involves two main changes from the previous behavior. First, when we set a bit in the visibility map, emit a new WAL record of type XLOG_HEAP2_VISIBLE. Replay sets the page-level PD_ALL_VISIBLE bit and the visibility map bit. Second, when inserting, updating, or deleting a tuple, we can no longer get away with clearing the visibility map bit after releasing the lock on the corresponding heap page, because an intervening crash might leave the visibility map bit set and the page-level bit clear. Making this work requires a bit of interface refactoring. In passing, a few minor but related cleanups: change the test in visibilitymap_set and visibilitymap_clear to throw an error if the wrong page (or no page) is pinned, rather than silently doing nothing; this case should never occur. Also, remove duplicate definitions of InvalidXLogRecPtr. Patch by me, review by Noah Misch.
33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* visibilitymap.h
|
|
* visibility map interface
|
|
*
|
|
*
|
|
* Portions Copyright (c) 2007-2011, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/access/visibilitymap.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef VISIBILITYMAP_H
|
|
#define VISIBILITYMAP_H
|
|
|
|
#include "access/xlogdefs.h"
|
|
#include "storage/block.h"
|
|
#include "storage/buf.h"
|
|
#include "utils/relcache.h"
|
|
|
|
extern void visibilitymap_clear(Relation rel, BlockNumber heapBlk,
|
|
Buffer vmbuf);
|
|
extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk,
|
|
Buffer *vmbuf);
|
|
extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf);
|
|
extern void visibilitymap_set(Relation rel, BlockNumber heapBlk,
|
|
XLogRecPtr recptr, Buffer vmbuf);
|
|
extern bool visibilitymap_test(Relation rel, BlockNumber heapBlk, Buffer *vmbuf);
|
|
extern void visibilitymap_truncate(Relation rel, BlockNumber heapblk);
|
|
|
|
#endif /* VISIBILITYMAP_H */
|