From: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Wrong return code in vacuumdb when multiple jobs are used |
Date: | 2019-05-04 08:35:23 |
Message-ID: | CAOBaU_ZuTwz7CtqLYJ1Ouuh272bTQPLN8b1bAPk0bCBm4PDMTQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
While reading vacuumdb code, I just noticed that it can return 0 if an
error happen when -j is used, if errors happen on the last batch of
commands.
For instance:
session 1
alter database postgres set lock_timeout = 1;
begin;
lock table pg_extension;
session 2
$ vacuumdb -d postgres -t pg_extension -t pg_extension
vacuumdb: vacuuming database "postgres"
vacuumdb: error: vacuuming of table "pg_catalog.pg_extension" in
database "postgres" failed: ERROR: canceling statement due to lock
timeout
$ echo $?
1
$ vacuumdb -d postgres -t pg_extension -t pg_extension -j2
vacuumdb: vacuuming database "postgres"
vacuumdb: error: vacuuming of database "postgres" failed: ERROR:
canceling statement due to lock timeout
$ echo $?
0
but
$ vacuumdb -d postgres -t pg_extension -t pg_extension -t pg_extension -j2
vacuumdb: vacuuming database "postgres"
vacuumdb: error: vacuuming of database "postgres" failed: ERROR:
canceling statement due to lock timeout
$ echo $?
1
This behavior exists since 9.5. Trivial patch attached. I'm not sure
that a TAP test is required here, so I didn't add one. I'll be happy
to do so though if needed.
Attachment | Content-Type | Size |
---|---|---|
fix_parallel_vacuumdb_rc-v1.diff | text/x-patch | 425 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-05-04 08:39:10 | Re: First-draft release notes for back branches are up |
Previous Message | Michael Paquier | 2019-05-04 07:35:46 | Re: compiler warning in pgcrypto imath.c |