Skip to content

Commit fd514c8

Browse files
author
Antonin Houska
committed
Register the historic snapshot before use.
This is necessary due to the commit 8076c00592 in PG core.
1 parent fb1c0b1 commit fd514c8

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

pg_rewrite.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,10 @@ rewrite_table_impl(char *relschema_src, char *relname_src,
10241024
/*
10251025
* The historic snapshot is used to retrieve data w/o concurrent changes.
10261026
*/
1027+
snap_hist = RegisterSnapshot(snap_hist);
10271028
perform_initial_load(estate, mtstate, proute, rel_src, snap_hist, rel_dst,
10281029
partitions, ctx, conv_map);
1030+
UnregisterSnapshot(snap_hist);
10291031

10301032
/*
10311033
* We no longer need to preserve the rows processed during the initial
@@ -1040,11 +1042,6 @@ rewrite_table_impl(char *relschema_src, char *relname_src,
10401042
slot->effective_xmin = InvalidTransactionId;
10411043
SpinLockRelease(&slot->mutex);
10421044

1043-
/*
1044-
* The historic snapshot won't be needed anymore.
1045-
*/
1046-
pfree(snap_hist);
1047-
10481045
/*
10491046
* This is rather paranoia than anything else --- perform_initial_load()
10501047
* uses each snapshot to access different table, and it does not cause

0 commit comments

Comments
 (0)