Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cdb2033

Browse files
committed
Merge branch 'PGPROEE10_pg_upgrade_merge' into PGPROEE10_DEV
2 parents b251edf + e07e692 commit cdb2033

File tree

25 files changed

+1608
-66
lines changed

25 files changed

+1608
-66
lines changed

contrib/pageinspect/expected/page.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ SELECT get_raw_page('test1', 0) = get_raw_page('test1', 'main', 0);
4646
SELECT pagesize, version FROM page_header(get_raw_page('test1', 0));
4747
pagesize | version
4848
----------+---------
49-
8192 | 4
49+
8192 | 254
5050
(1 row)
5151

5252
SELECT page_checksum(get_raw_page('test1', 0), 0) IS NOT NULL AS silly_checksum_test;

src/backend/access/nbtree/nbtxlog.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,6 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
10101010
_bt_pageinit(page, BufferGetPageSize(buffer));
10111011
pageop = (BTPageOpaque) PageGetSpecialPointer(page);
10121012

1013-
pageop->btpo1.btpo_prev = leftsib;
10141013
pageop->btpo_next = rightsib;
10151014
BTP_SET_XACT(pageop, xlrec->btpo_xact);
10161015
pageop->btpo_flags = BTP_DELETED;

src/backend/access/transam/xlog.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "catalog/pg_database.h"
4343
#include "commands/tablespace.h"
4444
#include "commands/waitlsn.h"
45+
#include "common/edition.h"
4546
#include "common/controldata_utils.h"
4647
#include "miscadmin.h"
4748
#include "pgstat.h"
@@ -4421,6 +4422,8 @@ WriteControlFile(void)
44214422
Assert(sizeof(ControlFile->icu_version) == sizeof(UVersionInfo));
44224423
u_getVersion(ControlFile->icu_version);
44234424
#endif
4425+
CONTROLFILE_SET_OLDVERSION(ControlFile, 0);
4426+
CONTROLFILE_SET_OLDEDITION(ControlFile, PG_UNKNOWN);
44244427

44254428
/* Contents are protected with a CRC */
44264429
INIT_CRC32C(ControlFile->crc);

src/backend/storage/buffer/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ subdir = src/backend/storage/buffer
1212
top_builddir = ../../../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
OBJS = block_repair.o buf_table.o buf_init.o bufmgr.o freelist.o localbuf.o
15+
OBJS = block_repair.o buf_table.o buf_init.o bufmgr.o freelist.o heap_convert.o localbuf.o
1616

1717
include $(top_srcdir)/src/backend/common.mk

src/backend/storage/buffer/bufmgr.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
#include <sys/file.h>
3434
#include <unistd.h>
35-
3635
#include "access/xlog.h"
3736
#include "catalog/catalog.h"
3837
#include "catalog/storage.h"
@@ -432,10 +431,9 @@ ForgetPrivateRefCountEntry(PrivateRefCountEntry *ref)
432431
)
433432

434433

435-
static Buffer ReadBuffer_common(SMgrRelation reln, char relpersistence,
436-
char relkind, ForkNumber forkNum, BlockNumber blockNum,
437-
ReadBufferMode mode, BufferAccessStrategy strategy,
438-
bool *hit);
434+
static Buffer ReadBuffer_common(Relation reln, SMgrRelation smgr, char relpersistence,
435+
ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode,
436+
BufferAccessStrategy strategy, bool *hit);
439437
static bool PinBuffer(BufferDesc *buf, BufferAccessStrategy strategy);
440438
static void PinBuffer_Locked(BufferDesc *buf);
441439
static void UnpinBuffer(BufferDesc *buf, bool fixOwner);
@@ -754,8 +752,7 @@ ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum,
754752
* miss.
755753
*/
756754
pgstat_count_buffer_read(reln);
757-
buf = ReadBuffer_common(reln->rd_smgr, reln->rd_rel->relpersistence,
758-
reln->rd_rel->relkind,
755+
buf = ReadBuffer_common(reln, reln->rd_smgr, reln->rd_rel->relpersistence,
759756
forkNum, blockNum, mode, strategy, &hit);
760757
if (hit)
761758
pgstat_count_buffer_hit(reln);
@@ -783,9 +780,8 @@ ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum,
783780

784781
Assert(InRecovery || InRepair);
785782

786-
return ReadBuffer_common(smgr, RELPERSISTENCE_PERMANENT, RELKIND_UNKNOWN,
787-
forkNum, blockNum,
788-
mode, strategy, &hit);
783+
return ReadBuffer_common(NULL, smgr, RELPERSISTENCE_PERMANENT, forkNum,
784+
blockNum, mode, strategy, &hit);
789785
}
790786

791787

@@ -795,7 +791,7 @@ ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum,
795791
* *hit is set to true if the request was satisfied from shared buffer cache.
796792
*/
797793
static Buffer
798-
ReadBuffer_common(SMgrRelation smgr, char relpersistence, char relkind,\
794+
ReadBuffer_common(Relation reln, SMgrRelation smgr, char relpersistence,
799795
ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode,
800796
BufferAccessStrategy strategy, bool *hit)
801797
{
@@ -831,7 +827,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, char relkind,\
831827
* Here we do all the work needed for cache initialization.
832828
*/
833829
if (isLocalBuf
834-
&& relkind == RELKIND_RELATION
830+
&& reln->rd_rel->relkind == RELKIND_RELATION
835831
&& forkNum == MAIN_FORKNUM)
836832
{
837833
bool ttiIsFound;
@@ -1130,6 +1126,16 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, char relkind,\
11301126
relpath(smgr->smgr_rnode, forkNum))));
11311127
}
11321128
}
1129+
1130+
if (PageGetPageLayoutVersion(bufBlock) != PG_PAGE_LAYOUT_VERSION)
1131+
{
1132+
Buffer buf = BufferDescriptorGetBuffer(bufHdr);
1133+
1134+
/* TODO: Lock is aquired below. Think about it */
1135+
LWLockAcquire(BufferDescriptorGetContentLock(bufHdr), LW_EXCLUSIVE);
1136+
convert_page(reln, bufBlock, buf, blockNum);
1137+
LWLockRelease(BufferDescriptorGetContentLock(bufHdr));
1138+
}
11331139
}
11341140
}
11351141

0 commit comments

Comments
 (0)