1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Backport addition of rs_old_rel to rewriteheap's state.

Originally part of b89e151054, the
introduction of logical decoding, this is required to backport a
commit introducing error checks defending against recent bugs.

It's possible that extensions calls begin_heap_rewrite(), but it seems
highly unlikely. But if so, they'd break.

Author: Andres Freund
Discussion: https://postgr.es/m/20171215010029.3dxx56vjlymudvwo@alap3.anarazel.de
This commit is contained in:
Andres Freund
2017-12-14 16:50:31 -08:00
parent d5f767c136
commit 152a569056
3 changed files with 5 additions and 3 deletions

View File

@ -120,6 +120,7 @@
*/
typedef struct RewriteStateData
{
Relation rs_old_rel; /* source heap */
Relation rs_new_rel; /* destination heap */
Page rs_buffer; /* page currently being built */
BlockNumber rs_blockno; /* block where page will go */
@ -187,7 +188,7 @@ static void raw_heap_insert(RewriteState state, HeapTuple tup);
* to be used in subsequent calls to the other functions.
*/
RewriteState
begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
begin_heap_rewrite(Relation old_heap, Relation new_heap, TransactionId oldest_xmin,
TransactionId freeze_xid, MultiXactId cutoff_multi,
bool use_wal)
{
@ -210,6 +211,7 @@ begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
/* Create and fill in the state struct */
state = palloc0(sizeof(RewriteStateData));
state->rs_old_rel = old_heap;
state->rs_new_rel = new_heap;
state->rs_buffer = (Page) palloc(BLCKSZ);
/* new_heap needn't be empty, just locked */