Skip to content

Commit ed2abae

Browse files
committed
rewrite func
1 parent 67bfcce commit ed2abae

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

pkg/cluster/database.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -107,34 +107,6 @@ const (
107107
108108
GRANT pg_execute_server_program TO cpo_exporter;
109109
110-
CREATE OR REPLACE FUNCTION exporter.update_pgbackrest_info()
111-
RETURNS VOID AS $$
112-
DECLARE
113-
last_entry_timestamp TIMESTAMP;
114-
record_count INT;
115-
BEGIN
116-
SELECT COUNT(*) INTO record_count
117-
FROM exporter.pgbackrestbackupinfo;
118-
119-
IF record_count > 0 THEN
120-
SELECT data_time INTO last_entry_timestamp
121-
FROM exporter.pgbackrestbackupinfo
122-
ORDER BY data_time DESC
123-
LIMIT 1;
124-
125-
IF last_entry_timestamp < NOW() - INTERVAL '5 minutes' AND NOT pg_is_in_recovery() THEN
126-
DELETE FROM exporter.pgbackrestbackupinfo;
127-
ELSE
128-
RETURN;
129-
END IF;
130-
END IF;
131-
132-
EXECUTE format(
133-
'COPY exporter.pgbackrestbackupinfo (data) FROM program ''pgbackrest info --output=json'' WITH (FORMAT text, DELIMITER ''|'')'
134-
);
135-
END;
136-
$$ LANGUAGE plpgsql;
137-
138110
CREATE OR REPLACE FUNCTION exporter.update_pgbackrest_info()
139111
RETURNS VOID AS $$
140112
DECLARE

0 commit comments

Comments
 (0)