Tue Dec 5 10:52:26 PST 2006
- Previous message: [Slony1-commit] By cbbrowne: Bug #1585 - indexes not being shut off when TRUNCATE fails
- Next message: [Slony1-commit] By cbbrowne: Change UPGRADE FUNCTIONS code to not alter the three
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
Modified Files:
--------------
slony1-engine/src/backend:
slony1_funcs.sql (r1.101 -> r1.102)
-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.101
retrieving revision 1.102
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.101 -r1.102
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -4628,6 +4628,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.
-- ----
@@ -5574,6 +5577,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();
@@ -5600,6 +5606,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();
@@ -5806,12 +5815,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;'';
- Previous message: [Slony1-commit] By cbbrowne: Bug #1585 - indexes not being shut off when TRUNCATE fails
- Next message: [Slony1-commit] By cbbrowne: Change UPGRADE FUNCTIONS code to not alter the three
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list