Thread: Linux/Alpha and pgsql....

Linux/Alpha and pgsql....

From
Ryan Kirkpatrick
Date:
    I finally found some time to make minor patch to pgsql 6.3.1 to
make it "sort-of-work" out of the box for Linux/Alpha. At the current
moment, I can get it to compile, and run 'initdb' successfully. Regression
tests are successful for the most part, with the biggest problems being in
any dealing with floats, especially the float{4,...} tests. Overall, it
looks as things are improving! :)
    The patches are for the two modified files only, as the changes
were small. Mainly just replacing 'defined(linuxalpha)' with something
that is understood '( defined(linux) && defined(__alpha__) )' by the
compiler correctly, since linuxalpha was not getting defined anywhere, and
the Linux/Alpha gcc does not generate the linuxalpha symbol itself.
Appears to have been a slight oversight by some one who was adding
Linux/Alpha support to the code. This shouldn't break any other platforms,
with as small and simple a change as it is. Hopefully it can make it into
6.3.2? :)
    Also, what is the purpose of the files in
./src/backend/ports/linuxalpha? I can't find any reference to them
anywhere else in the sources, and it does not appears they are even
included in the final binary. The files themselves are pretty sparse.
Also, if I understand the configure scripts correctly, only a
./src/backend/port/linux directory would be used, as linuxalpha is
considered a subset of linux. Of course the latter directory existed in
6.2.x, but is now gone. I think that the former directory can follow,
i.e. be removed as well.
    Thats all for now! As usual, any questions about these
patches, feel free to email me. TTYL.

----------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                     |
|                                            --- Philippians 1:21 (KJV)    |
----------------------------------------------------------------------------
|  Ryan Kirkpatrick  |  Boulder, Colorado  | rkirkpat@nag.cs.colorado.edu  |
----------------------------------------------------------------------------
|               http://www-ugrad.cs.colorado.edu/~rkirkpat/                |
----------------------------------------------------------------------------
--- postgresql-6.3.1.actual/src/include/utils/memutils.h    Wed Feb 25 22:44:08 1998
+++ postgresql-6.3.1/src/include/utils/memutils.h    Fri Apr 10 15:22:17 1998
@@ -67,7 +67,7 @@
  */
 #if defined(sun) && ! defined(sparc)
 #define LONGALIGN(LEN)    SHORTALIGN(LEN)
-#elif defined (alpha) || defined(linuxalpha)
+#elif defined (alpha) || ( defined(linux) && defined(__alpha__))
 
  /*
   * even though "long alignment" should really be on 8-byte boundaries for
--- postgresql-6.3.1.actual/src/backend/utils/adt/float.c    Wed Feb 25 22:37:07 1998
+++ postgresql-6.3.1/src/backend/utils/adt/float.c    Fri Apr 10 15:21:11 1998
@@ -132,7 +132,7 @@
  * until the distributions are updated.
  *                                --djm 12/16/96
  */
-#if defined(linuxalpha) && !defined(UNSAFE_FLOATS)
+#if ( defined(linux) && defined(__alpha__) ) && !defined(UNSAFE_FLOATS)
 #define UNSAFE_FLOATS
 #endif
 

Re: [HACKERS] Linux/Alpha and pgsql....

From
The Hermit Hacker
Date:
On Fri, 10 Apr 1998, Ryan Kirkpatrick wrote:

>
>     I finally found some time to make minor patch to pgsql 6.3.1 to
> make it "sort-of-work" out of the box for Linux/Alpha. At the current
> moment, I can get it to compile, and run 'initdb' successfully. Regression
> tests are successful for the most part, with the biggest problems being in
> any dealing with floats, especially the float{4,...} tests. Overall, it
> looks as things are improving! :)

    Can you grab the latest snapshot, which is going to be v6.3.2, and
confirm/tweak your patch with that?  Its meant for release on April 15th,
as long as my personal 'show stoppers' are no longer a problem :)


