|
39 | 39 | *
|
40 | 40 | * When we *set* a visibility map during VACUUM, we must write WAL. This may
|
41 | 41 | * seem counterintuitive, since the bit is basically a hint: if it is clear,
|
42 |
| - * it may still be the case that every tuple on the page is all-visible or |
43 |
| - * all-frozen we just don't know that for certain. The difficulty is that |
44 |
| - * there are two bits which are typically set together: the PD_ALL_VISIBLE |
45 |
| - * or PD_ALL_FROZEN bit on the page itself, and the corresponding visibility |
46 |
| - * map bit. If a crash occurs after the visibility map page makes it to disk |
47 |
| - * and before the updated heap page makes it to disk, redo must set the bit on |
48 |
| - * the heap page. Otherwise, the next insert, update, or delete on the heap |
49 |
| - * page will fail to realize that the visibility map bit must be cleared, |
50 |
| - * possibly causing index-only scans to return wrong answers. |
| 42 | + * it may still be the case that every tuple on the page is visible to all |
| 43 | + * transactions; we just don't know that for certain. The difficulty is that |
| 44 | + * there are two bits which are typically set together: the PD_ALL_VISIBLE bit |
| 45 | + * on the page itself, and the visibility map bit. If a crash occurs after the |
| 46 | + * visibility map page makes it to disk and before the updated heap page makes |
| 47 | + * it to disk, redo must set the bit on the heap page. Otherwise, the next |
| 48 | + * insert, update, or delete on the heap page will fail to realize that the |
| 49 | + * visibility map bit must be cleared, possibly causing index-only scans to |
| 50 | + * return wrong answers. |
51 | 51 | *
|
52 | 52 | * VACUUM will normally skip pages for which the visibility map bit is set;
|
53 | 53 | * such pages can't contain any dead tuples and therefore don't need vacuuming.
|
@@ -251,11 +251,10 @@ visibilitymap_pin_ok(BlockNumber heapBlk, Buffer buf)
|
251 | 251 | * to InvalidTransactionId when a page that is already all-visible is being
|
252 | 252 | * marked all-frozen.
|
253 | 253 | *
|
254 |
| - * Caller is expected to set the heap page's PD_ALL_VISIBLE or PD_ALL_FROZEN |
255 |
| - * bit before calling this function. Except in recovery, caller should also |
256 |
| - * pass the heap buffer and flags which indicates what flag we want to set. |
257 |
| - * When checksums are enabled and we're not in recovery, we must add the heap |
258 |
| - * buffer to the WAL chain to protect it from being torn. |
| 254 | + * Caller is expected to set the heap page's PD_ALL_VISIBLE bit before calling |
| 255 | + * this function. Except in recovery, caller should also pass the heap |
| 256 | + * buffer. When checksums are enabled and we're not in recovery, we must add |
| 257 | + * the heap buffer to the WAL chain to protect it from being torn. |
259 | 258 | *
|
260 | 259 | * You must pass a buffer containing the correct map page to this function.
|
261 | 260 | * Call visibilitymap_pin first to pin the right one. This function doesn't do
|
@@ -315,10 +314,8 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
|
315 | 314 | {
|
316 | 315 | Page heapPage = BufferGetPage(heapBuf);
|
317 | 316 |
|
318 |
| - /* Caller is expected to set page-level bits first. */ |
319 |
| - Assert((flags & VISIBILITYMAP_ALL_VISIBLE) == 0 || PageIsAllVisible(heapPage)); |
320 |
| - Assert((flags & VISIBILITYMAP_ALL_FROZEN) == 0 || PageIsAllFrozen(heapPage)); |
321 |
| - |
| 317 | + /* caller is expected to set PD_ALL_VISIBLE first */ |
| 318 | + Assert(PageIsAllVisible(heapPage)); |
322 | 319 | PageSetLSN(heapPage, recptr);
|
323 | 320 | }
|
324 | 321 | }
|
|
0 commit comments