Commit 80f6c358 authored by Tom Lane's avatar Tom Lane

Remove contrib version of pg_autovacuum --- superseded by integrated

version.
parent 5d5f1a79
# $PostgreSQL: pgsql/contrib/Makefile,v 1.59 2005/07/29 15:13:10 momjian Exp $
# $PostgreSQL: pgsql/contrib/Makefile,v 1.60 2005/07/29 19:38:21 tgl Exp $
subdir = contrib
top_builddir = ..
......@@ -20,7 +20,6 @@ WANTED_DIRS = \
lo \
ltree \
oid2name \
pg_autovacuum \
pg_buffercache \
pg_trgm \
pgbench \
......
......@@ -102,10 +102,6 @@ oracle -
Converts Oracle database schema to PostgreSQL
by Gilles Darold <gilles@darold.net>
pg_autovacuum -
Automatically performs vacuum
by Matthew T. O'Connor <matthew@zeut.net>
pg_buffercache -
Real time queries on the shared buffer cache
by Mark Kirkwood <markir@paradise.net.nz>
......@@ -142,7 +138,7 @@ tablefunc -
Examples of functions returning tables
by Joe Conway <mail@joeconway.com>
tips/apache_logging -
tips -
Getting Apache to log to PostgreSQL
by Terry Mackintosh <terry@terrym.com>
......
PROGRAM = pg_autovacuum
OBJS = pg_autovacuum.o dllist.o
PG_CPPFLAGS = -I$(libpq_srcdir) -DFRONTEND
PG_LIBS = $(libpq_pgport)
DOCS = README.pg_autovacuum
EXTRA_CLEAN = dllist.c
ifdef USE_PGXS
PGXS = $(shell pg_config --pgxs)
include $(PGXS)
else
subdir = contrib/pg_autovacuum
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
dllist.c: $(top_srcdir)/src/backend/lib/dllist.c
rm -f $@ && $(LN_S) $< .
This diff is collapsed.
Todo Items for pg_autovacuum client
--------------------------------------------------------------------------
_Add Startup Message (with datetime stamp) to Logfile when starting and logging
_create a FSM export function and see if I can use it for pg_autovacuum
_look into possible benifits of pgstattuple contrib work
_Continue trying to reduce server load created by polling.
Done:
--------------------------------------------------------------------------
_Check if required pg_stats are enables, if not exit with error
_Reduce the number connections and queries to the server
_Make database adding and removal part of the normal loop
_make table adding and removal part of the normal loop
_Separate logic for vacuum and analyze
_all pg_autovacuum specific functions are now static
_correct usage of snprintf
_reworked database and table update functions, now they
use the existing database connection and only one query
_fixed -h option output
_cleanup of 'constant == variable' used much more consistently now.
_Guarantee database wide vacuum prior to Xid wraparound
_change name to pg_autovacuum
_Add proper table and database removal functions so that we can properly
clear up before we exit, and make sure we don't leak memory when removing tables and such.
_Decouple insert and delete thresholds
_Fix Vacuum debug routine to include the database name.
_Allow it to detach from the tty
This diff is collapsed.
/* pg_autovacuum.h
* Header file for pg_autovacuum.c
* (c) 2003 Matthew T. O'Connor
*
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.h,v 1.15 2005/04/19 03:35:15 momjian Exp $
*/
#ifndef _PG_AUTOVACUUM_H
#define _PG_AUTOVACUUM_H
#include "libpq-fe.h"
#include "lib/dllist.h"
#define AUTOVACUUM_DEBUG 0
#define VACBASETHRESHOLD 1000
#define VACSCALINGFACTOR 2
#define SLEEPBASEVALUE 300
#define SLEEPSCALINGFACTOR 2
#define UPDATE_INTERVAL 2
/* these two constants are used to tell update_table_stats what operation we just perfomred */
#define VACUUM_ANALYZE 0
#define ANALYZE_ONLY 1
#define TABLE_STATS_QUERY "select a.oid,a.relname,a.relnamespace,a.relpages,a.relisshared,a.reltuples,b.schemaname,b.n_tup_ins,b.n_tup_upd,b.n_tup_del from pg_class a, pg_stat_all_tables b where a.oid=b.relid and a.relkind = 'r'"
#define PAGES_QUERY "select oid,reltuples,relpages from pg_class where oid=%u"
#define FROZENOID_QUERY "select oid,age(datfrozenxid) from pg_database where datname = 'template1'"
#define FROZENOID_QUERY2 "select oid,datname,age(datfrozenxid) from pg_database where datname!='template0'"
/* Log levels */
enum
{
LVL_DEBUG = 1,
LVL_INFO,
LVL_WARNING,
LVL_ERROR,
LVL_EXTRA
};
/* define cmd_args stucture */
typedef struct cmdargs
{
int vacuum_base_threshold,
analyze_base_threshold,
update_interval,
sleep_base_value,
debug,
/*
* Cost-Based Vacuum Delay Settings for pg_autovacuum
*/
av_vacuum_cost_delay,
av_vacuum_cost_page_hit,
av_vacuum_cost_page_miss,
av_vacuum_cost_page_dirty,
av_vacuum_cost_limit,
#ifndef WIN32
daemonize;
#else
install_as_service,
remove_as_service;
#endif
float vacuum_scaling_factor,
analyze_scaling_factor,
sleep_scaling_factor;
char *user,
*password,
#ifdef WIN32
*service_dependencies,
*service_user,
*service_password,
#endif
*host,
*logfile,
*port;
} cmd_args;
/*
* Might need to add a time value for last time the whole database was
* vacuumed. We need to guarantee this happens approx every 1Billion TX's
*/
typedef struct dbinfo
{
Oid oid;
long age;
long analyze_threshold,
vacuum_threshold; /* Use these as defaults for table
* thresholds */
PGconn *conn;
char *dbname,
*username,
*password;
Dllist *table_list;
} db_info;
typedef struct tableinfo
{
char *schema_name,
*table_name;
float reltuples;
int relisshared;
Oid relid,
relpages;
long analyze_threshold,
vacuum_threshold;
long CountAtLastAnalyze; /* equal to: inserts + updates as
* of the last analyze or initial
* values at startup */
long CountAtLastVacuum; /* equal to: deletes + updates as
* of the last vacuum or initial
* values at startup */
long curr_analyze_count,
curr_vacuum_count; /* Latest values from stats system */
db_info *dbi; /* pointer to the database that this table
* belongs to */
} tbl_info;
#endif /* _PG_AUTOVACUUM_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment