Re: error context for vacuum to include block number

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: error context for vacuum to include block number
Date: 2020-02-19 20:38:21
Message-ID: 20200219203821.GA10914@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Rebased on top of 007491979461ff10d487e1da9bcc87f2fd834f26

Also, I was thinking that lazy_scan_heap doesn't needs to do this:

+ /* Pop the error context stack while calling vacuum */
+ error_context_stack = errcallback.previous;
...
+ /* Set the error context while continuing heap scan */
+ error_context_stack = &errcallback;

It seems to me that's not actually necessary, since lazy_vacuum_heap will just
*push* a context handler onto the stack, and then pop it back off. We don't
need to pop our context beforehand. We also vacuum the FSM, and one might say
that we shouldn't report "...while scanning block number..." if it was
"vacuuming FSM" instead of "scanning heap", to which I would reply that either:
vacuuming FSM could be considered a part of scanning heap?? Or, maybe we
should add an additional callback for that, which is only not very nice since
we'd need to add a PROGRESS enum for which we don't actually report PROGRESS
(or stop using that enum).

I tested using variations on this that works as expected, that context is
correct during vacuum while scanning and after vacuum while scanning:

template1=# SET statement_timeout=0; SET maintenance_work_mem='1MB'; DROP TABLE tt; CREATE UNLOGGED TABLE tt(i int); INSERT INTO tt SELECT generate_series(1,399999); CREATE INDEX ON tt(i); UPDATE tt SET i=i-1; SET statement_timeout=1222; VACUUM VERBOSE tt;

Attachment Content-Type Size
v21-0001-vacuum-errcontext-to-show-block-being-processed.patch text/x-diff 8.8 KB
v21-0002-add-callback-for-truncation.patch text/x-diff 3.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-02-19 20:48:36 Re: Increase psql's password buffer size
Previous Message Peter Eisentraut 2020-02-19 20:23:12 Re: Unicode normalization SQL functions