Chris Browne cbbrowne at lists.slony.info
Tue Jul 21 14:18:45 PDT 2009
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv8788/src/backend

Modified Files:
	Makefile slony1_base.sql slony1_base.v83.sql slony1_funcs.sql 
Log Message:
Autovacuum changes recently made to 2.0 branch
test tool changes recently made to 2.0 branch


Index: slony1_base.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_base.sql,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** slony1_base.sql	11 Jun 2009 19:03:44 -0000	1.41
--- slony1_base.sql	21 Jul 2009 21:18:43 -0000	1.42
***************
*** 470,473 ****
--- 470,474 ----
  create sequence @NAMESPACE at .sl_event_seq;
  comment on sequence @NAMESPACE at .sl_event_seq is 'The sequence for numbering events originating from this node.';
+ select setval('@NAMESPACE at .sl_event_seq', 5000000000);
  
  -- ----------------------------------------------------------------------
***************
*** 534,541 ****
  comment on column @NAMESPACE at .sl_config_lock.dummy is 'No data ever goes in this table so the contents never matter.  Indeed, this column does not really need to exist.';
  
- create type @NAMESPACE at .vactables as (nspname name, relname name);
- 
- comment on type @NAMESPACE at .vactables is 'used as return type for SRF function TablesToVacuum';
- 
  -- ----------------------------------------------------------------------
  -- TABLE sl_archive_counter
--- 535,538 ----

Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.149
retrieving revision 1.150
diff -C2 -d -r1.149 -r1.150
*** slony1_funcs.sql	11 Jun 2009 19:03:44 -0000	1.149
--- slony1_funcs.sql	21 Jul 2009 21:18:43 -0000	1.150
***************
*** 434,438 ****
  as $$
  begin
! 	return 2;
  end;
  $$ language plpgsql;
--- 434,438 ----
  as $$
  begin
! 	return 3;
  end;
  $$ language plpgsql;
***************
*** 4100,4106 ****
  
  -- ----------------------------------------------------------------------
! -- FUNCTION subscribeSet (sub_set, sub_provider, sub_receiver, sub_forward)
  -- ----------------------------------------------------------------------
! create or replace function @NAMESPACE at .subscribeSet (int4, int4, int4, bool)
  returns bigint
  as $$
--- 4100,4106 ----
  
  -- ----------------------------------------------------------------------
! -- FUNCTION subscribeSet (sub_set, sub_provider, sub_receiver, sub_forward, omit_copy)
  -- ----------------------------------------------------------------------
! create or replace function @NAMESPACE at .subscribeSet (int4, int4, int4, bool, bool)
  returns bigint
  as $$
***************
*** 4110,4113 ****
--- 4110,4114 ----
  	p_sub_receiver		alias for $3;
  	p_sub_forward		alias for $4;
+ 	p_omit_copy		alias for $5;
  	v_set_origin		int4;
  	v_ev_seqno			int8;
***************
*** 4119,4122 ****
--- 4120,4125 ----
  	lock table @NAMESPACE at .sl_config_lock;
  
+ 	raise notice 'subscribe set: omit_copy=%', p_omit_copy;
+ 
  	-- ----
  	-- Check that this is called on the provider node
***************
*** 4162,4166 ****
  	v_ev_seqno :=  @NAMESPACE at .createEvent('_ at CLUSTERNAME@', 'SUBSCRIBE_SET', 
  			p_sub_set::text, p_sub_provider::text, p_sub_receiver::text, 
! 			case p_sub_forward when true then 't' else 'f' end);
  
  	-- ----
--- 4165,4171 ----
  	v_ev_seqno :=  @NAMESPACE at .createEvent('_ at CLUSTERNAME@', 'SUBSCRIBE_SET', 
  			p_sub_set::text, p_sub_provider::text, p_sub_receiver::text, 
! 			case p_sub_forward when true then 't' else 'f' end,
! 			case p_omit_copy when true then 't' else 'f' end
!                         );
  
  	-- ----
***************
*** 4168,4186 ****
  	-- ----
  	perform @NAMESPACE at .subscribeSet_int(p_sub_set, p_sub_provider,
! 			p_sub_receiver, p_sub_forward);
  
  	return v_ev_seqno;
  end;
  $$ language plpgsql;
! comment on function @NAMESPACE at .subscribeSet (int4, int4, int4, bool) is
! 'subscribeSet (sub_set, sub_provider, sub_receiver, sub_forward)
  
  Makes sure that the receiver is not the provider, then stores the
! subscription, and publishes the SUBSCRIBE_SET event to other nodes.';
  
! -- ----------------------------------------------------------------------
! -- FUNCTION subscribeSet_int (sub_set, sub_provider, sub_receiver, sub_forward)
! -- ----------------------------------------------------------------------
! create or replace function @NAMESPACE at .subscribeSet_int (int4, int4, int4, bool)
  returns int4
  as $$
--- 4173,4194 ----
  	-- ----
  	perform @NAMESPACE at .subscribeSet_int(p_sub_set, p_sub_provider,
! 			p_sub_receiver, p_sub_forward, p_omit_copy);
  
  	return v_ev_seqno;
  end;
  $$ language plpgsql;
! comment on function @NAMESPACE at .subscribeSet (int4, int4, int4, bool, bool) is
! 'subscribeSet (sub_set, sub_provider, sub_receiver, sub_forward, omit_copy)
  
  Makes sure that the receiver is not the provider, then stores the
! subscription, and publishes the SUBSCRIBE_SET event to other nodes.
  
! If omit_copy is true, then no data copy will be done.
! ';
! 
! -- -------------------------------------------------------------------------------------------
! -- FUNCTION subscribeSet_int (sub_set, sub_provider, sub_receiver, sub_forward, omit_copy)
! -- -------------------------------------------------------------------------------------------
! create or replace function @NAMESPACE at .subscribeSet_int (int4, int4, int4, bool, bool)
  returns int4
  as $$
***************
*** 4190,4193 ****
--- 4198,4202 ----
  	p_sub_receiver		alias for $3;
  	p_sub_forward		alias for $4;
+ 	p_omit_copy		alias for $5;
  	v_set_origin		int4;
  	v_sub_row			record;
***************
*** 4198,4201 ****
--- 4207,4212 ----
  	lock table @NAMESPACE at .sl_config_lock;
  
+ 	raise notice 'subscribe set: omit_copy=%', p_omit_copy;
+ 
  	-- ----
  	-- Provider change is only allowed for active sets
***************
*** 4261,4265 ****
  		perform @NAMESPACE at .createEvent('_ at CLUSTERNAME@', 'ENABLE_SUBSCRIPTION', 
  				p_sub_set::text, p_sub_provider::text, p_sub_receiver::text, 
! 				case p_sub_forward when true then 't' else 'f' end);
  		perform @NAMESPACE at .enableSubscription(p_sub_set, 
  				p_sub_provider, p_sub_receiver);
--- 4272,4278 ----
  		perform @NAMESPACE at .createEvent('_ at CLUSTERNAME@', 'ENABLE_SUBSCRIPTION', 
  				p_sub_set::text, p_sub_provider::text, p_sub_receiver::text, 
! 				case p_sub_forward when true then 't' else 'f' end,
! 				case p_omit_copy when true then 't' else 'f' end
! 				);
  		perform @NAMESPACE at .enableSubscription(p_sub_set, 
  				p_sub_provider, p_sub_receiver);
***************
*** 4275,4280 ****
  $$ language plpgsql;
  
! comment on function @NAMESPACE at .subscribeSet_int (int4, int4, int4, bool) is
! 'subscribeSet_int (sub_set, sub_provider, sub_receiver, sub_forward)
  
  Internal actions for subscribing receiver sub_receiver to subscription
--- 4288,4293 ----
  $$ language plpgsql;
  
