pgsql: Fix representation of SORT_TYPE_STILL_IN_PROGRESS.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix representation of SORT_TYPE_STILL_IN_PROGRESS.
Date: 2020-04-07 02:22:22
Message-ID: E1jLdsc-0002tx-1P@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix representation of SORT_TYPE_STILL_IN_PROGRESS.

It turns out that the code did indeed rely on a zeroed
TuplesortInstrumentation.sortMethod field to indicate
"this worker never did anything", although it seems the
issue only comes up during certain race-condition-y cases.

Hence, rearrange the TuplesortMethod enum to restore
SORT_TYPE_STILL_IN_PROGRESS to having the value zero,
and add some comments reinforcing that that isn't optional.

Also future-proof a loop over the possible values of the enum.
sizeof(bits32) happened to be the correct limit value,
but only by purest coincidence.

Per buildfarm and local investigation.

Discussion: https://postgr.es/m/12222.1586223974@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c7654f6a37792ab9525ff98b710c23b27c7868a5

Modified Files
--------------
src/backend/commands/explain.c | 10 +++++-----
src/include/utils/tuplesort.h | 20 +++++++++++++-------
2 files changed, 18 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2020-04-07 09:51:32 Re: pgsql: Generate backup manifests for base backups, and validate them.
Previous Message Thomas Munro 2020-04-07 00:14:03 pgsql: Add SQL type xid8 to expose FullTransactionId to users.