Chris Browne cbbrowne at lists.slony.info
Thu Jun 11 12:03:47 PDT 2009
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv5001/src/backend

Modified Files:
	slony1_base.sql slony1_funcs.c slony1_funcs.sql 
Log Message:
Draw a whole pile of changes into HEAD from the 2.0 branch



Index: slony1_base.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_base.sql,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** slony1_base.sql	17 Nov 2008 22:40:27 -0000	1.40
--- slony1_base.sql	11 Jun 2009 19:03:44 -0000	1.41
***************
*** 68,72 ****
  comment on column @NAMESPACE at .sl_set.set_origin is 
  	'The ID number of the source node for the replication set.';
! comment on column @NAMESPACE at .sl_set.set_locked is 'Indicates whether or not the set is locked.';
  comment on column @NAMESPACE at .sl_set.set_comment is 'A human-oriented description of the set.';
  
--- 68,72 ----
  comment on column @NAMESPACE at .sl_set.set_origin is 
  	'The ID number of the source node for the replication set.';
! comment on column @NAMESPACE at .sl_set.set_locked is 'Transaction ID where the set was locked.';
  comment on column @NAMESPACE at .sl_set.set_comment is 'A human-oriented description of the set.';
  

Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.148
retrieving revision 1.149
diff -C2 -d -r1.148 -r1.149
*** slony1_funcs.sql	16 Jan 2009 22:59:36 -0000	1.148
--- slony1_funcs.sql	11 Jun 2009 19:03:44 -0000	1.149
***************
*** 199,202 ****
--- 199,228 ----
  select @NAMESPACE at .checkmoduleversion();
  
+ -----------------------------------------------------------------------
+ -- This function checks to see if the namespace name is valid.  
+ --
+ -- Apparently pgAdminIII does different validation than Slonik, and so
+ -- users that set up cluster names using pgAdminIII can get in trouble in
+ -- that they do not get around to needing Slonik until it is too
+ -- late...
+ -----------------------------------------------------------------------
+ 
+ create or replace function @NAMESPACE at .check_namespace_validity () returns boolean as $$
+ declare
+ 	c_cluster text;
+ begin
+ 	c_cluster := '@CLUSTERNAME@';
+ 	if c_cluster !~ E'^[[:alpha:]_][[:alnum:]_\$]{0,62}$' then
+ 		raise exception 'Cluster name % is not a valid SQL symbol!', c_cluster;
+ 	else
+ 		raise notice 'checked validity of cluster % namespace - OK!', c_cluster;
+ 	end if;
+ 	return 't';
+ end
+ $$ language plpgsql;
+ 
+ select @NAMESPACE at .check_namespace_validity();
+ drop function @NAMESPACE at .check_namespace_validity();
+ 
  -- ----------------------------------------------------------------------
  -- FUNCTION logTrigger ()
***************
*** 408,412 ****
  as $$
  begin
! 	return 0;
  end;
  $$ language plpgsql;
--- 434,438 ----
  as $$
  begin
! 	return 2;
  end;
  $$ language plpgsql;
***************
*** 5033,5036 ****
--- 5059,5063 ----
          v_no_id                 int4;
          v_set_origin            int4;
+ 	prec			record;
  begin
          -- ----
***************
*** 5066,5069 ****
--- 5093,5104 ----
                  return 0;
          end if;
+ 
+ 	-- Update OIDs for tables to values pulled from non-table objects in pg_class
+ 	-- This ensures that we won't have collisions when repairing the oids
+ 	for prec in select tab_id from @NAMESPACE at .sl_table loop
+ 		update @NAMESPACE at .sl_table set tab_reloid = (select oid from pg_class pc where relkind <> 'r' and not exists (select 1 from @NAMESPACE at .sl_table t2 where t2.tab_reloid = pc.oid) limit 1)
+ 		where tab_id = prec.tab_id;
+ 	end loop;
+ 
          update @NAMESPACE at .sl_table set
                  tab_reloid = PGC.oid
***************
*** 5073,5076 ****
--- 5108,5116 ----
  			and @NAMESPACE at .slon_quote_brute(PGN.nspname) = @NAMESPACE at .slon_quote_brute(@NAMESPACE at .sl_table.tab_nspname);
  
