mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 16:21:20 +03:00
Backport addition of rs_old_rel to rewriteheap's state.
Originally part of b89e151054a05f0f6d356ca52e3b725dd0505e53, 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:
parent
d5f767c136
commit
152a569056
@ -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 */
|
||||
|
@ -887,7 +887,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
||||
is_system_catalog = IsSystemRelation(OldHeap);
|
||||
|
||||
/* Initialize the rewrite operation */
|
||||
rwstate = begin_heap_rewrite(NewHeap, OldestXmin, FreezeXid,
|
||||
rwstate = begin_heap_rewrite(OldHeap, NewHeap, OldestXmin, FreezeXid,
|
||||
MultiXactCutoff, use_wal);
|
||||
|
||||
/*
|
||||
|
@ -19,7 +19,7 @@
|
||||
/* struct definition is private to rewriteheap.c */
|
||||
typedef struct RewriteStateData *RewriteState;
|
||||
|
||||
extern RewriteState begin_heap_rewrite(Relation NewHeap,
|
||||
extern RewriteState begin_heap_rewrite(Relation OldHeap, Relation NewHeap,
|
||||
TransactionId OldestXmin, TransactionId FreezeXid,
|
||||
MultiXactId MultiXactCutoff, bool use_wal);
|
||||
extern void end_heap_rewrite(RewriteState state);
|
||||
|
Loading…
x
Reference in New Issue
Block a user