Marc G. Fournier
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


Re: [HACKERS] Linux/Alpha and pgsql....

From
Bruce Momjian
Date:
Marc, would you install these as appropriate.  Also, you will find that
I added to templates/linuxalpha the line:

    linuxalpha:CFLAGS:-O2 -Dalpha
                              ^^^^^^^

so the patches he supplied adding __alpha__ are not needed anymore.

This addition fixed alpha support, so it should fix alpha-linux too.


>     I finally found some time to make minor patch to pgsql 6.3.1 to
> make it "sort-of-work" out of the box for Linux/Alpha. At the current
> moment, I can get it to compile, and run 'initdb' successfully. Regression
> tests are successful for the most part, with the biggest problems being in
> any dealing with floats, especially the float{4,...} tests. Overall, it
> looks as things are improving! :)
>     The patches are for the two modified files only, as the changes
> were small. Mainly just replacing 'defined(linuxalpha)' with something
> that is understood '( defined(linux) && defined(__alpha__) )' by the
> compiler correctly, since linuxalpha was not getting defined anywhere, and
> the Linux/Alpha gcc does not generate the linuxalpha symbol itself.
> Appears to have been a slight oversight by some one who was adding
> Linux/Alpha support to the code. This shouldn't break any other platforms,
> with as small and simple a change as it is. Hopefully it can make it into
> 6.3.2? :)
>     Also, what is the purpose of the files in
> ./src/backend/ports/linuxalpha? I can't find any reference to them
> anywhere else in the sources, and it does not appears they are even
> included in the final binary. The files themselves are pretty sparse.
> Also, if I understand the configure scripts correctly, only a
> ./src/backend/port/linux directory would be used, as linuxalpha is
> considered a subset of linux. Of course the latter directory existed in
> 6.2.x, but is now gone. I think that the former directory can follow,
> i.e. be removed as well.
>     Thats all for now! As usual, any questions about these
> patches, feel free to email me. TTYL.
>
> ----------------------------------------------------------------------------
> |   "For to me to live is Christ, and to die is gain."                     |
> |                                            --- Philippians 1:21 (KJV)    |
> ----------------------------------------------------------------------------
> |  Ryan Kirkpatrick  |  Boulder, Colorado  | rkirkpat@nag.cs.colorado.edu  |
> ----------------------------------------------------------------------------
> |               http://www-ugrad.cs.colorado.edu/~rkirkpat/                |
> ----------------------------------------------------------------------------
>
> --8323328-875907394-892249499=:6356
> Content-Type: TEXT/PLAIN; charset=US-ASCII; name="pgsql-6.2.1.alpha.patch.4"
> Content-Transfer-Encoding: BASE64
> Content-ID: <Pine.LNX.3.95.980410180459.6356B@stargazer>
> Content-Description:
>
> LS0tIHBvc3RncmVzcWwtNi4zLjEuYWN0dWFsL3NyYy9pbmNsdWRlL3V0aWxz
> L21lbXV0aWxzLmgJV2VkIEZlYiAyNSAyMjo0NDowOCAxOTk4DQorKysgcG9z
> dGdyZXNxbC02LjMuMS9zcmMvaW5jbHVkZS91dGlscy9tZW11dGlscy5oCUZy
> aSBBcHIgMTAgMTU6MjI6MTcgMTk5OA0KQEAgLTY3LDcgKzY3LDcgQEANCiAg
> Ki8NCiAjaWYgZGVmaW5lZChzdW4pICYmICEgZGVmaW5lZChzcGFyYykNCiAj
> ZGVmaW5lIExPTkdBTElHTihMRU4pCVNIT1JUQUxJR04oTEVOKQ0KLSNlbGlm
> IGRlZmluZWQgKGFscGhhKSB8fCBkZWZpbmVkKGxpbnV4YWxwaGEpDQorI2Vs
> aWYgZGVmaW5lZCAoYWxwaGEpIHx8ICggZGVmaW5lZChsaW51eCkgJiYgZGVm
> aW5lZChfX2FscGhhX18pKQ0KIA0KICAvKg0KICAgKiBldmVuIHRob3VnaCAi
> bG9uZyBhbGlnbm1lbnQiIHNob3VsZCByZWFsbHkgYmUgb24gOC1ieXRlIGJv
> dW5kYXJpZXMgZm9yDQo=
> --8323328-875907394-892249499=:6356
> Content-Type: TEXT/PLAIN; charset=US-ASCII; name="pgsql-6.2.1.alpha.patch.3"
> Content-Transfer-Encoding: BASE64
> Content-ID: <Pine.LNX.3.95.980410180459.6356C@stargazer>
> Content-Description:
>
> LS0tIHBvc3RncmVzcWwtNi4zLjEuYWN0dWFsL3NyYy9iYWNrZW5kL3V0aWxz
> L2FkdC9mbG9hdC5jCVdlZCBGZWIgMjUgMjI6Mzc6MDcgMTk5OA0KKysrIHBv
> c3RncmVzcWwtNi4zLjEvc3JjL2JhY2tlbmQvdXRpbHMvYWR0L2Zsb2F0LmMJ
> RnJpIEFwciAxMCAxNToyMToxMSAxOTk4DQpAQCAtMTMyLDcgKzEzMiw3IEBA
> DQogICogdW50aWwgdGhlIGRpc3RyaWJ1dGlvbnMgYXJlIHVwZGF0ZWQuDQog
> ICoJCQkJCQkJCS0tZGptIDEyLzE2Lzk2DQogICovDQotI2lmIGRlZmluZWQo
> bGludXhhbHBoYSkgJiYgIWRlZmluZWQoVU5TQUZFX0ZMT0FUUykNCisjaWYg
> KCBkZWZpbmVkKGxpbnV4KSAmJiBkZWZpbmVkKF9fYWxwaGFfXykgKSAmJiAh
> ZGVmaW5lZChVTlNBRkVfRkxPQVRTKQ0KICNkZWZpbmUgVU5TQUZFX0ZMT0FU
> Uw0KICNlbmRpZg0KIA0K
> --8323328-875907394-892249499=:6356--
>
>


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [HACKERS] Linux/Alpha and pgsql....

From
Bruce Momjian
Date:
>
> On Fri, 10 Apr 1998, Ryan Kirkpatrick wrote:
>
> >
> >     I finally found some time to make minor patch to pgsql 6.3.1 to
> > make it "sort-of-work" out of the box for Linux/Alpha. At the current
> > moment, I can get it to compile, and run 'initdb' successfully. Regression
> > tests are successful for the most part, with the biggest problems being in
> > any dealing with floats, especially the float{4,...} tests. Overall, it
> > looks as things are improving! :)
>
>     Can you grab the latest snapshot, which is going to be v6.3.2, and
> confirm/tweak your patch with that?  Its meant for release on April 15th,
> as long as my personal 'show stoppers' are no longer a problem :)

Again, the addition in templates/linuxalpha should fix most of your
problems.  Let us know.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [HACKERS] Linux/Alpha and pgsql....

From
Ryan Kirkpatrick
Date:
On Fri, 10 Apr 1998, Bruce Momjian wrote:

> >     Can you grab the latest snapshot, which is going to be v6.3.2, and
> > confirm/tweak your patch with that?  Its meant for release on April 15th,
> > as long as my personal 'show stoppers' are no longer a problem :)
>
> Again, the addition in templates/linuxalpha should fix most of your
> problems.  Let us know.

    Ok, I grabbed the latest snapshot, April 11, 7am. The changes in
templates/linuxalpha do fix some of the problems, and make fixing the rest
easier. As it was "out-of-the-box", it (nearly) compiled and ran initdb
sucessfully on my UDB. But there was quite a few failures and coredumps by
postgres upon the running of regression tests.
    To get it compile succesfully, I had to make sure the linux/alpha
did not include a few .h files that the alpha version was supposed to
include. This occured in ./backend/main/main.c, and the patch for it is
attached.
    I then added -Dlinuxalpha to the ./template/linuxalpha CFLAGS
line, and recompiled. 'initdb' ran fine, and regression tests went much
better. Now about 75% of the regression tests complete successfully. From
the looks of things, floats are still causing most of the problems. I
haven't looked yet to see if there are major problems, or just minor
formatting ones. A patch for the ./template/linuxalpha changes is also
attached.
    These two patches should bring the current version of pgsql very
close to working cleaning on Linux/Alpha! :) As usual, if you have any
questions, feel free to email me.

----------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                     |
|                                            --- Philippians 1:21 (KJV)    |
----------------------------------------------------------------------------
|  Ryan Kirkpatrick  |  Boulder, Colorado  | rkirkpat@nag.cs.colorado.edu  |
----------------------------------------------------------------------------
|               http://www-ugrad..cs.colorado.edu/~rkirkpat/                |
----------------------------------------------------------------------------
--- pgsql.original/src/template/linuxalpha    Mon Apr  6 02:02:15 1998
+++ pgsql/src/template/linuxalpha    Sat Apr 11 09:42:24 1998
@@ -1,5 +1,5 @@
 AROPT:crs
-CFLAGS:-O2 -Dalpha
+CFLAGS:-O2 -Dalpha -Dlinuxalpha
 SHARED_LIB:-fpic
 ALL:
 SRCH_INC:
--- pgsql.original/src/backend/main/main.c    Mon Mar 23 02:00:35 1998
+++ pgsql/src/backend/main/main.c    Sat Apr 11 08:38:54 1998
@@ -15,7 +15,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifdef alpha
+#if defined(alpha) && !defined(linux)
 #include <sys/sysinfo.h>
 #include <machine/hal_sysinfo.h>
 #define ASSEMBLER

Re: [HACKERS] Linux/Alpha and pgsql....

From
The Hermit Hacker
Date:
On Sat, 11 Apr 1998, Ryan Kirkpatrick wrote:

>     These two patches should bring the current version of pgsql very
> close to working cleaning on Linux/Alpha! :) As usual, if you have any
> questions, feel free to email me.

    Seeing as how close we are to a v6.3.2 release, I put these in,
but I don't like them...

    We've been moving *away* from using -D's in order to deal with
operating system/hardware related issues...using tools/ccsym, are there no
compiler defined variables you can use for this instead?

Marc G. Fournier
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


Re: [HACKERS] Linux/Alpha and pgsql....

From
Ryan Kirkpatrick
Date:
On Sat, 11 Apr 1998, The Hermit Hacker wrote:

> On Sat, 11 Apr 1998, Ryan Kirkpatrick wrote:
>
> >     These two patches should bring the current version of pgsql very
> > close to working cleaning on Linux/Alpha! :) As usual, if you have any
> > questions, feel free to email me.
>
>     Seeing as how close we are to a v6.3.2 release, I put these in,
> but I don't like them...
>
>     We've been moving *away* from using -D's in order to deal with
> operating system/hardware related issues...using tools/ccsym, are there no
> compiler defined variables you can use for this instead?

    Hold on a second here.... The first patches I sent you were done
by modifying the defined(linuxalpha) to (defined(linux) &&
defined(alpha)) (the tools/ccsym method). But I was told that there was a
template for linux/alpha, and I should modify that, and so I used the
-D's. Which way do you all want it???
    For what its worth, I agree, the output from tools/ccsym should be
used and not -D's.
    Ok, attached are a new set of patches. First of all, ignore all
previous patches I have sent on this thread. Now these three work on the
idea that 'alpha' and 'linux' are both defined. The former is defined by
CFLAGS in template/linuxalpha, and latter is defined by the gcc on my UDB
(and all other Linux/Alpha systems). This removes the need to add any
defines to the CFLAGS line. To get rid of the other define (-Dalpha), we
simply need to replace each 'defined(alpha)' with '(defined(alpha) ||
defined(__alpha__))', as gcc automatically defines '__alpha__' like it
does 'linux'. If you want me to do this, just ask.
    Ok, now are these patches ok by everyone? :) Thanks.

----------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                     |
|                                            --- Philippians 1:21 (KJV)    |
----------------------------------------------------------------------------
|  Ryan Kirkpatrick  |  Boulder, Colorado  | rkirkpat@nag.cs.colorado.edu  |
----------------------------------------------------------------------------
|               http://www-ugrad.cs.colorado.edu/~rkirkpat/                |
----------------------------------------------------------------------------

--- postgresql-6.3.1.actual/src/backend/utils/adt/float.c    Wed Feb 25 22:37:07 1998
+++ postgresql-6.3.1/src/backend/utils/adt/float.c    Fri Apr 10 15:21:11 1998
@@ -132,7 +132,7 @@
  * until the distributions are updated.
  *                                --djm 12/16/96
  */
-#if defined(linuxalpha) && !defined(UNSAFE_FLOATS)
+#if ( defined(linux) && defined(alpha) ) && !defined(UNSAFE_FLOATS)
 #define UNSAFE_FLOATS
 #endif
 
--- postgresql-6.3.1.actual/src/include/utils/memutils.h    Wed Feb 25 22:44:08 1998
+++ postgresql-6.3.1/src/include/utils/memutils.h    Fri Apr 10 15:22:17 1998
@@ -67,7 +67,7 @@
  */
 #if defined(sun) && ! defined(sparc)
 #define LONGALIGN(LEN)    SHORTALIGN(LEN)
