File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,13 @@ CREATE TABLE replicas (
46
46
PRIMARY KEY (part_name,node_id)
47
47
);
48
48
49
+ -- View for monitoring replication lag
50
+ CREATE VIEW replication_lag (pubnode, subnode, lag) AS
51
+ SELECT src .id AS srcnode, dst .id AS dstnode,
52
+ shardman .broadcast (format(' %s:SELECT pg_current_wal_lsn() - confirmed_flush_lsn FROM pg_replication_slots WHERE slot_name=' ' node_%s' ' ;' ,
53
+ src .id , dst .id ))::bigint AS lag
54
+ FROM shardman .nodes src, shardman .nodes dst WHERE src .id <> dst .id ;
55
+
49
56
-- Shardman interface functions
50
57
51
58
-- Add a node: adjust logical replication channels in replication group and
@@ -1076,8 +1083,6 @@ BEGIN
1076
1083
END
1077
1084
$$ LANGUAGE plpgsql;
1078
1085
1079
-
1080
-
1081
1086
-- -------------------------------------------------------------------
1082
1087
-- Utility functions
1083
1088
-- -------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments