CVS User Account cvsuser
Mon Sep 6 04:42:24 PDT 2004
Log Message:
-----------
Added view sl_status showing the last event sequence of the
local node along with the current catchup status of all remote
nodes.

Jan

Modified Files:
--------------
    slony1-engine/src/backend:
        slony1_base.sql (r1.15 -> r1.16)
        slony1_funcs.sql (r1.20 -> r1.21)

-------------- next part --------------
Index: slony1_base.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_base.sql,v
retrieving revision 1.15
retrieving revision 1.16
diff -Lsrc/backend/slony1_base.sql -Lsrc/backend/slony1_base.sql -u -w -r1.15 -r1.16
--- src/backend/slony1_base.sql
+++ src/backend/slony1_base.sql
@@ -487,6 +487,7 @@
 comment on table @NAMESPACE at .sl_config_lock is 'This table exists solely to prevent overlapping execution of configuration change procedures and the resulting possible deadlocks.
 ';
 
+
 -- ----------------------------------------------------------------------
 -- Last but not least grant USAGE to the replication schema objects.
 -- ----------------------------------------------------------------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.20
retrieving revision 1.21
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.20 -r1.21
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -3870,3 +3870,42 @@
 Checks if a table has our special serial key column that is used if
 the table has no natural unique constraint.';
 
+
+-- **********************************************************************
+-- * Views
+-- **********************************************************************
+
+
+-- ----------------------------------------------------------------------
+-- VIEW sl_status
+--
+--	This view shows the local nodes last event sequence number
+--	and how far all remote nodes have processed events.
+-- ----------------------------------------------------------------------
+create view @NAMESPACE at .sl_status as select
+	ev_origin as st_origin,
+	con_received as st_received,
+	ev_seqno as st_last_event,
+	ev_timestamp as st_last_event_ts,
+	con_seqno as st_last_received,
+	con_timestamp as st_last_received_ts,
+	ev_seqno - con_seqno as lag_num_events,
+	current_timestamp - con_timestamp as lag_time
+	from @NAMESPACE at .sl_event E, @NAMESPACE at .sl_confirm C
+	where ev_origin = con_origin
+	and (E.ev_origin, E.ev_seqno) in 
+		(select ev_origin, max(ev_seqno)
+			from @NAMESPACE at .sl_event
+			where ev_origin = @NAMESPACE at .getLocalNodeId('_ at CLUSTERNAME@')
+			group by 1
+		)
+	and (C.con_origin, C.con_received, C.con_seqno) in
+		(select con_origin, con_received, max(con_seqno)
+			from @NAMESPACE at .sl_confirm
+			where con_origin = @NAMESPACE at .getLocalNodeId('_ at CLUSTERNAME@')
+			group by 1, 2
+		);
+comment on view @NAMESPACE at .sl_status is 'View showing how far behind remote nodes are.
+';
+
+


More information about the Slony1-commit mailing list