From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
---|---|
To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
Cc: | "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Junwang Zhao <zhjwpku(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Subject: | Re: Using read_stream in index vacuum |
Date: | 2025-03-18 18:21:50 |
Message-ID: | CAAKRu_aPapmdBD0DYBXVVy7tS+_JyPvC4fWTcoHBBb18EbgaXA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Mar 18, 2025 at 11:12 AM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> I'm looking at 0001 with the intent of committing it soon. Today I've
> just been studying the test with the injection points.
>
> My main thought is that you should rename the injection points to
> something more descriptive. We want to make it clear why there are
> two. Also nbtree-vacuum-2 is actually where we wait the first
> iteration of the loop, so that is confusing.
I actually think you could do the test with one injection point and
just wait on it twice
diff --git a/src/backend/access/nbtree/nbtree.c
b/src/backend/access/nbtree/nbtree.c
index fe7084edacd..79f4323f887 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -1091,7 +1091,6 @@ btvacuumscan(IndexVacuumInfo *info,
IndexBulkDeleteResult *stats,
/* In 007_vacuum_btree test we need to coordinate two
distinguishable points here */
INJECTION_POINT("nbtree-vacuum-1");
- INJECTION_POINT("nbtree-vacuum-2");
p.last_exclusive = num_pages;
diff --git a/src/test/modules/test_misc/t/007_vacuum_btree.pl
b/src/test/modules/test_misc/t/007_vacuum_btree.pl
index 2c69d2b477d..6d5f474b99a 100644
--- a/src/test/modules/test_misc/t/007_vacuum_btree.pl
+++ b/src/test/modules/test_misc/t/007_vacuum_btree.pl
@@ -37,7 +37,7 @@ $node->safe_psql('postgres', 'CREATE EXTENSION
injection_points;');
# From this point, vacuum worker will wait at startup.
$node->safe_psql('postgres',
- "SELECT injection_points_attach('nbtree-vacuum-2', 'wait');");
+ "SELECT injection_points_attach('nbtree-vacuum-1', 'wait');");
my $psql_session = $node->background_psql('postgres');
@@ -51,10 +51,7 @@ $psql_session->query_until(
));
# Wait until an vacuum worker starts.
-$node->wait_for_event('client backend', 'nbtree-vacuum-2');
-
-$node->safe_psql('postgres',
- "SELECT injection_points_attach('nbtree-vacuum-1', 'wait');");
+$node->wait_for_event('client backend', 'nbtree-vacuum-1');
# Here's the key point of a test: during vacuum we add some page splits.
# This will force vacuum into doing another scan thus reseting read stream.
@@ -62,18 +59,16 @@ $node->safe_psql('postgres',
"insert into a select x from generate_series(1,3000) x;");
$node->safe_psql('postgres',
- "SELECT injection_points_detach('nbtree-vacuum-2');");
-$node->safe_psql('postgres',
- "SELECT injection_points_wakeup('nbtree-vacuum-2');");
+ "SELECT injection_points_wakeup('nbtree-vacuum-1');");
-# Observe that second scan is reached.
$node->wait_for_event('client backend', 'nbtree-vacuum-1');
-$node->safe_psql('postgres',
- "SELECT injection_points_detach('nbtree-vacuum-1');");
$node->safe_psql('postgres',
"SELECT injection_points_wakeup('nbtree-vacuum-1');");
+$node->safe_psql('postgres',
+ "SELECT injection_points_detach('nbtree-vacuum-1');");
+
ok($psql_session->quit);
done_testing();
From | Date | Subject | |
---|---|---|---|
Previous Message | Andrey Borodin | 2025-03-18 18:20:55 | Re: Using read_stream in index vacuum |