+ 	for prec in select seq_id from @NAMESPACE at .sl_sequence loop
+ 		update @NAMESPACE at .sl_sequence set seq_reloid = (select oid from pg_class pc where relkind <> 'S' and not exists (select 1 from @NAMESPACE at .sl_sequence t2 where t2.tab_reloid = pc.oid) limit 1)
+ 		where tab_id = prec.seq_id;
+ 	end loop;
+ 
          update @NAMESPACE at .sl_sequence set
                  seq_reloid = PGC.oid
***************
*** 5390,5452 ****
  		v_tab_row	record;
  begin
! 	-- ----
! 	-- Changes for 2.0
! 	-- ----
! 	if p_old IN ('1.0.2', '1.0.5', '1.0.6',
! 			'1.1.0', '1.1.1', '1.1.2', '1.1.3', '1.1.5', '1.1.6', '1.1.7', '1.1.8', '1.1.9') then
! 		raise exception 'Upgrading to Slony-I 2.x requires running 1.2.x';
! 	end if;
! 
! 	if p_old IN ('1.2.0', '1.2.1', '1.2.2', '1.2.3', '1.2.4', '1.2.5', '1.2.6', '1.2.7', '1.2.8', '1.2.9', '1.2.10', '1.2.11', '1.2.12', '1.2.13', '1.2.14', '1.2.15', '1.2.16') then
! 		-- ---- 
! 		-- Upgrading from a pre-2.0 ... repair the system catalog
! 		-- ----
! 		for v_tab_row in select * from @NAMESPACE at .sl_table order by tab_id loop
! 			perform @NAMESPACE at .alterTableRestore(v_tab_row.tab_id);
! 		end loop;
! 
! 		-- ----
! 		-- drop obsolete functions
! 		-- ----
! 		execute 'drop function @NAMESPACE at .alterTableForReplication(int4)';
! 		execute 'drop function @NAMESPACE at .pre74()';
! 
! 		-- ----
! 		-- and create the new versions of the log and deny access triggers.
! 		-- ----
! 		for v_tab_row in select * from @NAMESPACE at .sl_table order by tab_id loop
! 			perform @NAMESPACE at .alterTableAddTriggers(v_tab_row.tab_id);
! 			perform @NAMESPACE at .alterTableConfigureTriggers(v_tab_row.tab_id);
! 		end loop;
! 
! 		-- ----
! 		-- Drop no_spool from sl_node
! 		-- ----
! 		execute 'alter table @NAMESPACE at .sl_node drop column no_spool;';
! 
! 		-- ----
! 		-- Drop sl_trigger
! 		-- ----
! 		execute 'drop table @NAMESPACE at .sl_trigger;';
! 
! 		execute 'alter table @NAMESPACE at .sl_event add column ev_snapshot "pg_catalog".txid_snapshot;';
! 		execute 'alter table @NAMESPACE at .sl_set_sync add column ev_snapshot "pg_catalog".txid_snapshot;';
! 	end if;
! 
! 	-- ----
! 	-- The following is already in 1.2.11, do not add any future
! 	-- 1.2 version numbers.
! 	-- ----
! 	if p_old IN ('1.2.0', '1.2.1', '1.2.2', '1.2.3', '1.2.4', '1.2.5', '1.2.6', '1.2.7', '1.2.8', '1.2.9', '1.2.10') then
! 		-- ----
! 		-- Add new table sl_archive_counter
! 		-- ----
! 		execute 'create table @NAMESPACE at .sl_archive_counter (
! 					ac_num			bigint,
! 					ac_timestamp	timestamp
! 				) without oids';
! 		execute 'insert into @NAMESPACE at .sl_archive_counter
! 				(ac_num, ac_timestamp) values (0, ' || pg_catalog.quote_literal('epoch') || '::timestamp)';
! 
  	end if;
  
--- 5430,5436 ----
  		v_tab_row	record;
  begin
! 	-- If old version is pre-2.0, then we require a special upgrade process
! 	if p_old like '1.%' then
! 		raise exception 'Upgrading to Slony-I 2.x requires running slony_upgrade_20';
  	end if;
  
***************
*** 5864,5865 ****
--- 5848,5850 ----
  tab_idxname is optional - if NULL, then we use the primary key.
  This function looks up replication configuration via the parent table.';
+ 



More information about the Slony1-commit mailing list