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
88dd4b0a
Commit
88dd4b0a
authored
Nov 03, 2008
by
Alvaro Herrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce the acceptable staleness of pgstat data for autovacuum, per the
longstanding note in the source that this patch removes.
parent
b8fab241
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
src/backend/postmaster/autovacuum.c
src/backend/postmaster/autovacuum.c
+5
-3
src/backend/postmaster/pgstat.c
src/backend/postmaster/pgstat.c
+11
-4
No files found.
src/backend/postmaster/autovacuum.c
View file @
88dd4b0a
...
...
@@ -55,7 +55,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.8
5 2008/11/02 21:24:52 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.8
6 2008/11/03 19:03:41 alvherre
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2149,8 +2149,10 @@ do_autovacuum(void)
* It could have changed if something else processed the table while
* we weren't looking.
*
* FIXME we ignore the possibility that the table was finished being
* vacuumed in the last 500ms (PGSTAT_STAT_INTERVAL). This is a bug.
* Note: we have a special case in pgstat code to ensure that the stats
* we read are as up-to-date as possible, to avoid the problem that
* somebody just finished vacuuming this table. The window to the race
* condition is not closed but it is very small.
*/
MemoryContextSwitchTo
(
AutovacMemCxt
);
tab
=
table_recheck_autovac
(
relid
,
table_toast_map
);
...
...
src/backend/postmaster/pgstat.c
View file @
88dd4b0a
...
...
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2008, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.18
2 2008/11/03 01:17:08 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.18
3 2008/11/03 19:03:41 alvherre
Exp $
* ----------
*/
#include "postgres.h"
...
...
@@ -3381,7 +3381,10 @@ backend_read_statsfile(void)
/*
* We set the minimum acceptable timestamp to PGSTAT_STAT_INTERVAL msec
* before now. This indirectly ensures that the collector needn't write
* the file more often than PGSTAT_STAT_INTERVAL.
* the file more often than PGSTAT_STAT_INTERVAL. In an autovacuum
* worker, however, we want a lower delay to avoid using stale data, so we
* use PGSTAT_RETRY_DELAY (since the number of worker is low, this
* shouldn't be a problem).
*
* Note that we don't recompute min_ts after sleeping; so we might end up
* accepting a file a bit older than PGSTAT_STAT_INTERVAL. In practice
...
...
@@ -3389,8 +3392,12 @@ backend_read_statsfile(void)
* PGSTAT_STAT_INTERVAL; and we don't want to lie to the collector about
* what our cutoff time really is.
*/
min_ts
=
TimestampTzPlusMilliseconds
(
GetCurrentTimestamp
(),
-
PGSTAT_STAT_INTERVAL
);
if
(
IsAutoVacuumWorkerProcess
())
min_ts
=
TimestampTzPlusMilliseconds
(
GetCurrentTimestamp
(),
-
PGSTAT_RETRY_DELAY
);
else
min_ts
=
TimestampTzPlusMilliseconds
(
GetCurrentTimestamp
(),
-
PGSTAT_STAT_INTERVAL
);
/*
* Loop until fresh enough stats file is available or we ran out of time.
...
...
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