Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
6287eb7a
Commit
6287eb7a
authored
Mar 23, 2007
by
Alvaro Herrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate fetch of pg_autovacuum tuple into its own function.
parent
8aaecaf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
14 deletions
+35
-14
src/backend/postmaster/autovacuum.c
src/backend/postmaster/autovacuum.c
+35
-14
No files found.
src/backend/postmaster/autovacuum.c
View file @
6287eb7a
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.3
5 2007/03/23 20:56:39
alvherre Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.3
6 2007/03/23 21:23:13
alvherre Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -127,6 +127,7 @@ static void test_rel_for_autovac(Oid relid, PgStat_StatTabEntry *tabentry,
List
**
toast_table_ids
);
static
void
autovacuum_do_vac_analyze
(
Oid
relid
,
bool
dovacuum
,
bool
doanalyze
,
int
freeze_min_age
);
static
HeapTuple
get_pg_autovacuum_tuple_relid
(
Relation
avRel
,
Oid
relid
);
static
void
autovac_report_activity
(
VacuumStmt
*
vacstmt
,
Oid
relid
);
static
void
avl_sighup_handler
(
SIGNAL_ARGS
);
static
void
avlauncher_shutdown
(
SIGNAL_ARGS
);
...
...
@@ -933,9 +934,7 @@ do_autovacuum(PgStat_StatDBEntry *dbentry)
Form_pg_class
classForm
=
(
Form_pg_class
)
GETSTRUCT
(
tuple
);
Form_pg_autovacuum
avForm
=
NULL
;
PgStat_StatTabEntry
*
tabentry
;
SysScanDesc
avScan
;
HeapTuple
avTup
;
ScanKeyData
entry
[
1
];
Oid
relid
;
/* Consider only regular and toast tables. */
...
...
@@ -952,16 +951,8 @@ do_autovacuum(PgStat_StatDBEntry *dbentry)
relid
=
HeapTupleGetOid
(
tuple
);
/* See if we have a pg_autovacuum entry for this relation. */
ScanKeyInit
(
&
entry
[
0
],
Anum_pg_autovacuum_vacrelid
,
BTEqualStrategyNumber
,
F_OIDEQ
,
ObjectIdGetDatum
(
relid
));
avScan
=
systable_beginscan
(
avRel
,
AutovacuumRelidIndexId
,
true
,
SnapshotNow
,
1
,
entry
);
avTup
=
systable_getnext
(
avScan
);
/* Fetch the pg_autovacuum tuple for the relation, if any */
avTup
=
get_pg_autovacuum_tuple_relid
(
avRel
,
relid
);
if
(
HeapTupleIsValid
(
avTup
))
avForm
=
(
Form_pg_autovacuum
)
GETSTRUCT
(
avTup
);
...
...
@@ -978,7 +969,8 @@ do_autovacuum(PgStat_StatDBEntry *dbentry)
test_rel_for_autovac
(
relid
,
tabentry
,
classForm
,
avForm
,
&
vacuum_tables
,
&
toast_table_ids
);
systable_endscan
(
avScan
);
if
(
HeapTupleIsValid
(
avTup
))
heap_freetuple
(
avTup
);
}
heap_endscan
(
relScan
);
...
...
@@ -1030,6 +1022,35 @@ do_autovacuum(PgStat_StatDBEntry *dbentry)
CommitTransactionCommand
();
}
/*
* Returns a copy of the pg_autovacuum tuple for the given relid, or NULL if
* there isn't any. avRel is pg_autovacuum, already open and suitably locked.
*/
static
HeapTuple
get_pg_autovacuum_tuple_relid
(
Relation
avRel
,
Oid
relid
)
{
ScanKeyData
entry
[
1
];
SysScanDesc
avScan
;
HeapTuple
avTup
;
ScanKeyInit
(
&
entry
[
0
],
Anum_pg_autovacuum_vacrelid
,
BTEqualStrategyNumber
,
F_OIDEQ
,
ObjectIdGetDatum
(
relid
));
avScan
=
systable_beginscan
(
avRel
,
AutovacuumRelidIndexId
,
true
,
SnapshotNow
,
1
,
entry
);
avTup
=
systable_getnext
(
avScan
);
if
(
HeapTupleIsValid
(
avTup
))
avTup
=
heap_copytuple
(
avTup
);
systable_endscan
(
avScan
);
return
avTup
;
}
/*
* test_rel_for_autovac
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment