Strange assertion using VACOPT_FREEZE in vacuum.c

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Strange assertion using VACOPT_FREEZE in vacuum.c
Date: 2015-02-13 04:54:03
Message-ID: CAB7nPqRZX7Pv2B-R7xHmAh52tfjAQGfy9btqwFstgQgXks=iSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

When calling vacuum(), there is the following assertion using VACOPT_FREEZE:
Assert((vacstmt->options & VACOPT_VACUUM) ||
!(vacstmt->options & (VACOPT_FULL | VACOPT_FREEZE)));
I think that this should be changed with sanity checks based on the
parameter values of freeze_* in VacuumStmt as we do not set up
VACOPT_FREEZE when VACUUM is used without options in parenthesis, for
something like that:
Assert((vacstmt->options & VACOPT_VACUUM) ||
- !(vacstmt->options & (VACOPT_FULL | VACOPT_FREEZE)));
+ ((vacstmt->options & VACOPT_FULL) == 0 &&
+ vacstmt->freeze_min_age < 0 &&
+ vacstmt->freeze_table_age < 0 &&
+ vacstmt->multixact_freeze_min_age < 0 &&
+ vacstmt->multixact_freeze_table_age < 0));
This would also have the advantage to limit the use of VACOPT_FREEZE
in the query parser.
A patch is attached.
Thoughts?
--
Michael

Attachment Content-Type Size
20150213_vacuum_freeze_fix_assertion.patch text/x-patch 815 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2015-02-13 05:10:38 Re: assessing parallel-safety
Previous Message Michael Paquier 2015-02-13 04:21:34 Re: Table-level log_autovacuum_min_duration