CVS User Account cvsuser
Tue Dec 5 10:53:08 PST 2006
Log Message:
-----------
Change UPGRADE FUNCTIONS code to not alter the three (potentially) large 
tables sl_log_1, sl_log_2, sl_seqlog to drop off OIDS.

Instead, sl_log_1/2 are checked at TRUNCATE time (when we are rotating
between the tables) to see if they still have OIDs, and drop the column
_then_...

sl_seqlog has OIDs removed in the cleanup loop, which means that if this
runs long, it isn't in any user-visible "loop."

This (mostly) resolves the issue pointed out on IRC by X-Fade that the 
series of "alter table [internal slony table] set WITHOUT OIDS;" demands
locks on all the Slony-I tables, in effect requiring a [hopefully small
but] nonzero outage time for applications.

Tags:
----
REL_1_2_STABLE

Modified Files:
--------------
    slony1-engine/src/backend:
        slony1_funcs.sql (r1.98.2.4 -> r1.98.2.5)

-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.98.2.4
retrieving revision 1.98.2.5
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.98.2.4 -r1.98.2.5
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -4629,6 +4629,9 @@
 
         end if;
 
+	if exists (select * from "pg_catalog".pg_class c, "pg_catalog".pg_namespace n, "pg_catalog".pg_attribute a where c.relname = ''sl_seqlog'' and n.oid = c.relnamespace and a.attrelid = c.oid and a.attname = ''oid'') then
+                execute ''alter table @NAMESPACE at .sl_seqlog set without oids;'';
+	end if;		
 	-- ----
 	-- Also remove stale entries from the nodelock table.
 	-- ----
@@ -5575,6 +5578,9 @@
 
 		raise notice ''Slony-I: log switch to sl_log_1 complete - truncate sl_log_2'';
 		truncate @NAMESPACE at .sl_log_2;
+		if exists (select * from "pg_catalog".pg_class c, "pg_catalog".pg_namespace n, "pg_catalog".pg_attribute a where c.relname = ''sl_log_2'' and n.oid = c.relnamespace and a.attrelid = c.oid and a.attname = ''oid'') then
+	                execute ''alter table @NAMESPACE at .sl_log_2 set without oids;'';
+		end if;		
 		perform "pg_catalog".setval(''@NAMESPACE at .sl_log_status'', 0);
 		-- Run addPartialLogIndices() to try to add indices to unused sl_log_? table
 		perform @NAMESPACE at .addPartialLogIndices();
@@ -5601,6 +5607,9 @@
 
 		raise notice ''Slony-I: log switch to sl_log_2 complete - truncate sl_log_1'';
 		truncate @NAMESPACE at .sl_log_1;
+		if exists (select * from "pg_catalog".pg_class c, "pg_catalog".pg_namespace n, "pg_catalog".pg_attribute a where c.relname = ''sl_log_1'' and n.oid = c.relnamespace and a.attrelid = c.oid and a.attname = ''oid'') then
+	                execute ''alter table @NAMESPACE at .sl_log_1 set without oids;'';
+		end if;		
 		perform "pg_catalog".setval(''@NAMESPACE at .sl_log_status'', 1);
 		-- Run addPartialLogIndices() to try to add indices to unused sl_log_? table
 		perform @NAMESPACE at .addPartialLogIndices();
@@ -5807,12 +5816,9 @@
                 execute ''alter table @NAMESPACE at .sl_confirm set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_event set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_listen set without oids;'';
-                execute ''alter table @NAMESPACE at .sl_log_1 set without oids;'';
-                execute ''alter table @NAMESPACE at .sl_log_2 set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_node set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_nodelock set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_path set without oids;'';
-                execute ''alter table @NAMESPACE at .sl_seqlog set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_sequence set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_set set without oids;'';
                 execute ''alter table @NAMESPACE at .sl_setsync set without oids;'';



More information about the Slony1-commit mailing list