[prev in list] [next in list] [prev in thread] [next in thread]
List: slony1-commit
Subject: [Slony1-commit] By cbbrowne: As noticed by AndyY,
From: cvsuser () gborg ! postgresql ! org (CVS User Account)
Date: 2006-08-14 20:38:55
Message-ID: 20060814203856.0C61011BF037 () gborg ! postgresql ! org
[Download RAW message or body]
Log Message:
-----------
As noticed by AndyY, there was a problem with creation of extra sl_log_?
indices in the function addPartialLogIndices(); it wasn't recognizing when
indices were already in place.
Revised it to search pg_indexes better, and ran through cases where it
was expected to both create and add indices. All's well now...
http://rafb.net/paste/results/oRWz8l49.html
Modified Files:
--------------
slony1-engine/src/backend:
slony1_funcs.sql (r1.94 -> r1.95)
-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.94
retrieving revision 1.95
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.94 \
-r1.95
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -5602,8 +5602,10 @@
v_current_status int4;
v_log int4;
v_dummy record;
+ v_dummy2 record;
idef text;
v_count int4;
+ v_iname text;
BEGIN
v_count := 0;
select last_value into v_current_status from @NAMESPACE at .sl_log_status;
@@ -5618,26 +5620,32 @@
else
v_log := 1;
end if;
-
+-- PartInd_test_db_sl_log_2-node-1
-- Add missing indices...
- for v_dummy in select distinct set_origin from @NAMESPACE at .sl_set
- where not exists
- (select * from pg_catalog.pg_indexes where schemaname = \
''@NAMESPACE@''
- and tablename = ''sl_log_'' || v_log and
- indexname = ''PartInd_ at CLUSTERNAME@_sl_log_'' || v_log || \
''-node-'' || set_origin) loop + for v_dummy in select distinct set_origin from \
@NAMESPACE at .sl_set loop + v_iname := ''PartInd_ at \
CLUSTERNAME@_sl_log_'' || v_log || ''-node-'' || v_dummy.set_origin; + raise \
notice ''Consider adding partial index % on sl_log_%'', v_iname, v_log; + raise \
notice ''schema: [_ at CLUSTERNAME@] tablename:[sl_log_%]'', v_log; + \
select * into v_dummy2 from pg_catalog.pg_indexes where tablename = ''sl_log_'' || \
v_log and indexname = v_iname; + if not found then
+ raise notice ''index was not found - add it!'';
idef := ''create index "PartInd_ at CLUSTERNAME@_sl_log_'' || v_log || ''-node-'' \
|| v_dummy.set_origin || ''" on @NAMESPACE at .sl_log_'' || v_log || '' USING \
btree(log_xid @NAMESPACE at .xxid_ops) where (log_origin = '' || v_dummy.set_origin \
|| '');''; execute idef;
v_count := v_count + 1;
+ else
+ raise notice ''Index % already present - skipping'', v_iname;
+ end if;
end loop;
-- Remove unneeded indices...
- for v_dummy in select indexname from pg_catalog.pg_indexes i where i.schemaname = \
''@NAMESPACE''
- and i.tablename = ''sl_log_'' || v_log and
+ for v_dummy in select indexname from pg_catalog.pg_indexes i where i.tablename = \
''sl_log_'' || v_log and + i.indexname like (''PartInd_ at \
CLUSTERNAME@_sl_log_'' || v_log || ''-node-%'') and
not exists (select 1 from @NAMESPACE at .sl_set where
i.indexname = ''PartInd_ at CLUSTERNAME@_sl_log_'' || v_log || ''-node-'' || \
set_origin) loop
- idef := ''drop index "@NAMESPACE@"."'' || v_dummy.indexname || ''";'';
+ raise notice ''Dropping obsolete index %d'', v_dummy.indexname;
+ idef := ''drop index @NAMESPACE at ."'' || v_dummy.indexname || ''";'';
execute idef;
v_count := v_count - 1;
end loop;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic