Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions build/configs/postgresql/postgresql_prepare.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,16 @@ BEGIN
CREATE TEMPORARY TABLE pg_patroni_service_slot_cleaner_passwd_output (tt_id serial PRIMARY KEY NOT NULL, command_output text );
COPY pg_patroni_service_slot_cleaner_passwd_output (command_output) FROM PROGRAM 'strings /proc/1/environ | sed -n "s/^PG_ROOT_PASSWORD=\(.*\)/\1/p"';

-- get current wal_keep_segments value and determine allowed_slot_delay
-- get current wal_keep_size value and determine allowed_slot_delay
IF ud_allowed_slot_delay < 0 THEN
SELECT INTO allowed_slot_delay setting FROM pg_settings where name='wal_keep_segments';
SELECT setting::integer INTO allowed_slot_delay FROM pg_settings where name='wal_keep_size';
ELSE
allowed_slot_delay = ud_allowed_slot_delay;
END IF;

-- check if we have pg_xlog_location_diff or not (postgresql 9.6 vs postgresql 10)
select into use_old_cmp_function exists(select * from pg_proc where proname = 'pg_xlog_location_diff');

--todo[anin] 16Mb size per WAL file is used. Honest calculation should get value from pg_settings
allowed_slot_delay := allowed_slot_delay * 16 ;
RAISE NOTICE 'allowed_slot_delay: % Mb', allowed_slot_delay;

-- perform slot cleanup for each active replica
Expand Down