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

Commit35e1651

Browse files
committed
Back out check for unreferenced files.
Heikki Linnakangas
1 parent075ec42 commit35e1651

File tree

9 files changed

+26
-282
lines changed

9 files changed

+26
-282
lines changed

‎doc/src/sgml/maintenance.sgml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.42 2005/05/02 18:26:52 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.43 2005/05/10 22:27:29 momjian Exp $
33
-->
44

55
<chapter id="maintenance">
@@ -474,23 +474,6 @@ HINT: Stop the postmaster and use a standalone backend to VACUUM in "mydb".
474474
</para>
475475
</sect1>
476476

477-
<sect1 id="check-files-after-crash">
478-
<title>Check files after crash</title>
479-
480-
<indexterm zone="check-files-after-crash">
481-
<primary>stale file</primary>
482-
</indexterm>
483-
484-
<para>
485-
<productname>PostgreSQL</productname> recovers automatically after crash
486-
using the write-ahead log (see <xref linkend="wal">) and no manual
487-
operations are normally needed. However, if there was a transaction running
488-
when the crash occured that created or dropped a relation, the
489-
transaction might have left a stale file in the data directory. If this
490-
happens, you will get a notice in the log file stating which files can be
491-
deleted.
492-
</para>
493-
</sect1>
494477

495478
<sect1 id="logfile-maintenance">
496479
<title>Log File Maintenance</title>

‎src/backend/access/transam/xlog.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.190 2005/05/02 18:26:52 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.191 2005/05/10 22:27:29 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -43,7 +43,6 @@
4343
#include"utils/builtins.h"
4444
#include"utils/guc.h"
4545
#include"utils/relcache.h"
46-
#include"utils/flatfiles.h"
4746

4847

4948
/*
@@ -4526,8 +4525,6 @@ StartupXLOG(void)
45264525

45274526
CreateCheckPoint(true, true);
45284527

4529-
CheckStaleRelFiles();
4530-
45314528
/*
45324529
* Close down recovery environment
45334530
*/
@@ -4539,12 +4536,6 @@ StartupXLOG(void)
45394536
*/
45404537
remove_backup_label();
45414538
}
4542-
else
4543-
{
4544-
XLogInitRelationCache();
4545-
CheckStaleRelFiles();
4546-
XLogCloseRelationCache();
4547-
}
45484539

45494540
/*
45504541
* Preallocate additional log files, if wanted.

‎src/backend/catalog/catalog.c

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.60 2005/05/02 18:26:53 momjian Exp $
12+
* $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.61 2005/05/10 22:27:29 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -106,39 +106,6 @@ GetDatabasePath(Oid dbNode, Oid spcNode)
106106
returnpath;
107107
}
108108

109-
/*
110-
* GetTablespacePath- construct path to a tablespace symbolic link
111-
*
112-
* Result is a palloc'd string.
113-
*
114-
* XXX this must agree with relpath and GetDatabasePath!
115-
*/
116-
char*
117-
GetTablespacePath(OidspcNode)
118-
{
119-
intpathlen;
120-
char*path;
121-
122-
Assert(spcNode!=GLOBALTABLESPACE_OID);
123-
124-
if (spcNode==DEFAULTTABLESPACE_OID)
125-
{
126-
/* The default tablespace is {datadir}/base */
127-
pathlen=strlen(DataDir)+5+1;
128-
path= (char*)palloc(pathlen);
129-
snprintf(path,pathlen,"%s/base",
130-
DataDir);
131-
}
132-
else
133-
{
134-
/* All other tablespaces have symlinks in pg_tblspc */
135-
pathlen=strlen(DataDir)+11+OIDCHARS+1;
136-
path= (char*)palloc(pathlen);
137-
snprintf(path,pathlen,"%s/pg_tblspc/%u",
138-
DataDir,spcNode);
139-
}
140-
returnpath;
141-
}
142109

143110
/*
144111
* IsSystemRelation

‎src/backend/commands/tablespace.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.18 2005/05/02 18:26:53 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.19 2005/05/10 22:27:29 momjian Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -341,7 +341,8 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
341341
/*
342342
* All seems well, create the symlink
343343
*/
344-
linkloc=GetTablespacePath(tablespaceoid);
344+
linkloc= (char*)palloc(strlen(DataDir)+11+10+1);
345+
sprintf(linkloc,"%s/pg_tblspc/%u",DataDir,tablespaceoid);
345346

346347
if (symlink(location,linkloc)<0)
347348
ereport(ERROR,
@@ -494,7 +495,8 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
494495
char*subfile;
495496
structstatst;
496497

497-
location=GetTablespacePath(tablespaceoid);
498+
location= (char*)palloc(strlen(DataDir)+11+10+1);
499+
sprintf(location,"%s/pg_tblspc/%u",DataDir,tablespaceoid);
498500

499501
/*
500502
* Check if the tablespace still contains any files. We try to rmdir
@@ -1034,7 +1036,8 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
10341036
set_short_version(location);
10351037

10361038
/* Create the symlink if not already present */
1037-
linkloc=GetTablespacePath(xlrec->ts_id);
1039+
linkloc= (char*)palloc(strlen(DataDir)+11+10+1);
1040+
sprintf(linkloc,"%s/pg_tblspc/%u",DataDir,xlrec->ts_id);
10381041

10391042
if (symlink(location,linkloc)<0)
10401043
{

‎src/backend/utils/adt/misc.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.41 2005/05/02 18:26:53 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.42 2005/05/10 22:27:30 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -26,7 +26,6 @@
2626
#include"funcapi.h"
2727
#include"catalog/pg_type.h"
2828
#include"catalog/pg_tablespace.h"
29-
#include"catalog/catalog.h"
3029

3130
#defineatooid(x) ((Oid) strtoul((x), NULL, 10))
3231

@@ -145,6 +144,11 @@ pg_tablespace_databases(PG_FUNCTION_ARGS)
145144

146145
fctx=palloc(sizeof(ts_db_fctx));
147146

147+
/*
148+
* size = path length + tablespace dirname length + 2 dir sep
149+
* chars + oid + terminator
150+
*/
151+
fctx->location= (char*)palloc(strlen(DataDir)+11+10+1);
148152
if (tablespaceOid==GLOBALTABLESPACE_OID)
149153
{
150154
fctx->dirdesc=NULL;
@@ -153,7 +157,12 @@ pg_tablespace_databases(PG_FUNCTION_ARGS)
153157
}
154158
else
155159
{
156-
fctx->location=GetTablespacePath(tablespaceOid);
160+
if (tablespaceOid==DEFAULTTABLESPACE_OID)
161+
sprintf(fctx->location,"%s/base",DataDir);
162+
else
163+
sprintf(fctx->location,"%s/pg_tblspc/%u",DataDir,
164+
tablespaceOid);
165+
157166
fctx->dirdesc=AllocateDir(fctx->location);
158167

159168
if (!fctx->dirdesc)

‎src/backend/utils/init/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
# Makefile for utils/init
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/utils/init/Makefile,v 1.19 2005/05/02 18:26:53 momjian Exp $
7+
# $PostgreSQL: pgsql/src/backend/utils/init/Makefile,v 1.20 2005/05/10 22:27:30 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/backend/utils/init
1212
top_builddir = ../../../..
1313
include$(top_builddir)/src/Makefile.global
1414

15-
OBJS = flatfiles.o globals.o miscinit.o postinit.o checkfiles.o
15+
OBJS = flatfiles.o globals.o miscinit.o postinit.o
1616

1717
all: SUBSYS.o
1818

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp