Mon Aug 20 10:02:30 PDT 2007
- Previous message: [Slony1-commit] slony1-engine/src/backend slony1_base.sql slony1_funcs.sql
- Next message: [Slony1-commit] slony1-engine/src/slon remote_worker.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/tools In directory main.slony.info:/tmp/cvs-serv9726/tools Modified Files: Tag: REL_1_2_STABLE slony1_dump.sh Log Message: I've had it now with the setsync tracking in offline archives. The whole idea to track the setsync status is bogus to begin with, since the real online replica doesn't update the sl_setsync table on every event. I added another table, sl_archive_counter where the log writing slon simply tracks when it wrote the last offline archive file and maintains a counter. This counter is now tracked in the offline replica and must increment gap free. Jan Index: slony1_dump.sh =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/tools/slony1_dump.sh,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -C2 -d -r1.8.2.2 -r1.8.2.3 *** slony1_dump.sh 21 Jun 2007 20:29:13 -0000 1.8.2.2 --- slony1_dump.sh 20 Aug 2007 17:02:28 -0000 1.8.2.3 *************** *** 89,101 **** -- ---------------------------------------------------------------------- ! -- TABLE sl_setsync_offline -- ---------------------------------------------------------------------- ! create table $clname.sl_setsync_offline ( ! ssy_setid int4, ! ssy_seqno int8, ! ssy_synctime timestamptz, ! ! CONSTRAINT "sl_setsync-pkey" ! PRIMARY KEY (ssy_setid) ); --- 89,98 ---- -- ---------------------------------------------------------------------- ! -- TABLE sl_archive_tracking -- ---------------------------------------------------------------------- ! create table $clname.sl_archive_tracking ( ! at_counter bigint, ! at_created timestamp, ! at_applied timestamp ); *************** *** 139,167 **** -- --------------------------------------------------------------------------------------- ! -- FUNCTION setsyncTracking_offline (seq_id, seq_origin, ev_seqno, sync_time) -- --------------------------------------------------------------------------------------- ! create or replace function $clname.setsyncTracking_offline(int4, int8, int8, timestamptz) returns int8 as ' declare ! p_set_id alias for \$1; ! p_old_seq alias for \$2; ! p_new_seq alias for \$3; ! p_sync_time alias for \$4; ! v_row record; begin ! select ssy_seqno into v_row from $clname.sl_setsync_offline ! where ssy_setid = p_set_id for update; if not found then ! raise exception ''Slony-I: set % not found'', p_set_id; end if; ! if v_row.ssy_seqno <> p_old_seq then ! raise exception ''Slony-I: set % is on sync %, this archive log expects %'', ! p_set_id, v_row.ssy_seqno, p_old_seq; end if; ! raise notice ''Slony-I: Process set % sync % time %'', p_set_id, p_new_seq, p_sync_time; ! update $clname.sl_setsync_offline set ssy_seqno = p_new_seq, ssy_synctime = p_sync_time ! where ssy_setid = p_set_id; return p_new_seq; end; --- 136,165 ---- -- --------------------------------------------------------------------------------------- ! -- FUNCTION archiveTracking_offline (new_counter, created_timestamp) -- --------------------------------------------------------------------------------------- ! create or replace function $clname.archiveTracking_offline(int8, timestamp) returns int8 as ' declare ! p_new_seq alias for \$1; ! p_created alias for \$2; ! v_exp_seq int8; ! v_old_seq int8; begin ! select at_counter into v_old_seq from $clname.sl_archive_tracking; if not found then ! raise exception ''Slony-I: current archive tracking status not found''; end if; ! v_exp_seq := p_new_seq - 1; ! if v_old_seq <> v_exp_seq then ! raise exception ''Slony-I: node is on archive counter %, this archive log expects %'', ! v_old_seq, v_exp_seq; end if; ! raise notice ''Slony-I: Process archive with counter % created %'', p_new_seq, p_created; ! update $clname.sl_archive_tracking ! set at_counter = p_new_seq, ! at_created = p_created, ! at_applied = CURRENT_TIMESTAMP; return p_new_seq; end; *************** *** 198,207 **** # Fill the setsync tracking table with the current status # ---- ! echo "select 'insert into $clname.sl_setsync_offline values (' || ! ssy_setid::text || ', ''' || ssy_seqno || ''');' ! from $clname.sl_setsync where exists (select 1 ! from $clname.sl_subscribe ! where ssy_setid = sub_set ! and sub_receiver = $nodeid);" # ---- --- 196,203 ---- # Fill the setsync tracking table with the current status # ---- ! echo "select 'insert into $clname.sl_archive_tracking values (' || ! ac_num::text || ', ''' || ac_timestamp::text || ! ''', CURRENT_TIMESTAMP);' ! from $clname.sl_archive_counter"; # ----
- Previous message: [Slony1-commit] slony1-engine/src/backend slony1_base.sql slony1_funcs.sql
- Next message: [Slony1-commit] slony1-engine/src/slon remote_worker.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list