Remove unused vacuum-truncate-auto injection point

Started by Sami Imseih16 days ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t253348
psql -h localhost -U postgres

Built from patchset v1 (message #1), August 23, 2026 at 01:08 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t253348_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t253348_1 && git checkout t253348_1

Patchset v1 (message #1) is on t253348_1

Jump to latest
#1Sami Imseih
samimseih@gmail.com

Hi,

While looking at these injection points I noticed vacuum-truncate-auto
in vacuum_rel() can never fire:

```
#ifdef USE_INJECTION_POINTS
if (params.truncate == VACOPTVALUE_AUTO)
INJECTION_POINT("vacuum-truncate-auto", NULL);
else if (params.truncate == VACOPTVALUE_DISABLED)
INJECTION_POINT("vacuum-truncate-disabled", NULL);
else if (params.truncate == VACOPTVALUE_ENABLED)
INJECTION_POINT("vacuum-truncate-enabled", NULL);
#endif
```

truncate is a boolean and can never be VACOPTVALUE_AUTO

```
Assert(params->truncate != VACOPTVALUE_UNSPECIFIED &&
params->truncate != VACOPTVALUE_AUTO);
```

This looks like an oversight from 661643dedad, perhaps to mirror
index_cleanup?

```
if (params.index_cleanup == VACOPTVALUE_AUTO)
INJECTION_POINT("vacuum-index-cleanup-auto", NULL);
```

Small cleanup attached.

--
Sami Imseih
Amazon Web Services (AWS)

Attachments:

t253348_1
v1-0001-Remove-unused-vacuum-truncate-auto-injection-poin.patchapplication/octet-stream; name=v1-0001-Remove-unused-vacuum-truncate-auto-injection-poin.patchDownload+1-16
#2Michael Paquier
michael@paquier.xyz
In reply to: Sami Imseih (#1)
Re: Remove unused vacuum-truncate-auto injection point

On Fri, Aug 07, 2026 at 05:00:43PM -0500, Sami Imseih wrote:

This looks like an oversight from 661643dedad, perhaps to mirror
index_cleanup?

```
if (params.index_cleanup == VACOPTVALUE_AUTO)
INJECTION_POINT("vacuum-index-cleanup-auto", NULL);
```

Small cleanup attached.

I am pretty sure that I have defined this one to be able to track more
easily an inconsistency if someone reworks this code, so as it becomes
possible to see if the value is set to "auto" when crossing this code
path, or at least consider if this is a good idea when doing an index
cleanup. Leaving things as they are now is not that bad, IMO. That's
just one opinion, I'm fine to be outvoted.
--
Michael

#3Sami Imseih
samimseih@gmail.com
In reply to: Michael Paquier (#2)
Re: Remove unused vacuum-truncate-auto injection point

This looks like an oversight from 661643dedad, perhaps to mirror
index_cleanup?

```
if (params.index_cleanup == VACOPTVALUE_AUTO)
INJECTION_POINT("vacuum-index-cleanup-auto", NULL);
```

Small cleanup attached.

I am pretty sure that I have defined this one to be able to track more
easily an inconsistency if someone reworks this code, so as it becomes
possible to see if the value is set to "auto" when crossing this code
path, or at least consider if this is a good idea when doing an index
cleanup.

To be clear, I am referring to
```
if (params.truncate == VACOPTVALUE_AUTO)
INJECTION_POINT("vacuum-truncate-auto", NULL);
```
truncate can never be auto, and is asserted in vacuumlazy.c

```
Assert(params->truncate != VACOPTVALUE_UNSPECIFIED &&
params->truncate != VACOPTVALUE_AUTO);
```

Leaving things as they are now is not that bad, IMO. That's
just one opinion, I'm fine to be outvoted.

I have no strong opinion, but I just don't see this being useful, and
if we ever make truncate support auto, we will need to update
injection_points/sql/vacuum.sql to use the option.

--
Sami