-#elif defined (alpha) || defined(linuxalpha)
+#elif defined (alpha)
 
  /*
   * even though "long alignment" should really be on 8-byte boundaries for
--- pgsql.original/src/backend/main/main.c    Mon Mar 23 02:00:35 1998
+++ pgsql/src/backend/main/main.c    Sat Apr 11 08:38:54 1998
@@ -15,7 +15,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifdef alpha
+#if defined(alpha) && !defined(linux)
 #include <sys/sysinfo.h>
 #include <machine/hal_sysinfo.h>
 #define ASSEMBLER

Re: [HACKERS] Linux/Alpha and pgsql....

From
Bruce Momjian
Date:
>     Ok, I grabbed the latest snapshot, April 11, 7am. The changes in
> templates/linuxalpha do fix some of the problems, and make fixing the rest
> easier. As it was "out-of-the-box", it (nearly) compiled and ran initdb
> sucessfully on my UDB. But there was quite a few failures and coredumps by
> postgres upon the running of regression tests.

OK, this is good.  Now my only issue is that is seems the 'alpha' define
it now too broad.  We are using 'alpha' to fix alpha issues, and to fix
'dec alpha' issues.  Is that true?

If it is, can we have the DEC alpha port define 'alpha' and 'decalpha'
and change the 'decalpha'-specific defines to use 'decalpha', the
linuxalpha defines to use 'linuxalpha', and the purely 'alpha'-specific
changes to use just normal 'alpha'.

I am requesting this because 'alpha' has been such a problem port for
us, and would like to have things REALLY clear now that we understand
them, so later, they will not get broken.

Can you review all the 'alpha' defines, and send us a patch that adds
'decalpha' define to the non-linux alpha port, and change the other
'ifdef's appropriately to everything works and is clean?

Release of 6.3.2 is due April 15th.  Hope that gives you enough time.
We hopefully can get a dec alpha person to test the changes you make, so
alpha works properly for 6.3.2.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [HACKERS] Linux/Alpha and pgsql....

From
The Hermit Hacker
Date:
On Sat, 11 Apr 1998, Ryan Kirkpatrick wrote:

>     Ok, attached are a new set of patches. First of all, ignore all

    Perfect...applied...

> previous patches I have sent on this thread. Now these three work on the

    Please confirm, since I haven't removed anything except those
things that these patches replaced...

> idea that 'alpha' and 'linux' are both defined. The former is defined by
> CFLAGS in template/linuxalpha, and latter is defined by the gcc on my UDB
> (and all other Linux/Alpha systems). This removes the need to add any
> defines to the CFLAGS line. To get rid of the other define (-Dalpha), we
> simply need to replace each 'defined(alpha)' with '(defined(alpha) ||
> defined(__alpha__))', as gcc automatically defines '__alpha__' like it
> does 'linux'. If you want me to do this, just ask.

    Please do...



Re: [HACKERS] Linux/Alpha and pgsql....

From
The Hermit Hacker
Date:
On Fri, 10 Apr 1998, Bruce Momjian wrote:

> Marc, would you install these as appropriate.  Also, you will find that
> I added to templates/linuxalpha the line:
>
>     linuxalpha:CFLAGS:-O2 -Dalpha
>                               ^^^^^^^

    This should be derived from the compiler...Ryan has reposted
patches that do this, an dwill be doing more to get rid of the -Dalpha...

Marc G. Fournier
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


Re: [HACKERS] Linux/Alpha and pgsql....

From
Ryan Kirkpatrick
Date:
On Sat, 11 Apr 1998, The Hermit Hacker wrote:

> >     Ok, attached are a new set of patches. First of all, ignore all
>
>     Perfect...applied...

    Thank you. :)

>     Please do...

    Ok, I will try and get the Linux/Alpha versus Dec/Alpha defines
sorted out by Tuesday evening. Though I can't make any promises, as the
work I have gotten done was thanks to a three day weekend. I will let you
all know when they are ready. But at the very least, pgsql will compile
and pretty much work on Linux/Alpha out of the box at this point. A major
step forward! :)

----------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                     |
|                                            --- Philippians 1:21 (KJV)    |
----------------------------------------------------------------------------
|  Ryan Kirkpatrick  |  Boulder, Colorado  | rkirkpat@nag.cs.colorado.edu  |
----------------------------------------------------------------------------
|               http://www-ugrad.cs.colorado.edu/~rkirkpat/                |
----------------------------------------------------------------------------


Re: [HACKERS] Linux/Alpha and pgsql....

From
Ryan Kirkpatrick
Date:
    I downloaded today's (13th) snapshot, and it compiled and ran
initdb just fine, right out of the box. So it looks like the patches made
it in just fine.

On Sun, 12 Apr 1998, The Hermit Hacker wrote:

>     This should be derived from the compiler...Ryan has reposted
> patches that do this, an dwill be doing more to get rid of the -Dalpha...

    Unfortunetly, I will not have patches to fix this until after the
15th deadline. I am too busy with school work (finals in two weeks!) at
the moment to take the time to get it done. I can't promise them anytime
earlier than a month from now. But, for the moment things are working
reasonably well (from a Linux/Alpha standpoint), and so while the current
state isn't pretty, it will have to do for now. Sorry.

    Also, in actually testing pgsql on Linux/Alpha on some real world
applications, I found most everything works. Though I hit a snag, that
when ever I try to select a datetime field from a table, postgres throws
an arthimetic trap, and the psql core dumps. Just a data point for you
all.

    Thanks, and TTYL.


----------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                     |
|                                            --- Philippians 1:21 (KJV)    |
----------------------------------------------------------------------------
|  Ryan Kirkpatrick  |  Boulder, Colorado  | rkirkpat@nag.cs.colorado.edu  |
----------------------------------------------------------------------------
|               http://www-ugrad.cs.colorado.edu/~rkirkpat/                |
----------------------------------------------------------------------------