Skip to content

Commit a448e49

Browse files
committed
Revert 56-bit relfilenode change and follow-up commits.
There are still some alignment-related failures in the buildfarm, which might or might not be able to be fixed quickly, but I've also just realized that it increased the size of many WAL records by 4 bytes because a block reference contains a RelFileLocator. The effect of that hasn't been studied or discussed, so revert for now.
1 parent 6af0827 commit a448e49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+305
-720
lines changed

contrib/pg_buffercache/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ OBJS = \
66
pg_buffercache_pages.o
77

88
EXTENSION = pg_buffercache
9-
DATA = pg_buffercache--1.0--1.1.sql pg_buffercache--1.1--1.2.sql pg_buffercache--1.2.sql \
10-
pg_buffercache--1.2--1.3.sql pg_buffercache--1.3--1.4.sql
9+
DATA = pg_buffercache--1.2.sql pg_buffercache--1.2--1.3.sql \
10+
pg_buffercache--1.1--1.2.sql pg_buffercache--1.0--1.1.sql
1111
PGFILEDESC = "pg_buffercache - monitoring of shared buffer cache in real-time"
1212

1313
REGRESS = pg_buffercache

contrib/pg_buffercache/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ install_data(
1111
'pg_buffercache--1.1--1.2.sql',
1212
'pg_buffercache--1.2--1.3.sql',
1313
'pg_buffercache--1.2.sql',
14-
'pg_buffercache--1.3--1.4.sql',
1514
'pg_buffercache.control',
1615
kwargs: contrib_data_args,
1716
)

contrib/pg_buffercache/pg_buffercache--1.3--1.4.sql

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pg_buffercache extension
22
comment = 'examine the shared buffer cache'
3-
default_version = '1.4'
3+
default_version = '1.3'
44
module_pathname = '$libdir/pg_buffercache'
55
relocatable = true

contrib/pg_buffercache/pg_buffercache_pages.c

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ typedef struct
5959
* relation node/tablespace/database/blocknum and dirty indicator.
6060
*/
6161
PG_FUNCTION_INFO_V1(pg_buffercache_pages);
62-
PG_FUNCTION_INFO_V1(pg_buffercache_pages_v1_4);
6362

64-
static Datum
65-
pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid)
63+
Datum
64+
pg_buffercache_pages(PG_FUNCTION_ARGS)
6665
{
6766
FuncCallContext *funcctx;
6867
Datum result;
@@ -104,7 +103,7 @@ pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid)
104103
TupleDescInitEntry(tupledesc, (AttrNumber) 1, "bufferid",
105104
INT4OID, -1, 0);
106105
TupleDescInitEntry(tupledesc, (AttrNumber) 2, "relfilenode",
107-
rfn_typid, -1, 0);
106+
OIDOID, -1, 0);
108107
TupleDescInitEntry(tupledesc, (AttrNumber) 3, "reltablespace",
109108
OIDOID, -1, 0);
110109
TupleDescInitEntry(tupledesc, (AttrNumber) 4, "reldatabase",
@@ -210,24 +209,7 @@ pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid)
210209
}
211210
else
212211
{
213-
if (rfn_typid == INT8OID)
214-
values[1] =
215-
Int64GetDatum((int64) fctx->record[i].relfilenumber);
216-
else
217-
{
218-
Assert(rfn_typid == OIDOID);
219-
220-
if (fctx->record[i].relfilenumber > OID_MAX)
221-
ereport(ERROR,
222-
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
223-
errmsg("relfilenode %llu is too large to be represented as an OID",
224-
(unsigned long long) fctx->record[i].relfilenumber),
225-
errhint("Upgrade the extension using ALTER EXTENSION pg_buffercache UPDATE"));
226-
227-
values[1] =
228-
ObjectIdGetDatum((Oid) fctx->record[i].relfilenumber);
229-
}
230-
212+
values[1] = ObjectIdGetDatum(fctx->record[i].relfilenumber);
231213
nulls[1] = false;
232214
values[2] = ObjectIdGetDatum(fctx->record[i].reltablespace);
233215
nulls[2] = false;
@@ -255,16 +237,3 @@ pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid)
255237
else
256238
SRF_RETURN_DONE(funcctx);
257239
}
258-
259-
/* entry point for old extension version */
260-
Datum
261-
pg_buffercache_pages(PG_FUNCTION_ARGS)
262-
{
263-
return pg_buffercache_pages_internal(fcinfo, OIDOID);
264-
}
265-
266-
Datum
267-
pg_buffercache_pages_v1_4(PG_FUNCTION_ARGS)
268-
{
269-
return pg_buffercache_pages_internal(fcinfo, INT8OID);
270-
}

contrib/pg_prewarm/autoprewarm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ apw_load_buffers(void)
345345
{
346346
unsigned forknum;
347347

348-
if (fscanf(file, "%u,%u," UINT64_FORMAT ",%u,%u\n", &blkinfo[i].database,
348+
if (fscanf(file, "%u,%u,%u,%u,%u\n", &blkinfo[i].database,
349349
&blkinfo[i].tablespace, &blkinfo[i].filenumber,
350350
&forknum, &blkinfo[i].blocknum) != 5)
351351
ereport(ERROR,
@@ -669,7 +669,7 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged)
669669
{
670670
CHECK_FOR_INTERRUPTS();
671671

672-
ret = fprintf(file, "%u,%u," UINT64_FORMAT ",%u,%u\n",
672+
ret = fprintf(file, "%u,%u,%u,%u,%u\n",
673673
block_info_array[i].database,
674674
block_info_array[i].tablespace,
675675
block_info_array[i].filenumber,

contrib/pg_walinspect/expected/pg_walinspect.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ SELECT COUNT(*) >= 0 AS ok FROM pg_get_wal_stats_till_end_of_wal(:'wal_lsn1');
5454
-- ===================================================================
5555
-- Test for filtering out WAL records of a particular table
5656
-- ===================================================================
57-
SELECT relfilenode AS sample_tbl_relfilenode FROM pg_class WHERE relname = 'sample_tbl' \gset
57+
SELECT oid AS sample_tbl_oid FROM pg_class WHERE relname = 'sample_tbl' \gset
5858
SELECT COUNT(*) >= 1 AS ok FROM pg_get_wal_records_info(:'wal_lsn1', :'wal_lsn2')
59-
WHERE block_ref LIKE concat('%', :'sample_tbl_relfilenode', '%') AND resource_manager = 'Heap';
59+
WHERE block_ref LIKE concat('%', :'sample_tbl_oid', '%') AND resource_manager = 'Heap';
6060
ok
6161
----
6262
t

contrib/pg_walinspect/sql/pg_walinspect.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ SELECT COUNT(*) >= 0 AS ok FROM pg_get_wal_stats_till_end_of_wal(:'wal_lsn1');
3939
-- Test for filtering out WAL records of a particular table
4040
-- ===================================================================
4141

42-
SELECT relfilenode AS sample_tbl_relfilenode FROM pg_class WHERE relname = 'sample_tbl' \gset
42+
SELECT oid AS sample_tbl_oid FROM pg_class WHERE relname = 'sample_tbl' \gset
4343

4444
SELECT COUNT(*) >= 1 AS ok FROM pg_get_wal_records_info(:'wal_lsn1', :'wal_lsn2')
45-
WHERE block_ref LIKE concat('%', :'sample_tbl_relfilenode', '%') AND resource_manager = 'Heap';
45+
WHERE block_ref LIKE concat('%', :'sample_tbl_oid', '%') AND resource_manager = 'Heap';
4646

4747
-- ===================================================================
4848
-- Test for filtering out WAL records based on resource_manager and

doc/src/sgml/catalogs.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1984,7 +1984,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
19841984

19851985
<row>
19861986
<entry role="catalog_table_entry"><para role="column_definition">
1987-
<structfield>relfilenode</structfield> <type>int8</type>
1987+
<structfield>relfilenode</structfield> <type>oid</type>
19881988
</para>
19891989
<para>
19901990
Name of the on-disk file of this relation; zero means this

doc/src/sgml/func.sgml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25210,11 +25210,6 @@ SELECT collation for ('foo' COLLATE "de_DE");
2521025210
<entry><type>timestamp with time zone</type></entry>
2521125211
</row>
2521225212

25213-
<row>
25214-
<entry><structfield>next_relfilenumber</structfield></entry>
25215-
<entry><type>timestamp with time zone</type></entry>
25216-
</row>
25217-
2521825213
</tbody>
2521925214
</tgroup>
2522025215
</table>

0 commit comments

Comments
 (0)