v29--v30-diff-for-0004.patch
text/x-patch
Filename: v29--v30-diff-for-0004.patch
Type: text/x-patch
Part: 5
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v29
Subject: fixes for 0004
| File | + | − |
|---|---|---|
| src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl | 36 | 25 |
From 2490e0f492096d33f56eb8d0a2a3da35434dfa1a Mon Sep 17 00:00:00 2001
From: Daniil Davidov <d.davydov@postgrespro.ru>
Date: Thu, 19 Mar 2026 21:25:40 +0700
Subject: [PATCH] fixes for 0004
---
.../t/001_parallel_autovacuum.pl | 61 +++++++++++--------
1 file changed, 36 insertions(+), 25 deletions(-)
diff --git a/src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl b/src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl
index 2f34999d25e..0364019d5f0 100644
--- a/src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl
+++ b/src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl
@@ -17,12 +17,14 @@ sub prepare_for_next_test
{
my ($node, $test_number) = @_;
- $node->safe_psql('postgres', qq{
+ $node->safe_psql(
+ 'postgres', qq{
ALTER TABLE test_autovac SET (autovacuum_enabled = false);
UPDATE test_autovac SET col_1 = $test_number;
});
- my $count = $node->safe_psql('postgres', qq{
+ my $count = $node->safe_psql(
+ 'postgres', qq{
SELECT autovacuum_count FROM pg_stat_user_tables WHERE relname = 'test_autovac'
});
@@ -34,7 +36,8 @@ sub wait_for_autovacuum_complete
{
my ($node, $old_count) = @_;
- $node->poll_query_until('postgres', qq{
+ $node->poll_query_until(
+ 'postgres', qq{
SELECT autovacuum_count > $old_count FROM pg_stat_user_tables WHERE relname = 'test_autovac'
});
}
@@ -46,7 +49,8 @@ $node->init;
# Configure postgres, so it can launch parallel autovacuum workers, log all
# information we are interested in and autovacuum works frequently
-$node->append_conf('postgresql.conf', qq{
+$node->append_conf(
+ 'postgresql.conf', qq{
max_worker_processes = 20
max_parallel_workers = 20
autovacuum_max_parallel_workers = 4
@@ -65,7 +69,8 @@ if (!$node->check_extension('injection_points'))
}
# Create all functions needed for testing
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
CREATE EXTENSION injection_points;
});
@@ -74,7 +79,8 @@ my $initial_rows_num = 10_000;
my $autovacuum_parallel_workers = 2;
# Create table and fill it with some data
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
CREATE TABLE test_autovac (
id SERIAL PRIMARY KEY,
col_1 INTEGER, col_2 INTEGER, col_3 INTEGER, col_4 INTEGER
@@ -91,7 +97,8 @@ $node->safe_psql('postgres', qq{
});
# Create specified number of b-tree indexes on the table
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
DO \$\$
DECLARE
i INTEGER;
@@ -109,15 +116,17 @@ $node->safe_psql('postgres', qq{
my $av_count = prepare_for_next_test($node, 1);
my $log_offset = -s $node->logfile;
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
ALTER TABLE test_autovac SET (autovacuum_enabled = true);
});
# Wait until the parallel autovacuum on table is completed. At the same time,
# we check that the required number of parallel workers has been started.
wait_for_autovacuum_complete($node, $av_count);
-ok($node->log_contains(qr/parallel workers: index vacuum: 2 planned, 2 launched in total/,
- $log_offset));
+ok( $node->log_contains(
+ qr/parallel workers: index vacuum: 2 planned, 2 launched in total/,
+ $log_offset));
# Test 2:
# Check whether parallel autovacuum leader can propagate cost-based parameters
@@ -126,7 +135,8 @@ ok($node->log_contains(qr/parallel workers: index vacuum: 2 planned, 2 launched
$av_count = prepare_for_next_test($node, 2);
$log_offset = -s $node->logfile;
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
SELECT injection_points_attach('autovacuum-start-parallel-vacuum', 'wait');
SELECT injection_points_attach('autovacuum-leader-before-indexes-processing', 'wait');
@@ -134,13 +144,12 @@ $node->safe_psql('postgres', qq{
});
# Wait until parallel autovacuum is inited
-$node->wait_for_event(
- 'autovacuum worker',
- 'autovacuum-start-parallel-vacuum'
-);
+$node->wait_for_event('autovacuum worker',
+ 'autovacuum-start-parallel-vacuum');
# Update the shared cost-based delay parameters.
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
ALTER SYSTEM SET vacuum_cost_limit = 500;
ALTER SYSTEM SET vacuum_cost_page_miss = 10;
ALTER SYSTEM SET vacuum_cost_page_dirty = 10;
@@ -151,27 +160,29 @@ $node->safe_psql('postgres', qq{
# Resume the leader process to update the shared parameters during heap scan (i.e.
# vacuum_delay_point() is called) and launch a parallel vacuum worker, but it stops
# before vacuuming indexes due to the injection point.
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
SELECT injection_points_wakeup('autovacuum-start-parallel-vacuum');
});
-$node->wait_for_event(
- 'autovacuum worker',
- 'autovacuum-leader-before-indexes-processing'
-);
+$node->wait_for_event('autovacuum worker',
+ 'autovacuum-leader-before-indexes-processing');
# Check whether parallel worker successfully updated all parameters during
# index processing
-$node->wait_for_log(qr/parallel autovacuum worker updated cost params: cost_limit=500, cost_delay=2, cost_page_miss=10, cost_page_dirty=10, cost_page_hit=10/,
- $log_offset);
+$node->wait_for_log(
+ qr/parallel autovacuum worker updated cost params: cost_limit=500, cost_delay=2, cost_page_miss=10, cost_page_dirty=10, cost_page_hit=10/,
+ $log_offset);
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
SELECT injection_points_wakeup('autovacuum-leader-before-indexes-processing');
});
wait_for_autovacuum_complete($node, $av_count);
# Cleanup
-$node->safe_psql('postgres', qq{
+$node->safe_psql(
+ 'postgres', qq{
SELECT injection_points_detach('autovacuum-start-parallel-vacuum');
SELECT injection_points_detach('autovacuum-leader-before-indexes-processing');
});
--
2.43.0