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

Commitcbb3edc

Browse files
committed
> - it excludes system-relation too (relkind == 's'). (Note: Vacuum updates
pg_class> by overwriting existing tuple for vacrel, so there are no many reasons tovacuum pg_class).>> It can be done somewhere in _vc_getrels - near to checks against archiverelations> and relations on the write-once storage managers...>> Excuse me - I forgot to say about this.>Attached is the recently posted fix for this. Thanks.Submitted by: Bruce Momjian <maillist@candle.pha.pa.us>
1 parent93c7dcf commitcbb3edc

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

‎src/backend/commands/vacuum.c

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.1.1.1 1996/07/09 06:21:22 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.1.1.1.2.1 1996/10/04 20:37:09 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -44,10 +44,10 @@
4444
boolVacuumRunning=false;
4545

4646
/* non-export function prototypes */
47-
staticvoid_vc_init(char*vacrel);
48-
staticvoid_vc_shutdown(char*vacrel);
49-
staticvoid_vc_vacuum(char*vacrel);
50-
staticVRelList_vc_getrels(Portalp,char*vacrel);
47+
staticvoid_vc_init(void);
48+
staticvoid_vc_shutdown(void);
49+
staticvoid_vc_vacuum(NameData*VacRelP);
50+
staticVRelList_vc_getrels(Portalp,NameData*VacRelP);
5151
staticvoid_vc_vacone(Portalp,VRelListcurvrl);
5252
staticvoid_vc_vacheap(Portalp,VRelListcurvrl,Relationonerel);
5353
staticvoid_vc_vacindices(VRelListcurvrl,Relationonerel);
@@ -65,14 +65,24 @@ static bool _vc_isarchrel(char *rname);
6565
void
6666
vacuum(char*vacrel)
6767
{
68+
NameDataVacRel;
69+
70+
/* vacrel gets de-allocated on transaction commit */
71+
6872
/* initialize vacuum cleaner */
69-
_vc_init(vacrel);
73+
_vc_init();
7074

7175
/* vacuum the database */
72-
_vc_vacuum(vacrel);
76+
if (vacrel)
77+
{
78+
strcpy(VacRel.data,vacrel);
79+
_vc_vacuum(&VacRel);
80+
}
81+
else
82+
_vc_vacuum(NULL);
7383

7484
/* clean up */
75-
_vc_shutdown(vacrel);
85+
_vc_shutdown();
7686
}
7787

7888
/*
@@ -93,7 +103,7 @@ vacuum(char *vacrel)
93103
*PostgresMain().
94104
*/
95105
staticvoid
96-
_vc_init(char*vacrel)
106+
_vc_init()
97107
{
98108
intfd;
99109

@@ -116,7 +126,7 @@ _vc_init(char *vacrel)
116126
}
117127

118128
staticvoid
119-
_vc_shutdown(char*vacrel)
129+
_vc_shutdown()
120130
{
121131
/* on entry, not in a transaction */
122132
if (unlink("pg_vlock")<0)
@@ -147,7 +157,7 @@ vc_abort()
147157
*locks at one time.
148158
*/
149159
staticvoid
150-
_vc_vacuum(char*vacrel)
160+
_vc_vacuum(NameData*VacRelP)
151161
{
152162
VRelListvrl,cur;
153163
char*pname;
@@ -166,7 +176,7 @@ _vc_vacuum(char *vacrel)
166176
pfree(pname);
167177

168178
/* get list of relations */
169-
vrl=_vc_getrels(p,vacrel);
179+
vrl=_vc_getrels(p,VacRelP);
170180

171181
/* vacuum each heap relation */
172182
for (cur=vrl;cur!= (VRelList)NULL;cur=cur->vrl_next)
@@ -178,7 +188,7 @@ _vc_vacuum(char *vacrel)
178188
}
179189

180190
staticVRelList
181-
_vc_getrels(Portalp,char*vacrel)
191+
_vc_getrels(Portalp,NameData*VacRelP)
182192
{
183193
Relationpgclass;
184194
TupleDescpgcdesc;
@@ -196,10 +206,10 @@ _vc_getrels(Portal p, char *vacrel)
196206

197207
StartTransactionCommand();
198208

199-
if (vacrel) {
209+
if (VacRelP->data) {
200210
ScanKeyEntryInitialize(&pgckey,0x0,Anum_pg_class_relname,
201211
NameEqualRegProcedure,
202-
PointerGetDatum(vacrel));
212+
PointerGetDatum(VacRelP->data));
203213
}else {
204214
ScanKeyEntryInitialize(&pgckey,0x0,Anum_pg_class_relkind,
205215
CharacterEqualRegProcedure,CharGetDatum('r'));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp