Sat Nov 13 14:05:07 PST 2004
- Previous message: [Slony1-general] AutoGen Sync event
- Next message: [Slony1-general] Re: [Slony1-commit] By cbbrowne: Add FUNCTION generate_sync_event () - to try to add SYNCs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 11/12/2004 1:17 PM, CVS User Account wrote: > Log Message: > ----------- > Add FUNCTION generate_sync_event () - to try to add SYNCs even if slon isn't running But what calls this function? We can't unload that burden to the application. Jan > > Modified Files: > -------------- > slony1-engine/src/backend: > slony1_funcs.sql (r1.39 -> r1.40) > > > > ------------------------------------------------------------------------ > > Index: slony1_funcs.sql > =================================================================== > RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v > retrieving revision 1.39 > retrieving revision 1.40 > diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.39 -r1.40 > --- src/backend/slony1_funcs.sql > +++ src/backend/slony1_funcs.sql > @@ -4575,6 +4575,33 @@ > allow communications between nodes in the Slony-I cluster.'; > > -- ---------------------------------------------------------------------- > +-- FUNCTION generate_sync_event () > +-- > +-- This code will be run from inside the logtrigger() function, > +-- and will create SYNC events every once in a while... > +-- ---------------------------------------------------------------------- > +create or replace function @NAMESPACE at .generate_sync_event() > +returns int4 > +as ' > +declare > + v_leventtime timestamptz; > + > +BEGIN > + -- When was the last SYNC on this node? > + select ev_timestamp into v_leventtime from @NAMESPACE at .sl_event > + where ev_type = ''SYNC'' and ev_origin = @NAMESPACE at .getLocalNodeId() > + order by ev_origin, ev_seqno desc limit 1; > + > + -- If there has been no SYNC in the last 30 seconds, then push one > + if ev_timestamp + ''30 s''::interval < now() then > + select @NAMESPACE at .createEvent(''@NAMESPACE@'', ''SYNC'', NULL); > + end if; > +END' language plpgsql; > + > +comment on function @NAMESPACE at .generate_sync_event() is > + 'Generate a sync event if there has not been one in 30 seconds.'; > + > +-- ---------------------------------------------------------------------- > -- FUNCTION tableHasSerialKey (tab_fqname) > -- > -- Checks if a table has our special serial key column that is > > > ------------------------------------------------------------------------ > > _______________________________________________ > Slony1-commit mailing list > Slony1-commit at gborg.postgresql.org > http://gborg.postgresql.org/mailman/listinfo/slony1-commit -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck at Yahoo.com #
- Previous message: [Slony1-general] AutoGen Sync event
- Next message: [Slony1-general] Re: [Slony1-commit] By cbbrowne: Add FUNCTION generate_sync_event () - to try to add SYNCs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list