! comment on function @NAMESPACE at .subscribeSet_int (int4, int4, int4, bool, bool) is
! 'subscribeSet_int (sub_set, sub_provider, sub_receiver, sub_forward, omit_copy)
  
  Internal actions for subscribing receiver sub_receiver to subscription
***************
*** 4405,4409 ****
  
  -- ----------------------------------------------------------------------
! -- FUNCTION enableSubscription (sub_set, sub_provider, sub_receiver)
  -- ----------------------------------------------------------------------
  create or replace function @NAMESPACE at .enableSubscription (int4, int4, int4)
--- 4418,4422 ----
  
  -- ----------------------------------------------------------------------
! -- FUNCTION enableSubscription (sub_set, sub_provider, sub_receiver, omit_copy)
  -- ----------------------------------------------------------------------
  create or replace function @NAMESPACE at .enableSubscription (int4, int4, int4)
***************
*** 4427,4433 ****
  enableSubscription_int (sub_set, sub_provider, sub_receiver).';
  
! -- ----------------------------------------------------------------------
  -- FUNCTION enableSubscription_int (sub_set, sub_provider, sub_receiver)
! -- ----------------------------------------------------------------------
  create or replace function @NAMESPACE at .enableSubscription_int (int4, int4, int4)
  returns int4
--- 4440,4446 ----
  enableSubscription_int (sub_set, sub_provider, sub_receiver).';
  
! -- -----------------------------------------------------------------------------------
  -- FUNCTION enableSubscription_int (sub_set, sub_provider, sub_receiver)
! -- -----------------------------------------------------------------------------------
  create or replace function @NAMESPACE at .enableSubscription_int (int4, int4, int4)
  returns int4
***************
*** 5607,5660 ****
  'Reenable index maintenance and reindex the table';
  
- 
- -- ----------------------------------------------------------------------
- -- 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
- 	select enabled into c_enabled from "pg_catalog".pg_autovacuum where vacrelid = c_table;
- 
- 	if not found then
- 		return 'f'::boolean;   -- Autovac is turned on, and this table has no overriding handling
- 	end if;
- 
- 	if c_enabled then
- 		return 'f'::boolean;   -- Autovac is expressly turned on for this table
- 	end if;
- 
- 	return 't'::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';
- 
  create or replace function @NAMESPACE at .setup_vactables_type () returns integer as $$
  begin
--- 5620,5623 ----

Index: Makefile
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/Makefile,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Makefile	7 Jun 2007 13:01:10 -0000	1.26
--- Makefile	21 Jul 2009 21:18:43 -0000	1.27
***************
*** 25,28 ****
--- 25,30 ----
  BASE_83			= slony1_base.v83.sql
  FUNCS_83		= slony1_funcs.v83.sql
+ BASE_84			= slony1_base.v84.sql
+ FUNCS_84		= slony1_funcs.v84.sql
  
  SQL_NAMES =				\
***************
*** 30,34 ****
  	$(FUNCS_COMMON)		\
  	$(BASE_83)			\
! 	$(FUNCS_83)
  
  DISTFILES = Makefile README README.events $(wildcard *.sql) $(wildcard *.in) $(wildcard *.c)
--- 32,38 ----
  	$(FUNCS_COMMON)		\
  	$(BASE_83)			\
! 	$(BASE_84)			\
! 	$(FUNCS_83)			\
! 	$(FUNCS_84)
  
  DISTFILES = Makefile README README.events $(wildcard *.sql) $(wildcard *.in) $(wildcard *.c)

Index: slony1_base.v83.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_base.v83.sql,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** slony1_base.v83.sql	31 May 2007 18:55:28 -0000	1.1
--- slony1_base.v83.sql	21 Jul 2009 21:18:43 -0000	1.2
***************
*** 10,12 ****
--- 10,16 ----
  -- ----------------------------------------------------------------------
  
+ create type @NAMESPACE at .vactables as (nspname name, relname name);
+ 
+ comment on type @NAMESPACE at .vactables is 'used as return type for SRF function TablesToVacuum';
+ 
  



More information about the Slony1-commit mailing list