Thread: Re: [GENERAL] Some Solaris notes, and an invitation

Re: [GENERAL] Some Solaris notes, and an invitation

From
Bruce Momjian
Date:
The following diff adds the NetBSD qsort() for all Solaris platforms.
If Sun ever fixes it, we will have to test version numbers somehow, but
for now, it is unconditionally used on Solaris for 7.3.

---------------------------------------------------------------------------

Andrew Sullivan wrote:
> On Tue, Jun 25, 2002 at 12:08:54PM +1200, Kurt at iadvance wrote:
> > Hi,
> >
> > Are there any actual times you can provide on operations on
> > some big tables (if you have any of around 10-100 Gb say) - just
> > 'select count(*)' kind of stuff, maybe a 'select *' where its doing a
> > sequential scan?
>
> Sorry, I intended to reply to this sooner.  I went to perform such a
> test on 28 June, and (alas) the temporary license I had for Veritas
> had expired.  So I couldn't run this.  I'll have another opportunity,
> I believe, to run some tests in August, so I'll keep this on my TODO.
>
> A
>
> --
> ----
> Andrew Sullivan                               87 Mowat Avenue
> Liberty RMS                           Toronto, Ontario Canada
> <andrew@libertyrms.info>                              M6K 3E3
>                                          +1 416 646 3304 x110
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: configure
===================================================================
RCS file: /cvsroot/pgsql/configure,v
retrieving revision 1.201
diff -c -r1.201 configure
*** configure    18 Jul 2002 04:13:57 -0000    1.201
--- configure    19 Jul 2002 17:27:52 -0000
***************
*** 11902,11907 ****
--- 11902,11914 ----
  esac


+ # Set path of qsort for solaris, which has a very slow qsort in certain cases.
+ QSORT=""
+ case $host_os in
+   solaris*) DLLINIT='$(top_builddir)/src/backend/port/qsort.o' ;;
+ esac
+
+
  # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
  # this hackery with HPUXMATHLIB allows us to cope.
  HPUXMATHLIB=""
***************
*** 17584,17589 ****
--- 17591,17597 ----
  s,@STRTOUL@,$STRTOUL,;t t
  s,@STRCASECMP@,$STRCASECMP,;t t
  s,@DLLINIT@,$DLLINIT,;t t
+ s,@QSORT@,$QSORT,;t t
  s,@HPUXMATHLIB@,$HPUXMATHLIB,;t t
  s,@HAVE_POSIX_SIGNALS@,$HAVE_POSIX_SIGNALS,;t t
  s,@MSGFMT@,$MSGFMT,;t t
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql/configure.in,v
retrieving revision 1.192
diff -c -r1.192 configure.in
*** configure.in    18 Jul 2002 04:13:59 -0000    1.192
--- configure.in    19 Jul 2002 17:27:53 -0000
***************
*** 932,937 ****
--- 932,944 ----
  esac
  AC_SUBST(DLLINIT)

+ # Set path of qsort for solaris, which has a very slow qsort in certain cases.
+ QSORT=""
+ case $host_os in
+   solaris*) DLLINIT='$(top_builddir)/src/backend/port/qsort.o' ;;
+ esac
+ AC_SUBST(QSORT)
+
  # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
  # this hackery with HPUXMATHLIB allows us to cope.
  HPUXMATHLIB=""
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.150
diff -c -r1.150 Makefile.global.in
*** src/Makefile.global.in    18 Jul 2002 04:30:36 -0000    1.150
--- src/Makefile.global.in    19 Jul 2002 17:27:54 -0000
***************
*** 352,357 ****
--- 352,358 ----
  ISINF       = @ISINF@
  MEMCMP      = @MEMCMP@
  MISSING_RANDOM = @MISSING_RANDOM@
+ QSORT       = @QSORT@
  SNPRINTF    = @SNPRINTF@
  SRANDOM     = @SRANDOM@
  STRCASECMP  = @STRCASECMP@
***************
*** 360,366 ****
  STRTOL      = @STRTOL@
  STRTOUL     = @STRTOUL@

! # Used by the backend
  DLLINIT     = @DLLINIT@
  TAS         = @TAS@

--- 361,367 ----
  STRTOL      = @STRTOL@
  STRTOUL     = @STRTOUL@

! # Not really standard libc functions, used by the backend.
  DLLINIT     = @DLLINIT@
  TAS         = @TAS@

Index: src/backend/port/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/backend/port/Makefile,v
retrieving revision 1.16
diff -c -r1.16 Makefile
*** src/backend/port/Makefile    18 Jul 2002 04:13:59 -0000    1.16
--- src/backend/port/Makefile    19 Jul 2002 17:27:54 -0000
***************
*** 21,27 ****
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global

! OBJS=dynloader.o pg_sema.o pg_shmem.o

  OBJS+=$(DLLINIT)

--- 21,31 ----
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global

! OBJS=$(GETHOSTNAME) $(GETRUSAGE) $(INET_ATON) $(ISINF) $(MEMCMP) \
!         $(MISSING_RANDOM) $(QSORT) $(SNPRINTF) $(SRANDOM) $(STRCASECMP) \
!     $(STRDUP) $(STRERROR) $(STRTOL) $(STRTOUL)
!
! OBJS+=dynloader.o pg_sema.o pg_shmem.o

  OBJS+=$(DLLINIT)

Index: src/port/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/port/Makefile,v
retrieving revision 1.1
diff -c -r1.1 Makefile
*** src/port/Makefile    18 Jul 2002 04:13:59 -0000    1.1
--- src/port/Makefile    19 Jul 2002 17:27:57 -0000
***************
*** 15,23 ****
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global

- OBJS=$(GETHOSTNAME) $(GETRUSAGE) $(INET_ATON) $(ISINF) $(MEMCMP) \
-         $(MISSING_RANDOM) $(SNPRINTF) $(SRANDOM) $(STRCASECMP) $(STRDUP) \
-     $(STRERROR) $(STRTOL) $(STRTOUL)

! distclean clean:
!     rm -f $(OBJS)
--- 15,23 ----
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global


! #
! # The backend/port directory removes these files.
! #
! #distclean clean:
! #    rm -f $(OBJS)

Re: [GENERAL] Some Solaris notes, and an invitation

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> The following diff adds the NetBSD qsort() for all Solaris platforms.

Do we know that Solaris is the only platform with the problem?

In the back of my mind is the thought that if we used this qsort on
*all* platforms, we'd eliminate some platform-to-platform sort ordering
differences that occasionally cause regression test problems.  And I
see little downside to using it everywhere.

            regards, tom lane

Re: [GENERAL] Some Solaris notes, and an invitation

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > The following diff adds the NetBSD qsort() for all Solaris platforms.
>
> Do we know that Solaris is the only platform with the problem?
>
> In the back of my mind is the thought that if we used this qsort on
> *all* platforms, we'd eliminate some platform-to-platform sort ordering
> differences that occasionally cause regression test problems.  And I
> see little downside to using it everywhere.

That's a tough call. I am hesitant to replace qsort on platforms where
it is known to be working.  If an OS has some platform-specific
optimized qsort, our replacing it could cause problems.  Not sure how
likely that is to have happened, but Solaris clearly broke theirs so
someone must be modifying libc qsort somewhere.  In fact, some qsorts
are not even quicksort, so I tend to defer to the libc authors to
provide the best qsort for their platform.  In fact, this email suggests
there is quite a bit of variation in qsort implementations:

    http://www.dietlibc.org/mailinglists/dietlibc/2001/12-2001/msg00024.html

I don't think we can replace library functions unless we know they are
broken or missing, or if several people using the OS agree with the
replacement, as they have on Solaris.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: [GENERAL] Some Solaris notes, and an invitation

From
Andrew Sullivan
Date:
On Fri, Jul 19, 2002 at 02:15:40PM -0400, Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > The following diff adds the NetBSD qsort() for all Solaris platforms.
>
> Do we know that Solaris is the only platform with the problem?
>
> In the back of my mind is the thought that if we used this qsort on
> *all* platforms, we'd eliminate some platform-to-platform sort ordering
> differences that occasionally cause regression test problems.  And I
> see little downside to using it everywhere.

What if someone else's qsort is faster than NetBSD's?  NetBSD is not
famous for its high speeds, although I haven't any reason ot suppose
that this library is any differnt than FreeBSD's (or any other
Berkeley-derived system), since I haven't checked.  Just asking,
really.

A

--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110