Skip to content

Commit 1b96c14

Browse files
author
Antonin Houska
committed
Removed support for PostgreSQL 12, now EOL.
1 parent 8cd1caa commit 1b96c14

File tree

4 files changed

+6
-94
lines changed

4 files changed

+6
-94
lines changed

concurrent.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212

1313
#include "pg_squeeze.h"
1414

15-
#if PG_VERSION_NUM >= 130000
1615
#include "access/heaptoast.h"
17-
#endif
1816
#include "executor/executor.h"
1917
#include "replication/decode.h"
2018
#include "utils/rel.h"
@@ -121,11 +119,6 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
121119
{
122120
DecodingOutputState *dstate;
123121
ResourceOwner resowner_old;
124-
#if PG_VERSION_NUM < 130000
125-
/* Workaround for XLogBeginRead() in setup_decoding(). */
126-
static bool first_time = true;
127-
XLogRecPtr startptr;
128-
#endif
129122

130123
/*
131124
* Invalidate the "present" cache before moving to "(recent) history".
@@ -153,21 +146,7 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
153146
char *errm = NULL;
154147
XLogRecPtr end_lsn;
155148

156-
#if PG_VERSION_NUM < 130000
157-
if (first_time)
158-
{
159-
startptr = MyReplicationSlot->data.restart_lsn;
160-
first_time = false;
161-
}
162-
else
163-
startptr = InvalidXLogRecPtr;
164-
#endif
165-
166-
record = XLogReadRecord(ctx->reader,
167-
#if PG_VERSION_NUM < 130000
168-
startptr,
169-
#endif
170-
&errm);
149+
record = XLogReadRecord(ctx->reader, &errm);
171150
if (errm)
172151
elog(ERROR, "%s", errm);
173152

pg_squeeze.c

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@
99
*/
1010
#include "pg_squeeze.h"
1111

12-
#if PG_VERSION_NUM >= 130000
1312
#include "access/heaptoast.h"
14-
#endif
1513
#include "access/multixact.h"
1614
#include "access/sysattr.h"
17-
#if PG_VERSION_NUM >= 130000
1815
#include "access/toast_internals.h"
1916
#include "access/xlogutils.h"
20-
#endif
2117
#if PG_VERSION_NUM >= 150000
2218
#include "access/xloginsert.h"
2319
#endif
@@ -139,9 +135,6 @@ static bool perform_final_merge(Oid relid_src, Oid *indexes_src, int nindexes,
139135
static void swap_relation_files(Oid r1, Oid r2);
140136
static void swap_toast_names(Oid relid1, Oid toastrelid1, Oid relid2,
141137
Oid toastrelid2);
142-
#if PG_VERSION_NUM < 130000
143-
static Oid get_toast_index(Oid toastrelid);
144-
#endif
145138

146139
/*
147140
* The maximum time to hold AccessExclusiveLock during the final
@@ -1032,19 +1025,13 @@ setup_decoding(Oid relid, TupleDesc tup_desc, Snapshot *snap_hist)
10321025
ctx = CreateDecodingContext(InvalidXLogRecPtr,
10331026
NIL,
10341027
false,
1035-
#if PG_VERSION_NUM >= 130000
10361028
XL_ROUTINE(.page_read = read_local_xlog_page,
10371029
.segment_open = wal_segment_open,
10381030
.segment_close = wal_segment_close),
1039-
#else
1040-
logical_read_local_xlog_page,
1041-
#endif
10421031
NULL, NULL, NULL);
10431032

1044-
#if PG_VERSION_NUM >= 130000
10451033
/* decode_concurrent_changes() handles the older versions. */
10461034
XLogBeginRead(ctx->reader, MyReplicationSlot->data.restart_lsn);
1047-
#endif
10481035

10491036
XLByteToSeg(restart_lsn, squeeze_current_segment, wal_segment_size);
10501037

@@ -2589,8 +2576,7 @@ create_transient_table(CatalogState *cat_state, TupleDesc tup_desc,
25892576
* will eventually be dropped.
25902577
*/
25912578
#if (PG_VERSION_NUM >= 140000) || \
2592-
(PG_VERSION_NUM < 140000 && PG_VERSION_NUM > 130004) || \
2593-
(PG_VERSION_NUM < 130000 && PG_VERSION_NUM > 120008)
2579+
(PG_VERSION_NUM < 140000 && PG_VERSION_NUM > 130004)
25942580
NewHeapCreateToastTable(result, reloptions, AccessExclusiveLock,
25952581
InvalidOid);
25962582
#else
@@ -3312,13 +3298,10 @@ swap_toast_names(Oid relid1, Oid toastrelid1, Oid relid2, Oid toastrelid2)
33123298
RenameRelationInternal(toastrelid2, name, true, false);
33133299

33143300
snprintf(name, NAMEDATALEN, "pg_toast_%u_index_", relid1);
3315-
#if PG_VERSION_NUM < 130000
3316-
/* NoLock as RenameRelationInternal() did not release its lock. */
3317-
toastidxid = get_toast_index(toastrelid2);
3318-
#else
3301+
33193302
/* TOAST relation is locked, but not its indexes. */
33203303
toastidxid = toast_get_valid_index(toastrelid2, AccessExclusiveLock);
3321-
#endif
3304+
33223305
/*
33233306
* Pass is_index=false so that even the index is locked in
33243307
* AccessExclusiveLock mode. ShareUpdateExclusiveLock mode (allowing
@@ -3334,43 +3317,15 @@ swap_toast_names(Oid relid1, Oid toastrelid1, Oid relid2, Oid toastrelid2)
33343317
/* Now set the desired names on the TOAST stuff of relid1. */
33353318
snprintf(name, NAMEDATALEN, "pg_toast_%u", relid1);
33363319
RenameRelationInternal(toastrelid1, name, true, false);
3337-
#if PG_VERSION_NUM < 130000
3338-
/* NoLock as RenameRelationInternal() did not release its lock. */
3339-
toastidxid = get_toast_index(toastrelid1);
3340-
#else
3320+
33413321
/* TOAST relation is locked, but not its indexes. */
33423322
toastidxid = toast_get_valid_index(toastrelid1, AccessExclusiveLock);
3343-
#endif
3323+
33443324
snprintf(name, NAMEDATALEN, "pg_toast_%u_index", relid1);
33453325
RenameRelationInternal(toastidxid, name, true, false);
33463326
CommandCounterIncrement();
33473327
}
33483328

3349-
#if PG_VERSION_NUM < 130000
3350-
/*
3351-
* The function is called after RenameRelationInternal() which does not
3352-
* release the lock it acquired.
3353-
*/
3354-
static Oid
3355-
get_toast_index(Oid toastrelid)
3356-
{
3357-
Relation toastrel;
3358-
List *toastidxs;
3359-
Oid result;
3360-
3361-
toastrel = table_open(toastrelid, NoLock);
3362-
toastidxs = RelationGetIndexList(toastrel);
3363-
3364-
if (toastidxs == NIL || list_length(toastidxs) != 1)
3365-
elog(ERROR, "Unexpected number of TOAST indexes");
3366-
3367-
result = linitial_oid(toastidxs);
3368-
table_close(toastrel, NoLock);
3369-
3370-
return result;
3371-
}
3372-
#endif
3373-
33743329
/*
33753330
* Retrieve the "fillfactor" storage option in a convenient way, so we don't
33763331
* have to parse pg_class(reloptions) value at SQL level.

pg_squeeze.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,13 @@
1717
#include "access/genam.h"
1818
#include "access/heapam.h"
1919
#include "access/relscan.h"
20-
#if PG_VERSION_NUM < 130000
21-
#include "access/tuptoaster.h"
22-
#endif
2320
#include "access/xact.h"
24-
#if PG_VERSION_NUM >= 130000
2521
#include "access/xlogutils.h"
26-
#endif
2722
#include "access/xlog_internal.h"
2823
#include "catalog/pg_class.h"
2924
#include "nodes/execnodes.h"
3025
#include "postmaster/bgworker.h"
3126
#include "replication/logical.h"
32-
#if PG_VERSION_NUM < 130000
33-
#include "replication/logicalfuncs.h"
34-
#endif
3527
#include "replication/origin.h"
3628
#include "storage/ipc.h"
3729
#include "utils/array.h"

worker.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,11 +1114,7 @@ scheduler_worker_loop(void)
11141114
if (rc != SPI_OK_SELECT)
11151115
ereport(ERROR, (errmsg("SELECT command failed: %s", query.data)));
11161116

1117-
#if PG_VERSION_NUM >= 130000
11181117
ntask = SPI_tuptable->numvals;
1119-
#else
1120-
ntask = SPI_processed;
1121-
#endif
11221118

11231119
ereport(DEBUG1, (errmsg("scheduler worker: %zu tasks available",
11241120
ntask)));
@@ -1537,13 +1533,9 @@ create_replication_slots(int nslots, MemoryContext mcxt)
15371533
NIL,
15381534
true,
15391535
InvalidXLogRecPtr,
1540-
#if PG_VERSION_NUM >= 130000
15411536
XL_ROUTINE(.page_read = read_local_xlog_page,
15421537
.segment_open = wal_segment_open,
15431538
.segment_close = wal_segment_close),
1544-
#else
1545-
logical_read_local_xlog_page,
1546-
#endif
15471539
NULL, NULL, NULL);
15481540

15491541

@@ -2231,13 +2223,7 @@ run_command(char *command, int rc)
22312223

22322224
if (rc == SPI_OK_SELECT || rc == SPI_OK_INSERT_RETURNING ||
22332225
rc == SPI_OK_DELETE_RETURNING || rc == SPI_OK_UPDATE_RETURNING)
2234-
{
2235-
#if PG_VERSION_NUM >= 130000
22362226
ntup = SPI_tuptable->numvals;
2237-
#else
2238-
ntup = SPI_processed;
2239-
#endif
2240-
}
22412227
SPI_finish();
22422228
PopActiveSnapshot();
22432229
CommitTransactionCommand();

0 commit comments

Comments
 (0)