agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH v4 14/15] WIP: Don't initialize page in {vm,fsm}_extend(), not needed
4+ messages / 2 participants
[nested] [flat]
* [PATCH v4 14/15] WIP: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-03-01 04:56 Andres Freund <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: Andres Freund @ 2023-03-01 04:56 UTC (permalink / raw)
---
src/backend/access/heap/visibilitymap.c | 6 +-----
src/backend/storage/freespace/freespace.c | 5 +----
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index 74ff01bb172..709213d0d97 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -623,11 +623,9 @@ static void
vm_extend(Relation rel, BlockNumber vm_nblocks)
{
BlockNumber vm_nblocks_now;
- PGAlignedBlock pg;
+ PGAlignedBlock pg = {0};
SMgrRelation reln;
- PageInit((Page) pg.data, BLCKSZ, 0);
-
/*
* We use the relation extension lock to lock out other backends trying to
* extend the visibility map at the same time. It also locks out extension
@@ -663,8 +661,6 @@ vm_extend(Relation rel, BlockNumber vm_nblocks)
/* Now extend the file */
while (vm_nblocks_now < vm_nblocks)
{
- PageSetChecksumInplace((Page) pg.data, vm_nblocks_now);
-
smgrextend(reln, VISIBILITYMAP_FORKNUM, vm_nblocks_now, pg.data, false);
vm_nblocks_now++;
}
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index 3e9693b293b..90c529958e7 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -608,10 +608,9 @@ static void
fsm_extend(Relation rel, BlockNumber fsm_nblocks)
{
BlockNumber fsm_nblocks_now;
- PGAlignedBlock pg;
+ PGAlignedBlock pg = {0};
SMgrRelation reln;
- PageInit((Page) pg.data, BLCKSZ, 0);
/*
* We use the relation extension lock to lock out other backends trying to
@@ -649,8 +648,6 @@ fsm_extend(Relation rel, BlockNumber fsm_nblocks)
/* Extend as needed. */
while (fsm_nblocks_now < fsm_nblocks)
{
- PageSetChecksumInplace((Page) pg.data, fsm_nblocks_now);
-
smgrextend(reln, FSM_FORKNUM, fsm_nblocks_now,
pg.data, false);
fsm_nblocks_now++;
--
2.38.0
--njltjzibte523gwd
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v4-0015-Convert-a-few-places-to-ExtendBufferedRelTo.patch"
^ permalink raw reply [nested|flat] 4+ messages in thread
* [PATCH v6 15/17] WIP: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-03-01 04:56 Andres Freund <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: Andres Freund @ 2023-03-01 04:56 UTC (permalink / raw)
---
src/backend/access/heap/visibilitymap.c | 6 +-----
src/backend/storage/freespace/freespace.c | 5 +----
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index 74ff01bb172..709213d0d97 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -623,11 +623,9 @@ static void
vm_extend(Relation rel, BlockNumber vm_nblocks)
{
BlockNumber vm_nblocks_now;
- PGAlignedBlock pg;
+ PGAlignedBlock pg = {0};
SMgrRelation reln;
- PageInit((Page) pg.data, BLCKSZ, 0);
-
/*
* We use the relation extension lock to lock out other backends trying to
* extend the visibility map at the same time. It also locks out extension
@@ -663,8 +661,6 @@ vm_extend(Relation rel, BlockNumber vm_nblocks)
/* Now extend the file */
while (vm_nblocks_now < vm_nblocks)
{
- PageSetChecksumInplace((Page) pg.data, vm_nblocks_now);
-
smgrextend(reln, VISIBILITYMAP_FORKNUM, vm_nblocks_now, pg.data, false);
vm_nblocks_now++;
}
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index 3e9693b293b..90c529958e7 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -608,10 +608,9 @@ static void
fsm_extend(Relation rel, BlockNumber fsm_nblocks)
{
BlockNumber fsm_nblocks_now;
- PGAlignedBlock pg;
+ PGAlignedBlock pg = {0};
SMgrRelation reln;
- PageInit((Page) pg.data, BLCKSZ, 0);
/*
* We use the relation extension lock to lock out other backends trying to
@@ -649,8 +648,6 @@ fsm_extend(Relation rel, BlockNumber fsm_nblocks)
/* Extend as needed. */
while (fsm_nblocks_now < fsm_nblocks)
{
- PageSetChecksumInplace((Page) pg.data, fsm_nblocks_now);
-
smgrextend(reln, FSM_FORKNUM, fsm_nblocks_now,
pg.data, false);
fsm_nblocks_now++;
--
2.38.0
--cfn72vqnlbycypta
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0016-Convert-a-few-places-to-ExtendBufferedRelTo.patch"
^ permalink raw reply [nested|flat] 4+ messages in thread
* [PATCH v5 12/14] WIP: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-03-01 04:56 Andres Freund <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: Andres Freund @ 2023-03-01 04:56 UTC (permalink / raw)
---
src/backend/access/heap/visibilitymap.c | 6 +-----
src/backend/storage/freespace/freespace.c | 5 +----
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index 74ff01bb172..709213d0d97 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -623,11 +623,9 @@ static void
vm_extend(Relation rel, BlockNumber vm_nblocks)
{
BlockNumber vm_nblocks_now;
- PGAlignedBlock pg;
+ PGAlignedBlock pg = {0};
SMgrRelation reln;
- PageInit((Page) pg.data, BLCKSZ, 0);
-
/*
* We use the relation extension lock to lock out other backends trying to
* extend the visibility map at the same time. It also locks out extension
@@ -663,8 +661,6 @@ vm_extend(Relation rel, BlockNumber vm_nblocks)
/* Now extend the file */
while (vm_nblocks_now < vm_nblocks)
{
- PageSetChecksumInplace((Page) pg.data, vm_nblocks_now);
-
smgrextend(reln, VISIBILITYMAP_FORKNUM, vm_nblocks_now, pg.data, false);
vm_nblocks_now++;
}
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index 3e9693b293b..90c529958e7 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -608,10 +608,9 @@ static void
fsm_extend(Relation rel, BlockNumber fsm_nblocks)
{
BlockNumber fsm_nblocks_now;
- PGAlignedBlock pg;
+ PGAlignedBlock pg = {0};
SMgrRelation reln;
- PageInit((Page) pg.data, BLCKSZ, 0);
/*
* We use the relation extension lock to lock out other backends trying to
@@ -649,8 +648,6 @@ fsm_extend(Relation rel, BlockNumber fsm_nblocks)
/* Extend as needed. */
while (fsm_nblocks_now < fsm_nblocks)
{
- PageSetChecksumInplace((Page) pg.data, fsm_nblocks_now);
-
smgrextend(reln, FSM_FORKNUM, fsm_nblocks_now,
pg.data, false);
fsm_nblocks_now++;
--
2.38.0
--wwosng5vofi3dmcs
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v5-0013-Convert-a-few-places-to-ExtendBufferedRelTo.patch"
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Parallel heap vacuum
@ 2025-08-26 00:37 Masahiko Sawada <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: Masahiko Sawada @ 2025-08-26 00:37 UTC (permalink / raw)
To: Robert Haas <[email protected]>; +Cc: Andres Freund <[email protected]>; Melanie Plageman <[email protected]>; Peter Smith <[email protected]>; John Naylor <[email protected]>; Tomas Vondra <[email protected]>; Hayato Kuroda (Fujitsu) <[email protected]>; pgsql-hackers
On Fri, Jul 25, 2025 at 10:40 AM Robert Haas <[email protected]> wrote:
>
> On Mon, Jul 21, 2025 at 7:49 PM Andres Freund <[email protected]> wrote:
> > That is not to say you can't have callbacks or such, it just doesn't make
> > sense for those callbacks to be at the level of tableam. If you want to make
> > vacuumparallel support parallel table vacuuming for multiple table AMs (I'm
> > somewhat doubtful that's a good idea), you could do that by having a
> > vacuumparallel.c specific callback struct.
>
> I'm not doubtful that this is a good idea. There are a number of
> tableams around these days that are "heap except whatever", where (I
> suspect) the size of "whatever" ranges from quite small to moderately
> large. I imagine that such efforts end up duplicating a lot of heapam
> code and probably always will; but if we can avoid increasing that
> amount, I think it's a good idea.
Based on our previous discussions, I have contemplated modifying the
patch to define the callback functions for parallel table vacuum
within a structure in vacuumparallel.c instead of using table AM's
callbacks. This approach would require the leader to pass both the
library name and handler function name to vacuumparallel.c, enabling
workers to locate the handler function via load_external_function()
and access the callback functions. Although it's technically feasible,
I'm not sure that the design is elegant; while table AM seeking to use
parallel index vacuuming can simply invoke parallel_vacuum_init(),
those requiring parallel table vacuum would need to both provide the
handler function and supply the library and handler function names.
An alternative, more straightforward approach would be to implement a
dedicated ParallelContext in vacuumlazy.c specifically for parallel
heap vacuum, distinct from the ParallelVacuumContext in
vacuumparallel.c. Under this design, vacuumparallel.c would be
exclusively dedicated to parallel index vacuuming, while the parallel
heap vacuum implementation would be contained within vacuumlazy.c,
eliminating the need for a handler function. While this solution seems
more elegant, it would result in code duplication between vacuumlazy.c
and vacuumparallel.c, particularly in areas concerning worker
initialization and cost-based delays.
At present, I am inclined toward the latter solution, though I have
yet to implement it. I welcome any feedback on these approaches.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2025-08-26 00:37 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 04:56 [PATCH v4 14/15] WIP: Don't initialize page in {vm,fsm}_extend(), not needed Andres Freund <[email protected]>
2023-03-01 04:56 [PATCH v6 15/17] WIP: Don't initialize page in {vm,fsm}_extend(), not needed Andres Freund <[email protected]>
2023-03-01 04:56 [PATCH v5 12/14] WIP: Don't initialize page in {vm,fsm}_extend(), not needed Andres Freund <[email protected]>
2025-08-26 00:37 Re: Parallel heap vacuum Masahiko Sawada <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox