Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f3e234

Browse files
committed
Fix pg_rewind to handle relation data files in tablespaces properly.
pg_rewind checks whether each file is a relation data file, from its path.Previously this check logic had the bug which made pg_rewind fail torecognize any relation data files in tablespaces. Which also causedan assertion failure in pg_rewind.Back-patch to 9.5 where pg_rewind was added.Author: Takayuki TsunakawaReviewed-by: Michael PaquierDiscussion:https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8D6C7A@G01JPEXMBYT05
1 parent09230e5 commit2f3e234

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

‎src/bin/pg_rewind/filemap.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include"pg_rewind.h"
2020

2121
#include"common/string.h"
22+
#include"catalog/catalog.h"
2223
#include"catalog/pg_tablespace.h"
2324
#include"storage/fd.h"
2425

@@ -554,7 +555,6 @@ print_filemap(void)
554555
staticbool
555556
isRelDataFile(constchar*path)
556557
{
557-
charbuf[20+1];
558558
RelFileNodernode;
559559
unsignedintsegNo;
560560
intnmatch;
@@ -569,7 +569,7 @@ isRelDataFile(const char *path)
569569
* base/<db oid>/
570570
*regular relations, default tablespace
571571
*
572-
* pg_tblspc/<tblspc oid>/PG_9.4_201403261/
572+
* pg_tblspc/<tblspc oid>/<tblspc version>/
573573
*within a non-default tablespace (the name of the directory
574574
*depends on version)
575575
*
@@ -603,21 +603,19 @@ isRelDataFile(const char *path)
603603
}
604604
else
605605
{
606-
nmatch=sscanf(path,"pg_tblspc/%u/PG_%20s/%u/%u.%u",
607-
&rnode.spcNode,buf,&rnode.dbNode,&rnode.relNode,
606+
nmatch=sscanf(path,"pg_tblspc/%u/"TABLESPACE_VERSION_DIRECTORY"/%u/%u.%u",
607+
&rnode.spcNode,&rnode.dbNode,&rnode.relNode,
608608
&segNo);
609-
if (nmatch==4||nmatch==5)
609+
if (nmatch==3||nmatch==4)
610610
matched= true;
611611
}
612612
}
613613

614614
/*
615615
* The sscanf tests above can match files that have extra characters at
616-
* the end, and the last check can also match a path belonging to a
617-
* different version (different TABLESPACE_VERSION_DIRECTORY). To make
618-
* eliminate such cases, cross-check that GetRelationPath creates the
619-
* exact same filename, when passed the RelFileNode information we
620-
* extracted from the filename.
616+
* the end. To eliminate such cases, cross-check that GetRelationPath
617+
* creates the exact same filename, when passed the RelFileNode information
618+
* we extracted from the filename.
621619
*/
622620
if (matched)
623621
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp