@@ -2063,12 +2063,8 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
2063
2063
TransactionId xid = GetCurrentTransactionId ();
2064
2064
HeapTuple heaptup ;
2065
2065
Buffer buffer ;
2066
- Page page = NULL ;
2067
2066
Buffer vmbuffer = InvalidBuffer ;
2068
- bool starting_with_empty_page ;
2069
2067
bool all_visible_cleared = false;
2070
- bool all_frozen_set = false;
2071
- uint8 vmstatus = 0 ;
2072
2068
2073
2069
/* Cheap, simplistic check that the tuple matches the rel's rowtype. */
2074
2070
Assert (HeapTupleHeaderGetNatts (tup -> t_data ) <=
@@ -2085,36 +2081,11 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
2085
2081
/*
2086
2082
* Find buffer to insert this tuple into. If the page is all visible,
2087
2083
* this will also pin the requisite visibility map page.
2088
- *
2089
- * Also pin visibility map page if COPY FREEZE inserts tuples into an
2090
- * empty page. See all_frozen_set below.
2091
2084
*/
2092
2085
buffer = RelationGetBufferForTuple (relation , heaptup -> t_len ,
2093
2086
InvalidBuffer , options , bistate ,
2094
2087
& vmbuffer , NULL );
2095
2088
2096
-
2097
- /*
2098
- * If we're inserting frozen entry into an empty page, set visibility map
2099
- * bits and PageAllVisible() hint.
2100
- *
2101
- * If we're inserting frozen entry into already all_frozen page, preserve
2102
- * this state.
2103
- */
2104
- if (options & HEAP_INSERT_FROZEN )
2105
- {
2106
- page = BufferGetPage (buffer );
2107
-
2108
- starting_with_empty_page = PageGetMaxOffsetNumber (page ) == 0 ;
2109
-
2110
- if (visibilitymap_pin_ok (BufferGetBlockNumber (buffer ), vmbuffer ))
2111
- vmstatus = visibilitymap_get_status (relation ,
2112
- BufferGetBlockNumber (buffer ), & vmbuffer );
2113
-
2114
- if ((starting_with_empty_page || vmstatus & VISIBILITYMAP_ALL_FROZEN ))
2115
- all_frozen_set = true;
2116
- }
2117
-
2118
2089
/*
2119
2090
* We're about to do the actual insert -- but check for conflict first, to
2120
2091
* avoid possibly having to roll back work we've just done.
@@ -2138,28 +2109,14 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
2138
2109
RelationPutHeapTuple (relation , buffer , heaptup ,
2139
2110
(options & HEAP_INSERT_SPECULATIVE ) != 0 );
2140
2111
2141
- /*
2142
- * If the page is all visible, need to clear that, unless we're only going
2143
- * to add further frozen rows to it.
2144
- *
2145
- * If we're only adding already frozen rows to a page that was empty or
2146
- * marked as all visible, mark it as all-visible.
2147
- */
2148
- if (PageIsAllVisible (BufferGetPage (buffer )) && !(options & HEAP_INSERT_FROZEN ))
2112
+ if (PageIsAllVisible (BufferGetPage (buffer )))
2149
2113
{
2150
2114
all_visible_cleared = true;
2151
2115
PageClearAllVisible (BufferGetPage (buffer ));
2152
2116
visibilitymap_clear (relation ,
2153
2117
ItemPointerGetBlockNumber (& (heaptup -> t_self )),
2154
2118
vmbuffer , VISIBILITYMAP_VALID_BITS );
2155
2119
}
2156
- else if (all_frozen_set )
2157
- {
2158
- /* We only ever set all_frozen_set after reading the page. */
2159
- Assert (page );
2160
-
2161
- PageSetAllVisible (page );
2162
- }
2163
2120
2164
2121
/*
2165
2122
* XXX Should we set PageSetPrunable on this page ?
@@ -2207,8 +2164,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
2207
2164
xlrec .flags = 0 ;
2208
2165
if (all_visible_cleared )
2209
2166
xlrec .flags |= XLH_INSERT_ALL_VISIBLE_CLEARED ;
2210
- if (all_frozen_set )
2211
- xlrec .flags = XLH_INSERT_ALL_FROZEN_SET ;
2212
2167
if (options & HEAP_INSERT_SPECULATIVE )
2213
2168
xlrec .flags |= XLH_INSERT_IS_SPECULATIVE ;
2214
2169
Assert (ItemPointerGetBlockNumber (& heaptup -> t_self ) == BufferGetBlockNumber (buffer ));
@@ -2257,29 +2212,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
2257
2212
2258
2213
END_CRIT_SECTION ();
2259
2214
2260
- /*
2261
- * If we've frozen everything on the page, update the visibilitymap. We're
2262
- * already holding pin on the vmbuffer.
2263
- *
2264
- * No need to update the visibilitymap if it had all_frozen bit set before
2265
- * this insertion.
2266
- */
2267
- if (all_frozen_set && ((vmstatus & VISIBILITYMAP_ALL_FROZEN ) == 0 ))
2268
- {
2269
- Assert (PageIsAllVisible (page ));
2270
- Assert (visibilitymap_pin_ok (BufferGetBlockNumber (buffer ), vmbuffer ));
2271
-
2272
- /*
2273
- * It's fine to use InvalidTransactionId here - this is only used when
2274
- * HEAP_INSERT_FROZEN is specified, which intentionally violates
2275
- * visibility rules.
2276
- */
2277
- visibilitymap_set (relation , BufferGetBlockNumber (buffer ), buffer ,
2278
- InvalidXLogRecPtr , vmbuffer ,
2279
- InvalidTransactionId ,
2280
- VISIBILITYMAP_ALL_VISIBLE | VISIBILITYMAP_ALL_FROZEN );
2281
- }
2282
-
2283
2215
UnlockReleaseBuffer (buffer );
2284
2216
if (vmbuffer != InvalidBuffer )
2285
2217
ReleaseBuffer (vmbuffer );
@@ -8946,10 +8878,6 @@ heap_xlog_insert(XLogReaderState *record)
8946
8878
ItemPointerSetBlockNumber (& target_tid , blkno );
8947
8879
ItemPointerSetOffsetNumber (& target_tid , xlrec -> offnum );
8948
8880
8949
- /* check that the mutually exclusive flags are not both set */
8950
- Assert (!((xlrec -> flags & XLH_INSERT_ALL_VISIBLE_CLEARED ) &&
8951
- (xlrec -> flags & XLH_INSERT_ALL_FROZEN_SET )));
8952
-
8953
8881
/*
8954
8882
* The visibility map may need to be fixed even if the heap page is
8955
8883
* already up-to-date.
0 commit comments