Thread: Re: [Slony1-general] Thread-safety detection on HP-UX

Re: [Slony1-general] Thread-safety detection on HP-UX

From
"Ed L."
Date:
Clean build of pgsql 7.4.5 on HPUX B.11.23 on ia64 with
--enable-thread-safety fails ...   :(

$uname -a
HP-UX ... B.11.23 U ia64 0144848471 unlimited-user license

$cd postgresql-7.4.5
$./configure --enable-thread-safety --without-readline --without-zlib
...
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
configure: error:
Cannot enable threads on your platform.
Please report your platform threading info to the PostgreSQL mailing lists
so it can be added to the next release.  Report all compile flags, link
flags,
functions, or libraries required for threading support.
See the comment at the top of src/port/thread.c for more information.

$gcc --version
gcc (GCC) 3.4.2
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Re: [Slony1-general] Thread-safety detection on HP-UX

From
Jan Wieck
Date:
On 10/22/2004 3:30 PM, Ed L. wrote:

> Clean build of pgsql 7.4.5 on HPUX B.11.23 on ia64 with
> --enable-thread-safety fails ...   :(
>
> $uname -a
> HP-UX ... B.11.23 U ia64 0144848471 unlimited-user license
>
> $cd postgresql-7.4.5
> $./configure --enable-thread-safety --without-readline --without-zlib
> ...
> checking pthread.h usability... yes
> checking pthread.h presence... yes
> checking for pthread.h... yes
> configure: error:
> Cannot enable threads on your platform.

Unfortunately that doesn't mean that the switch is required to cause
libpq to behave nicely for the Slony purposes. Can someone please test
if Slony works on HP-UX even if PostgreSQL is NOT configured with
--enable-thread-safety ?


Jan

> Please report your platform threading info to the PostgreSQL mailing lists
> so it can be added to the next release.  Report all compile flags, link
> flags,
> functions, or libraries required for threading support.
> See the comment at the top of src/port/thread.c for more information.
>
> $gcc --version
> gcc (GCC) 3.4.2
> Copyright (C) 2004 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>


--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #

Re: [Slony1-general] Thread-safety detection on HP-UX

From
Tom Lane
Date:
Jan Wieck <JanWieck@Yahoo.com> writes:
> On 10/22/2004 3:30 PM, Ed L. wrote:
>> Clean build of pgsql 7.4.5 on HPUX B.11.23 on ia64 with
>> --enable-thread-safety fails ...   :(

> Unfortunately that doesn't mean that the switch is required to cause
> libpq to behave nicely for the Slony purposes. Can someone please test
> if Slony works on HP-UX even if PostgreSQL is NOT configured with
> --enable-thread-safety ?

FWIW, CVS tip does build with --enable-thread-safety on HPUX 11.23 ...
at least for me ...

            regards, tom lane

Re: [Slony1-general] Thread-safety detection on HP-UX

From
Jan Wieck
Date:
On 10/23/2004 10:08 PM, Tom Lane wrote:

> Jan Wieck <JanWieck@Yahoo.com> writes:
>> On 10/22/2004 3:30 PM, Ed L. wrote:
>>> Clean build of pgsql 7.4.5 on HPUX B.11.23 on ia64 with
>>> --enable-thread-safety fails ...   :(
>
>> Unfortunately that doesn't mean that the switch is required to cause
>> libpq to behave nicely for the Slony purposes. Can someone please test
>> if Slony works on HP-UX even if PostgreSQL is NOT configured with
>> --enable-thread-safety ?
>
> FWIW, CVS tip does build with --enable-thread-safety on HPUX 11.23 ...
> at least for me ...
>
>             regards, tom lane

The patch available from http://slony.info should allow that for 7.4.x
as well since it was the base for switching from our clumsy template
file collection to acx_pthreads.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #

Re: [Slony1-general] Thread-safety detection on HP-UX

From
Bruce Momjian
Date:
Jan Wieck wrote:
> On 10/22/2004 3:30 PM, Ed L. wrote:
>
> > Clean build of pgsql 7.4.5 on HPUX B.11.23 on ia64 with
> > --enable-thread-safety fails ...   :(
> >
> > $uname -a
> > HP-UX ... B.11.23 U ia64 0144848471 unlimited-user license
> >
> > $cd postgresql-7.4.5
> > $./configure --enable-thread-safety --without-readline --without-zlib
> > ...
> > checking pthread.h usability... yes
> > checking pthread.h presence... yes
> > checking for pthread.h... yes
> > configure: error:
> > Cannot enable threads on your platform.
>
> Unfortunately that doesn't mean that the switch is required to cause
> libpq to behave nicely for the Slony purposes. Can someone please test
> if Slony works on HP-UX even if PostgreSQL is NOT configured with
> --enable-thread-safety ?

I believe Slony always needs threading, it just can be used even if the
OS doesn't fully support all thread-safe functions, so on 8.0 you use
--thread_safety_force.  Jan, is that correct?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: [Slony1-general] Thread-safety detection on HP-UX

From
Jan Wieck
Date:
On 10/26/2004 6:13 PM, Bruce Momjian wrote:

> I believe Slony always needs threading, it just can be used even if the
> OS doesn't fully support all thread-safe functions, so on 8.0 you use
> --thread_safety_force.  Jan, is that correct?

Yes.

Slony allways uses pthreads and therefore it requires that on platforms,
where the reentrant libc has a different definition for several global
symbols (like errno), libpq is compiled with pthread compiler flags. If
that actually leads to a "thread-safe" libpq or not is completely
irrelevant, because Slony does not need the libpq to be thread-safe.

A good example for what happens is Solaris. If libpq is compiled without
-pthreads, then "errno" is just the good old "extern int errno;". But if
it is compiled with -pthreads, then "errno" is #defined to dereferencing
the result of a function, like "*(__thread_errno())" and that function
returns the thread specific error variable and int*. Since slon is
compiled with pthreads, it links against the reentrant libc which places
error codes in the thread specific error variable. Why in devils name
that reentrant libc also has a global errno variable at all is a secret
to me and probably the last developer who knew that has left Sun 5 years
ago, but it has one and leaves it just zero all the time. Since it has
one, the extern reference errno from the non -pthread compiled libpq is
resolved just fine ... to a location of 4 wasted, meaningless bytes.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #