Thread: tzdata issue on cross-compiled postgresql

tzdata issue on cross-compiled postgresql

From
"Tim Yardley"
Date:
Hackers;

I've noticed a strangeness on our cross-compiled uclibc linked
postgresql package that I was hoping to elicit some help with.

This is probably best described by showing some queries with
commentary, so on with that.

postgres=# select count(*) from pg_timezone_names where utc_offset != '00:00';count
-------    0
postgres=# select count(*) from pg_timezone_names where utc_offset != '00:00';count
-------  504
postgres=# select count(*) from pg_timezone_names where utc_offset != '00:00';count
-------    0
postgres=# select *from pg_timezone_names where utc_offset != '00:00' limit 5;name | abbrev | utc_offset | is_dst
------+--------+------------+--------
(0 rows)

postgres=# select *from pg_timezone_names where utc_offset != '00:00' limit 5;      name        | abbrev | utc_offset |
is_dst
-------------------+--------+------------+--------Africa/Algiers    | CET    | 01:00:00   | fAfrica/Luanda     | WAT
|01:00:00   | fAfrica/Porto-Novo | WAT    | 01:00:00   | fAfrica/Gaborone   | CAT    | 02:00:00   | fAfrica/Bujumbura
|CAT    | 02:00:00   | f
 
(5 rows)

As seen, the output is erratic, but when it is giving results, they
seem to be correct.

# pg_config
BINDIR = /usr/bin
DOCDIR = /usr/doc/postgresql
INCLUDEDIR = /usr/include
PKGINCLUDEDIR = /usr/include/postgresql
INCLUDEDIR-SERVER = /usr/include/postgresql/server
LIBDIR = /usr/lib
PKGLIBDIR = /usr/lib/postgresql
LOCALEDIR =
MANDIR = /usr/share/man
SHAREDIR = /usr/share/postgresql
SYSCONFDIR = /etc/postgresql
PGXS = /usr/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--target=i386-linux' '--host=i386-linux'
'--build=i486-linux-gnu' '--program-prefix=' '--program-suffix='
'--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin'
'--datadir=/usr/share' '--includedir=/usr/include'
'--infodir=/usr/share/info' '--libdir=/usr/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var'
'--mandir=/usr/share/man' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--disable-nls' '--enable-shared' '--enable-static' '--disable-rpath'
'--without-java' '--without-krb4' '--without-krb5' '--without-openssl'
'--without-pam' '--without-perl' '--without-python'
'--without-rendezvous' '--without-tcl' '--without-tk'
'--with-zlib=yes' '--enable-depend' 'CC=i386-linux-uclibc-gcc'
'CFLAGS=-O2 -pipe -march=i486 -funit-at-a-time' 'CPPFLAGS=
-I/mnt/build/kamikaze/staging_dir_i386/usr/include
-I/mnt/build/kamikaze/staging_dir_i386/include'
'LDFLAGS=-L/mnt/build/kamikaze/staging_dir_i386/usr/lib
-L/mnt/build/kamikaze/staging_dir_i386/lib'
'build_alias=i486-linux-gnu' 'host_alias=i386-linux'
'target_alias=i386-linux'
CC = i386-linux-uclibc-gcc
CPPFLAGS = -I/mnt/build/kamikaze/staging_dir_i386/usr/include
-I/mnt/build/kamikaze/staging_dir_i386/include -D_GNU_SOURCE
CFLAGS = -O2 -pipe -march=i486 -funit-at-a-time -Wall
-Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
CFLAGS_SL = -fpic
LDFLAGS = -L/mnt/build/kamikaze/staging_dir_i386/usr/lib
-L/mnt/build/kamikaze/staging_dir_i386/lib
LDFLAGS_SL =
LIBS = -lpgport -lz -lreadline -lncurses -lcrypt -ldl -lm -lnotimpl
VERSION = PostgreSQL 8.2.5

uclibc version is 0.9.28-10 from our tree (-10 is our versioning).

You can see the current public cross-compilation Makefile for
postgresql at https://dev.openwrt.org/browser/packages/libs/postgresql/Makefile

Note, that in the current version of the Makefile that is uncommitted,
I have the following changes:
* I've removed --disable-integer-datetimes (per the suggestion of
someone in #postgresql on freenode)
* I've added a sed replacement (posix zone from the tzdata file
doesn't seem to exist anymore?) * $(SED) 's@US/Eastern@America/New_York@'
$(PKG_BUILD_DIR)/src/timezone/Makefile

None of those have affected it at this point.  I'd appreciate any help
on this matter that you guys can provide.  If you need any more
information, please don't hesitate to ask.

/tmy


Re: tzdata issue on cross-compiled postgresql

From
Tom Lane
Date:
"Tim Yardley" <lst@openwrt.org> writes:
> postgres=# select count(*) from pg_timezone_names where utc_offset != '00:00';
>  count
> -------
>      0
> postgres=# select count(*) from pg_timezone_names where utc_offset != '00:00';
>  count
> -------
>    504
> postgres=# select count(*) from pg_timezone_names where utc_offset != '00:00';
>  count
> -------
>      0

That's just bizarre ... IIRC the output of that view is computed by
scanning the timezone directories, and you wouldn't expect that to
change.

Can you strace the backend while it's doing this and see if there's a
difference in the series of kernel calls issued?
        regards, tom lane


Re: tzdata issue on cross-compiled postgresql

From
Tom Lane
Date:
"Tim Yardley" <yardley@gmail.com> writes:
>> Can you strace the backend while it's doing this and see if there's a
>> difference in the series of kernel calls issued?

> See attached strace.  Let me know if you see anything enlightening.

Nope :-(.  The strace output is *exactly* the same across all four
instances, except for the number of bytes sent over to the client,
which reflects the difference between "504" and "0".  It's possible
that something is lurking in the data that strace didn't show, but
I think that's unlikely.  Somehow the misfeasance is happening within
Postgres proper.

I think you'll have to get out a debugger and trace through it to
find out where the rows are getting discarded ...
        regards, tom lane