Mon Aug 31 08:15:19 PDT 2009
- Previous message: [Slony1-commit] slony1-engine/doc/adminguide slonik_ref.sgml
- Next message: [Slony1-commit] slony1-engine/src/backend slony1_funcs.v83.sql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv16354
Modified Files:
Tag: REL_2_0_STABLE
slony1_funcs.v83.sql
Log Message:
Add in 8.3 function to check what tables should be left unvacuumed
(because autovac covers this)
Index: slony1_funcs.v83.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.v83.sql,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** slony1_funcs.v83.sql 17 Aug 2009 16:56:09 -0000 1.1.2.1
--- slony1_funcs.v83.sql 31 Aug 2009 15:15:17 -0000 1.1.2.2
***************
*** 10,11 ****
--- 10,54 ----
-- ----------------------------------------------------------------------
+ -- ----------------------------------------------------------------------
+ -- FUNCTION ShouldSlonyVacuumTable (nspname, tabname)
+ --
+ -- Returns 't' if the table needs to be vacuumed by Slony-I
+ -- Returns 'f' if autovac handles the table, so Slony-I should not
+ -- or if the table is not needful altogether
+ -- ----------------------------------------------------------------------
+ create or replace function @NAMESPACE at .ShouldSlonyVacuumTable (name, name) returns boolean as
+ $$
+ declare
+ i_nspname alias for $1;
+ i_tblname alias for $2;
+ c_table oid;
+ c_namespace oid;
+ c_enabled boolean;
+ v_dummy int4;
+ begin
+ select 1 into v_dummy from "pg_catalog".pg_settings where name = 'autovacuum' and setting = 'on';
+ if not found then
+ return 't'::boolean; -- If autovac is turned off, then we gotta vacuum
+ end if;
+
+ select into c_namespace oid from "pg_catalog".pg_namespace where nspname = i_nspname;
+ if not found then
+ raise exception 'Slony-I: namespace % does not exist', i_nspname;
+ end if;
+ select into c_table oid from "pg_catalog".pg_class where relname = i_tblname and relnamespace = c_namespace;
+ if not found then
+ raise warning 'Slony-I: table % does not exist in namespace %/%', tblname, c_namespace, i_nspname;
+ return 'f'::boolean;
+ end if;
+
+ -- So, the table is legit; try to look it up for autovacuum policy
+ if exists (select 1 from pg_catalog.pg_autovacuum where vacrelid = c_table and enabled = 'f') then
+ return 't'::boolean; -- Autovac is turned on, but this table is disabled
+ end if;
+
+ return 'f'::boolean;
+
+ end;$$ language plpgsql;
+
+ comment on function @NAMESPACE at .ShouldSlonyVacuumTable (name, name) is
+ 'returns false if autovacuum handles vacuuming of the table, or if the table does not exist; returns true if Slony-I should manage it';
- Previous message: [Slony1-commit] slony1-engine/doc/adminguide slonik_ref.sgml
- Next message: [Slony1-commit] slony1-engine/src/backend slony1_funcs.v83.sql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list