Skip to content

Commit 72bc8f5

Browse files
committed
fix: bootrap query for count wal files and return vacuum for count of longest running queary in transaction
1 parent eb2b2df commit 72bc8f5

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

mamonsu/plugins/pgsql/driver/pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ class Pool(object):
1818
'select public.mamonsu_timestamp_get()'
1919
),
2020
'count_xlog_files': (
21-
"select count(*) from pg_catalog.pg_ls_dir('pg_xlog')",
21+
"WITH list(filename) as (SELECT * FROM pg_catalog.pg_ls_dir('pg_xlog')) SELECT COUNT(*)::BIGINT FROM list WHERE filename similar to [0-9A-F]{24}",
2222
'select public.mamonsu_count_xlog_files()'
2323
),
2424
'count_wal_files': (
25-
"select count(*) from pg_catalog.pg_ls_dir('pg_wal')",
25+
"WITH list(filename) as (SELECT * FROM pg_catalog.pg_ls_dir('pg_wal')) SELECT COUNT(*)::BIGINT FROM list WHERE filename similar to [0-9A-F]{24}",
2626
'select public.mamonsu_count_wal_files()'
2727
),
2828
'count_autovacuum': (

mamonsu/tools/bootstrap/sql.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@
7777
FROM pg_catalog.pg_stat_activity
7878
WHERE
7979
pid NOT IN(select pid from pg_stat_replication) AND
80-
pid <> pg_backend_pid() AND
81-
query NOT ilike '%%VACUUM%%'
80+
pid <> pg_backend_pid()
8281
$$ LANGUAGE SQL SECURITY DEFINER;
8382
8483
CREATE OR REPLACE FUNCTION public.mamonsu_count_{3}_files()

0 commit comments

Comments
 (0)