Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
267ef0a6
Commit
267ef0a6
authored
28 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Allow vacuum to run for only one table. Fixes allocation bug.
parent
dbc268ca
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/commands/vacuum.c
+25
-15
25 additions, 15 deletions
src/backend/commands/vacuum.c
with
25 additions
and
15 deletions
src/backend/commands/vacuum.c
+
25
−
15
View file @
267ef0a6
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.
1.1.1
1996/0
7
/0
9
0
6:21:22 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.
2
1996/
1
0/0
3
0
4:19:29 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -44,10 +44,10 @@
...
@@ -44,10 +44,10 @@
bool
VacuumRunning
=
false
;
bool
VacuumRunning
=
false
;
/* non-export function prototypes */
/* non-export function prototypes */
static
void
_vc_init
(
char
*
vacrel
);
static
void
_vc_init
(
void
);
static
void
_vc_shutdown
(
char
*
vacrel
);
static
void
_vc_shutdown
(
void
);
static
void
_vc_vacuum
(
char
*
v
ac
r
el
);
static
void
_vc_vacuum
(
NameData
*
V
ac
R
el
P
);
static
VRelList
_vc_getrels
(
Portal
p
,
char
*
v
ac
r
el
);
static
VRelList
_vc_getrels
(
Portal
p
,
NameData
*
V
ac
R
el
P
);
static
void
_vc_vacone
(
Portal
p
,
VRelList
curvrl
);
static
void
_vc_vacone
(
Portal
p
,
VRelList
curvrl
);
static
void
_vc_vacheap
(
Portal
p
,
VRelList
curvrl
,
Relation
onerel
);
static
void
_vc_vacheap
(
Portal
p
,
VRelList
curvrl
,
Relation
onerel
);
static
void
_vc_vacindices
(
VRelList
curvrl
,
Relation
onerel
);
static
void
_vc_vacindices
(
VRelList
curvrl
,
Relation
onerel
);
...
@@ -65,14 +65,24 @@ static bool _vc_isarchrel(char *rname);
...
@@ -65,14 +65,24 @@ static bool _vc_isarchrel(char *rname);
void
void
vacuum
(
char
*
vacrel
)
vacuum
(
char
*
vacrel
)
{
{
NameData
VacRel
;
/* vacrel gets de-allocated on transaction commit */
/* initialize vacuum cleaner */
/* initialize vacuum cleaner */
_vc_init
(
vacrel
);
_vc_init
();
/* vacuum the database */
/* vacuum the database */
_vc_vacuum
(
vacrel
);
if
(
vacrel
)
{
strcpy
(
VacRel
.
data
,
vacrel
);
_vc_vacuum
(
&
VacRel
);
}
else
_vc_vacuum
(
NULL
);
/* clean up */
/* clean up */
_vc_shutdown
(
vacrel
);
_vc_shutdown
();
}
}
/*
/*
...
@@ -93,7 +103,7 @@ vacuum(char *vacrel)
...
@@ -93,7 +103,7 @@ vacuum(char *vacrel)
* PostgresMain().
* PostgresMain().
*/
*/
static
void
static
void
_vc_init
(
char
*
vacrel
)
_vc_init
()
{
{
int
fd
;
int
fd
;
...
@@ -116,7 +126,7 @@ _vc_init(char *vacrel)
...
@@ -116,7 +126,7 @@ _vc_init(char *vacrel)
}
}
static
void
static
void
_vc_shutdown
(
char
*
vacrel
)
_vc_shutdown
()
{
{
/* on entry, not in a transaction */
/* on entry, not in a transaction */
if
(
unlink
(
"pg_vlock"
)
<
0
)
if
(
unlink
(
"pg_vlock"
)
<
0
)
...
@@ -147,7 +157,7 @@ vc_abort()
...
@@ -147,7 +157,7 @@ vc_abort()
* locks at one time.
* locks at one time.
*/
*/
static
void
static
void
_vc_vacuum
(
char
*
v
ac
r
el
)
_vc_vacuum
(
NameData
*
V
ac
R
el
P
)
{
{
VRelList
vrl
,
cur
;
VRelList
vrl
,
cur
;
char
*
pname
;
char
*
pname
;
...
@@ -166,7 +176,7 @@ _vc_vacuum(char *vacrel)
...
@@ -166,7 +176,7 @@ _vc_vacuum(char *vacrel)
pfree
(
pname
);
pfree
(
pname
);
/* get list of relations */
/* get list of relations */
vrl
=
_vc_getrels
(
p
,
v
ac
r
el
);
vrl
=
_vc_getrels
(
p
,
V
ac
R
el
P
);
/* vacuum each heap relation */
/* vacuum each heap relation */
for
(
cur
=
vrl
;
cur
!=
(
VRelList
)
NULL
;
cur
=
cur
->
vrl_next
)
for
(
cur
=
vrl
;
cur
!=
(
VRelList
)
NULL
;
cur
=
cur
->
vrl_next
)
...
@@ -178,7 +188,7 @@ _vc_vacuum(char *vacrel)
...
@@ -178,7 +188,7 @@ _vc_vacuum(char *vacrel)
}
}
static
VRelList
static
VRelList
_vc_getrels
(
Portal
p
,
char
*
v
ac
r
el
)
_vc_getrels
(
Portal
p
,
NameData
*
V
ac
R
el
P
)
{
{
Relation
pgclass
;
Relation
pgclass
;
TupleDesc
pgcdesc
;
TupleDesc
pgcdesc
;
...
@@ -196,10 +206,10 @@ _vc_getrels(Portal p, char *vacrel)
...
@@ -196,10 +206,10 @@ _vc_getrels(Portal p, char *vacrel)
StartTransactionCommand
();
StartTransactionCommand
();
if
(
v
ac
r
el
)
{
if
(
V
ac
R
el
P
->
data
)
{
ScanKeyEntryInitialize
(
&
pgckey
,
0x0
,
Anum_pg_class_relname
,
ScanKeyEntryInitialize
(
&
pgckey
,
0x0
,
Anum_pg_class_relname
,
NameEqualRegProcedure
,
NameEqualRegProcedure
,
PointerGetDatum
(
v
ac
r
el
));
PointerGetDatum
(
V
ac
R
el
P
->
data
));
}
else
{
}
else
{
ScanKeyEntryInitialize
(
&
pgckey
,
0x0
,
Anum_pg_class_relkind
,
ScanKeyEntryInitialize
(
&
pgckey
,
0x0
,
Anum_pg_class_relkind
,
CharacterEqualRegProcedure
,
CharGetDatum
(
'r'
));
CharacterEqualRegProcedure
,
CharGetDatum
(
'r'
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment