pgsql-7.3.3: Build process not SMP clean

From: Andreas Haumer <andreas(at)xss(dot)co(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: pgsql-7.3.3: Build process not SMP clean
Date: 2003-07-29 08:15:14
Message-ID: 3F262D12.4070909@xss.co.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi!

There is a small bug in PostgreSQL 7.3.3 which makes
the build process fail sometimes on SMP machines with
"make -j n" (n>1)

Ths problem is in the src/backend/catalog/genbki.sh
script, which gets executed twice during the build
process. On SMP machines, and with "make -j", chances are
high that both executions are in parallel (at the same time).

But genbki.sh is not SMP safe: it uses a temporary file

TMPFILE="$TMPDIR/genbkitmp.c"

which of course is the same for both instances of genbki.sh
and chances are high, the temporary file gets corrupted and
compilation of this file then fails.

I made the following patch to solve this:

--- postgresql/src/backend/catalog/genbki.sh.orig 2003-07-29 09:37:20.000000000 +0200
+++ postgresql/src/backend/catalog/genbki.sh 2003-07-29 09:37:53.000000000 +0200
@@ -113,7 +113,7 @@
fi

-TMPFILE="$TMPDIR/genbkitmp.c"
+TMPFILE="$TMPDIR/genbkitmp-$$.c"

trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0 1 2 3 15

I think, it should be obvious. I tested the patch several times
on a Dual-Xeon hyperthreaded machine with "make -j 4" and now
every single build works (without the patch, 2 out of 3 builds
fail). Please apply.

Regards,

- andreas

--
Andreas Haumer | mailto:andreas(at)xss(dot)co(dot)at
*x Software + Systeme | http://www.xss.co.at/
Karmarschgasse 51/2/20 | Tel: +43-1-6060114-0
A-1100 Vienna, Austria | Fax: +43-1-6060114-71

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-07-29 14:13:40 Re: pgsql-7.3.3: Build process not SMP clean
Previous Message Christopher Browne 2003-07-28 22:01:13 Why READ ONLY transactions?