Thread

  1. pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@postgresql.org> — 2010-01-05T01:06:57Z

    Log Message:
    -----------
    Get rid of the need for manual maintenance of the initial contents of
    pg_attribute, by having genbki.pl derive the information from the various
    catalog header files.  This greatly simplifies modification of the
    "bootstrapped" catalogs.
    
    This patch finally kills genbki.sh and Gen_fmgrtab.sh; we now rely entirely on
    Perl scripts for those build steps.  To avoid creating a Perl build dependency
    where there was not one before, the output files generated by these scripts
    are now treated as distprep targets, ie, they will be built and shipped in
    tarballs.  But you will need a reasonably modern Perl (probably at least
    5.6) if you want to build from a CVS pull.
    
    The changes to the MSVC build process are untested, and may well break ---
    we'll soon find out from the buildfarm.
    
    John Naylor, based on ideas from Robert Haas and others
    
    Modified Files:
    --------------
        pgsql/doc/src/sgml:
            bki.sgml (r1.22 -> r1.23)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/bki.sgml?r1=1.22&r2=1.23)
            installation.sgml (r1.335 -> r1.336)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/installation.sgml?r1=1.335&r2=1.336)
        pgsql/src/backend:
            Makefile (r1.137 -> r1.138)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/Makefile?r1=1.137&r2=1.138)
        pgsql/src/backend/catalog:
            Makefile (r1.74 -> r1.75)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/Makefile?r1=1.74&r2=1.75)
            README (r1.13 -> r1.14)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/README?r1=1.13&r2=1.14)
        pgsql/src/backend/utils:
            Gen_fmgrtab.pl (r1.3 -> r1.4)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/Gen_fmgrtab.pl?r1=1.3&r2=1.4)
            Makefile (r1.28 -> r1.29)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/Makefile?r1=1.28&r2=1.29)
        pgsql/src/backend/utils/cache:
            relcache.c (r1.295 -> r1.296)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/relcache.c?r1=1.295&r2=1.296)
        pgsql/src/include:
            Makefile (r1.29 -> r1.30)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/Makefile?r1=1.29&r2=1.30)
        pgsql/src/include/catalog:
            genbki.h (r1.5 -> r1.6)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/genbki.h?r1=1.5&r2=1.6)
            indexing.h (r1.114 -> r1.115)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/indexing.h?r1=1.114&r2=1.115)
            pg_aggregate.h (r1.69 -> r1.70)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_aggregate.h?r1=1.69&r2=1.70)
            pg_am.h (r1.64 -> r1.65)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_am.h?r1=1.64&r2=1.65)
            pg_amop.h (r1.91 -> r1.92)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_amop.h?r1=1.91&r2=1.92)
            pg_amproc.h (r1.76 -> r1.77)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_amproc.h?r1=1.76&r2=1.77)
            pg_attrdef.h (r1.25 -> r1.26)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_attrdef.h?r1=1.25&r2=1.26)
            pg_attribute.h (r1.156 -> r1.157)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_attribute.h?r1=1.156&r2=1.157)
            pg_auth_members.h (r1.7 -> r1.8)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_auth_members.h?r1=1.7&r2=1.8)
            pg_authid.h (r1.11 -> r1.12)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_authid.h?r1=1.11&r2=1.12)
            pg_cast.h (r1.43 -> r1.44)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_cast.h?r1=1.43&r2=1.44)
            pg_class.h (r1.118 -> r1.119)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_class.h?r1=1.118&r2=1.119)
            pg_constraint.h (r1.35 -> r1.36)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_constraint.h?r1=1.35&r2=1.36)
            pg_conversion.h (r1.23 -> r1.24)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_conversion.h?r1=1.23&r2=1.24)
            pg_database.h (r1.52 -> r1.53)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_database.h?r1=1.52&r2=1.53)
            pg_db_role_setting.h (r1.2 -> r1.3)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_db_role_setting.h?r1=1.2&r2=1.3)
            pg_default_acl.h (r1.2 -> r1.3)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_default_acl.h?r1=1.2&r2=1.3)
            pg_depend.h (r1.12 -> r1.13)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_depend.h?r1=1.12&r2=1.13)
            pg_description.h (r1.29 -> r1.30)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_description.h?r1=1.29&r2=1.30)
            pg_enum.h (r1.7 -> r1.8)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_enum.h?r1=1.7&r2=1.8)
            pg_foreign_data_wrapper.h (r1.4 -> r1.5)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_foreign_data_wrapper.h?r1=1.4&r2=1.5)
            pg_foreign_server.h (r1.4 -> r1.5)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_foreign_server.h?r1=1.4&r2=1.5)
            pg_index.h (r1.49 -> r1.50)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_index.h?r1=1.49&r2=1.50)
            pg_inherits.h (r1.29 -> r1.30)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_inherits.h?r1=1.29&r2=1.30)
            pg_language.h (r1.36 -> r1.37)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_language.h?r1=1.36&r2=1.37)
            pg_largeobject.h (r1.26 -> r1.27)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_largeobject.h?r1=1.26&r2=1.27)
            pg_largeobject_metadata.h (r1.2 -> r1.3)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_largeobject_metadata.h?r1=1.2&r2=1.3)
            pg_listener.h (r1.27 -> r1.28)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_listener.h?r1=1.27&r2=1.28)
            pg_namespace.h (r1.26 -> r1.27)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_namespace.h?r1=1.26&r2=1.27)
            pg_opclass.h (r1.86 -> r1.87)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_opclass.h?r1=1.86&r2=1.87)
            pg_operator.h (r1.168 -> r1.169)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_operator.h?r1=1.168&r2=1.169)
            pg_opfamily.h (r1.12 -> r1.13)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_opfamily.h?r1=1.12&r2=1.13)
            pg_pltemplate.h (r1.11 -> r1.12)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_pltemplate.h?r1=1.11&r2=1.12)
            pg_proc.h (r1.558 -> r1.559)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h?r1=1.558&r2=1.559)
            pg_rewrite.h (r1.34 -> r1.35)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_rewrite.h?r1=1.34&r2=1.35)
            pg_shdepend.h (r1.11 -> r1.12)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_shdepend.h?r1=1.11&r2=1.12)
            pg_shdescription.h (r1.8 -> r1.9)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_shdescription.h?r1=1.8&r2=1.9)
            pg_statistic.h (r1.41 -> r1.42)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_statistic.h?r1=1.41&r2=1.42)
            pg_tablespace.h (r1.13 -> r1.14)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_tablespace.h?r1=1.13&r2=1.14)
            pg_trigger.h (r1.37 -> r1.38)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_trigger.h?r1=1.37&r2=1.38)
            pg_ts_config.h (r1.6 -> r1.7)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_ts_config.h?r1=1.6&r2=1.7)
            pg_ts_config_map.h (r1.6 -> r1.7)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_ts_config_map.h?r1=1.6&r2=1.7)
            pg_ts_dict.h (r1.6 -> r1.7)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_ts_dict.h?r1=1.6&r2=1.7)
            pg_ts_parser.h (r1.6 -> r1.7)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_ts_parser.h?r1=1.6&r2=1.7)
            pg_ts_template.h (r1.7 -> r1.8)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_ts_template.h?r1=1.7&r2=1.8)
            pg_type.h (r1.211 -> r1.212)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_type.h?r1=1.211&r2=1.212)
            pg_user_mapping.h (r1.4 -> r1.5)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_user_mapping.h?r1=1.4&r2=1.5)
            toasting.h (r1.11 -> r1.12)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/toasting.h?r1=1.11&r2=1.12)
        pgsql/src/interfaces/ecpg/ecpglib:
            pg_type.h (r1.10 -> r1.11)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/ecpglib/pg_type.h?r1=1.10&r2=1.11)
        pgsql/src/tools/msvc:
            Solution.pm (r1.51 -> r1.52)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/tools/msvc/Solution.pm?r1=1.51&r2=1.52)
            clean.bat (r1.17 -> r1.18)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/tools/msvc/clean.bat?r1=1.17&r2=1.18)
    
    Added Files:
    -----------
        pgsql/src/backend/catalog:
            .cvsignore (r1.1)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup)
            Catalog.pm (r1.1)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/Catalog.pm?rev=1.1&content-type=text/x-cvsweb-markup)
            genbki.pl (r1.1)
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/genbki.pl?rev=1.1&content-type=text/x-cvsweb-markup)
    
    Removed Files:
    -------------
        pgsql/src/backend/catalog:
            genbki.sh
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/genbki.sh)
        pgsql/src/backend/utils:
            Gen_fmgrtab.sh
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/Gen_fmgrtab.sh)
        pgsql/src/tools/msvc:
            Genbki.pm
            (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/tools/msvc/Genbki.pm)
    
    
  2. Re: pgsql: Get rid of the need for manual maintenance of the initial

    Robert Haas <robertmhaas@gmail.com> — 2010-01-05T01:28:55Z

    On Mon, Jan 4, 2010 at 8:06 PM, Tom Lane <tgl@postgresql.org> wrote:
    > Log Message:
    > -----------
    > Get rid of the need for manual maintenance of the initial contents of
    > pg_attribute, by having genbki.pl derive the information from the various
    > catalog header files.  This greatly simplifies modification of the
    > "bootstrapped" catalogs.
    >
    > This patch finally kills genbki.sh and Gen_fmgrtab.sh; we now rely entirely on
    > Perl scripts for those build steps.  To avoid creating a Perl build dependency
    > where there was not one before, the output files generated by these scripts
    > are now treated as distprep targets, ie, they will be built and shipped in
    > tarballs.  But you will need a reasonably modern Perl (probably at least
    > 5.6) if you want to build from a CVS pull.
    >
    > The changes to the MSVC build process are untested, and may well break ---
    > we'll soon find out from the buildfarm.
    >
    > John Naylor, based on ideas from Robert Haas and others
    
    Awesome.
    
    ...Robert
    
    
  3. Re: pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T02:20:42Z

    Robert Haas <robertmhaas@gmail.com> writes:
    > Awesome.
    
    It still needs some makefile work, but I wanted to push it in so we
    could see if the MSVC stuff works.
    
    			regards, tom lane
    
    
  4. Re: pgsql: Get rid of the need for manual maintenance of the initial

    Andrew Dunstan <andrew@dunslane.net> — 2010-01-05T02:34:07Z

    
    Tom Lane wrote:
    > Robert Haas <robertmhaas@gmail.com> writes:
    >   
    >> Awesome.
    >>     
    >
    > It still needs some makefile work, but I wanted to push it in so we
    > could see if the MSVC stuff works.
    >
    > 		
    >   
    
    Looks like it does.
    
    cheers
    
    andrew
    
    
  5. Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> — 2010-01-05T17:24:39Z

    Tom Lane wrote:
    > Log Message:
    > -----------
    > Get rid of the need for manual maintenance of the initial contents of
    > pg_attribute, by having genbki.pl derive the information from the various
    > catalog header files.  This greatly simplifies modification of the
    > "bootstrapped" catalogs.
    > 
    > This patch finally kills genbki.sh and Gen_fmgrtab.sh; we now rely entirely on
    > Perl scripts for those build steps.  To avoid creating a Perl build dependency
    > where there was not one before, the output files generated by these scripts
    > are now treated as distprep targets, ie, they will be built and shipped in
    > tarballs.  But you will need a reasonably modern Perl (probably at least
    > 5.6) if you want to build from a CVS pull.
    
    this broke the build on spoonbill:
    
    http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spoonbill&dt=2010-01-05%2015:05:08
    
    manually executing the command shows that the perl process eats more 
    than 250MB of RAM at closely afterwards fails with an out of memory due 
    to hitting the process limit on that box.
    I don't think that is in any way sane :)
    
    
    # perl -v
    This is perl, v5.8.8 built for sparc64-openbsd
    
    
    Stefan
    
    
  6. Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T17:40:02Z

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
    > this broke the build on spoonbill:
    
    > http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spoonbill&dt=2010-01-05%2015:05:08
    
    > manually executing the command shows that the perl process eats more 
    > than 250MB of RAM at closely afterwards fails with an out of memory due 
    > to hitting the process limit on that box.
    > I don't think that is in any way sane :)
    
    Bizarre.  Gen_fmgrtab.pl doesn't eat anywhere near that much RAM here.
    Anybody else seeing the same?
    
    			regards, tom lane
    
    
  7. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Robert Haas <robertmhaas@gmail.com> — 2010-01-05T17:40:04Z

    On Tue, Jan 5, 2010 at 12:24 PM, Stefan Kaltenbrunner
    <stefan@kaltenbrunner.cc> wrote:
    > Tom Lane wrote:
    >>
    >> Log Message:
    >> -----------
    >> Get rid of the need for manual maintenance of the initial contents of
    >> pg_attribute, by having genbki.pl derive the information from the various
    >> catalog header files.  This greatly simplifies modification of the
    >> "bootstrapped" catalogs.
    >>
    >> This patch finally kills genbki.sh and Gen_fmgrtab.sh; we now rely
    >> entirely on
    >> Perl scripts for those build steps.  To avoid creating a Perl build
    >> dependency
    >> where there was not one before, the output files generated by these
    >> scripts
    >> are now treated as distprep targets, ie, they will be built and shipped in
    >> tarballs.  But you will need a reasonably modern Perl (probably at least
    >> 5.6) if you want to build from a CVS pull.
    >
    > this broke the build on spoonbill:
    >
    > http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spoonbill&dt=2010-01-05%2015:05:08
    >
    > manually executing the command shows that the perl process eats more than
    > 250MB of RAM at closely afterwards fails with an out of memory due to
    > hitting the process limit on that box.
    > I don't think that is in any way sane :)
    >
    >
    > # perl -v
    > This is perl, v5.8.8 built for sparc64-openbsd
    
    I just tried this with ulimit -v 131072 and it worked.  At 65536 and
    32768 it emited an error about being unable to set the locale but
    still seemed to run.  At 32768 it couldn't load all its shared
    libraries any more so it croaked, but with a different error message.
    
    Can we get the output of ulimit -a on that machine?
    
    Is there by any chance some other, conflicting Catalog.pm on that machine?
    
    ...Robert
    
    
  8. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> — 2010-01-05T17:49:24Z

    Robert Haas wrote:
    > On Tue, Jan 5, 2010 at 12:24 PM, Stefan Kaltenbrunner
    > <stefan@kaltenbrunner.cc> wrote:
    >> Tom Lane wrote:
    >>> Log Message:
    >>> -----------
    >>> Get rid of the need for manual maintenance of the initial contents of
    >>> pg_attribute, by having genbki.pl derive the information from the various
    >>> catalog header files.  This greatly simplifies modification of the
    >>> "bootstrapped" catalogs.
    >>>
    >>> This patch finally kills genbki.sh and Gen_fmgrtab.sh; we now rely
    >>> entirely on
    >>> Perl scripts for those build steps.  To avoid creating a Perl build
    >>> dependency
    >>> where there was not one before, the output files generated by these
    >>> scripts
    >>> are now treated as distprep targets, ie, they will be built and shipped in
    >>> tarballs.  But you will need a reasonably modern Perl (probably at least
    >>> 5.6) if you want to build from a CVS pull.
    >> this broke the build on spoonbill:
    >>
    >> http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spoonbill&dt=2010-01-05%2015:05:08
    >>
    >> manually executing the command shows that the perl process eats more than
    >> 250MB of RAM at closely afterwards fails with an out of memory due to
    >> hitting the process limit on that box.
    >> I don't think that is in any way sane :)
    >>
    >>
    >> # perl -v
    >> This is perl, v5.8.8 built for sparc64-openbsd
    > 
    > I just tried this with ulimit -v 131072 and it worked.  At 65536 and
    > 32768 it emited an error about being unable to set the locale but
    > still seemed to run.  At 32768 it couldn't load all its shared
    > libraries any more so it croaked, but with a different error message.
    > 
    > Can we get the output of ulimit -a on that machine?
    
    $ ulimit -a
    time(cpu-seconds)    unlimited
    file(blocks)         unlimited
    coredump(blocks)     unlimited
    data(kbytes)         524288
    stack(kbytes)        4096
    lockedmem(kbytes)    334589
    memory(kbytes)       1000456
    nofiles(descriptors) 128
    processes            64
    
    
    > 
    > Is there by any chance some other, conflicting Catalog.pm on that machine?
    
    as I said I can reproduce it manually withe the Catalog.pm from the 
    failing build as well.
    I can succeed building it using the root account but that runs the box 
    more or less out of memory as it eats up to ~550MB RSS and 990MB of SIZE...
    
    
    
    Stefan
    
    
  9. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T17:51:48Z

    Robert Haas <robertmhaas@gmail.com> writes:
    > Is there by any chance some other, conflicting Catalog.pm on that machine?
    
    Even if there is, shouldn't the use of "perl -I" ensure our version gets
    loaded?
    
    Also, Stefan's log shows that it got through genbki.pl, so whatever the
    problem is, I don't think it's Catalog.pm's fault.
    
    			regards, tom lane
    
    
  10. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Robert Haas <robertmhaas@gmail.com> — 2010-01-05T18:11:05Z

    On Tue, Jan 5, 2010 at 12:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    > Robert Haas <robertmhaas@gmail.com> writes:
    >> Is there by any chance some other, conflicting Catalog.pm on that machine?
    >
    > Even if there is, shouldn't the use of "perl -I" ensure our version gets
    > loaded?
    
    I would certainly think so.
    
    > Also, Stefan's log shows that it got through genbki.pl, so whatever the
    > problem is, I don't think it's Catalog.pm's fault.
    
    Beats me.  I don't have any other ideas at the moment.
    
    ...Robert
    
    
  11. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T18:18:28Z

    Robert Haas <robertmhaas@gmail.com> writes:
    > Beats me.  I don't have any other ideas at the moment.
    
    Stefan, could you try adding some debugging printouts to the
    Gen_fmgrtab.pl script to see how far it gets before blowing up?
    
    			regards, tom lane
    
    
  12. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> — 2010-01-05T18:44:07Z

    Tom Lane wrote:
    > Robert Haas <robertmhaas@gmail.com> writes:
    >> Beats me.  I don't have any other ideas at the moment.
    > 
    > Stefan, could you try adding some debugging printouts to the
    > Gen_fmgrtab.pl script to see how far it gets before blowing up?
    
    did that and it seems the problem is in the loop that does:
    
    foreach my $row (@$data)
    {
    
         # To construct fmgroids.h and fmgrtab.c, we need to inspect some
         # of the individual data fields.  Just splitting on whitespace
         # won't work, because some quoted fields might contain internal
         # whitespace.  We handle this by folding them all to a simple
         # "xxx". Fortunately, this script doesn't need to look at any
         # fields that might need quoting, so this simple hack is
         # sufficient.
    
    ...
    }
    
    it does after around 1050 iterations of that loop at it seems to leak 
    exactly 240kbyte per iteration which sums up to around 250MB in total 
    for the process...
    
    
    Stefan
    
    
  13. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T19:02:51Z

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
    > did that and it seems the problem is in the loop that does:
    
    > foreach my $row (@$data)
    > {
    
    >      # To construct fmgroids.h and fmgrtab.c, we need to inspect some
    >      # of the individual data fields.  Just splitting on whitespace
    
    Huh.  It's weird that I don't see a leak in either 5.8.7 or 5.10.1,
    which are the two closest perl versions I have handy here.  I think
    this may be a platform-specific Perl bug.  Still, it would be nice
    to work around it if we can.
    
    I'm not nearly good enough in Perl to be sure about the semantics
    of this loop.  Is it possible that it's changing the global contents
    of the @$data structure, rather than just hacking a local copy of
    each row before pushing some values into @fmgr?
    
    			regards, tom lane
    
    
  14. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Alvaro Herrera <alvherre@commandprompt.com> — 2010-01-05T19:04:05Z

    Stefan Kaltenbrunner escribió:
    
    > foreach my $row (@$data)
    > {
    > 
    >     # To construct fmgroids.h and fmgrtab.c, we need to inspect some
    >     # of the individual data fields.  Just splitting on whitespace
    >     # won't work, because some quoted fields might contain internal
    >     # whitespace.  We handle this by folding them all to a simple
    >     # "xxx". Fortunately, this script doesn't need to look at any
    >     # fields that might need quoting, so this simple hack is
    >     # sufficient.
    > 
    > ...
    > }
    > 
    > it does after around 1050 iterations of that loop at it seems to
    > leak exactly 240kbyte per iteration which sums up to around 250MB in
    > total for the process...
    
    Hmm, is this running some old Perl version?  Perhaps it's not freeing
    memory timely ... maybe unsetting/deleting $row after each iteration?
    
    -- 
    Alvaro Herrera                                http://www.CommandPrompt.com/
    PostgreSQL Replication, Consulting, Custom Development, 24x7 support
    
    
  15. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> — 2010-01-05T19:23:15Z

    Tom Lane wrote:
    > Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
    >> did that and it seems the problem is in the loop that does:
    > 
    >> foreach my $row (@$data)
    >> {
    > 
    >>      # To construct fmgroids.h and fmgrtab.c, we need to inspect some
    >>      # of the individual data fields.  Just splitting on whitespace
    > 
    > Huh.  It's weird that I don't see a leak in either 5.8.7 or 5.10.1,
    > which are the two closest perl versions I have handy here.  I think
    > this may be a platform-specific Perl bug.  Still, it would be nice
    > to work around it if we can.
    
    yeah it is probably some strange platform specific issue - however with 
    some help from the IRC channel I came up with the following patch that
    considerable reduces the memory bloat (but still needs ~55MB max) and 
    allows the build to succeed.
    
    
    > 
    > I'm not nearly good enough in Perl to be sure about the semantics
    > of this loop.  Is it possible that it's changing the global contents
    > of the @$data structure, rather than just hacking a local copy of
    > each row before pushing some values into @fmgr?
    
    hmm it is leaking a constant amount of 240kbyte per loop iteration with 
    the original code but yeah very weird issue...
    
    
    Stefan
    
  16. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T19:31:43Z

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
    > yeah it is probably some strange platform specific issue - however with 
    > some help from the IRC channel I came up with the following patch that
    > considerable reduces the memory bloat (but still needs ~55MB max) and 
    > allows the build to succeed.
    
    What about Alvaro's idea of adding
    
    	$row = undef;
    
    at the bottom of the loop?  That seems marginally less ugly...
    
    			regards, tom lane
    
    
  17. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Hamlin, Garick L <ghamlin@isc.upenn.edu> — 2010-01-05T19:37:51Z

    On Tue, Jan 05, 2010 at 02:02:51PM -0500, Tom Lane wrote:
    > Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
    > > did that and it seems the problem is in the loop that does:
    > 
    > > foreach my $row (@$data)
    > > {
    > 
    > >      # To construct fmgroids.h and fmgrtab.c, we need to inspect some
    > >      # of the individual data fields.  Just splitting on whitespace
    > 
    > Huh.  It's weird that I don't see a leak in either 5.8.7 or 5.10.1,
    > which are the two closest perl versions I have handy here.  I think
    > this may be a platform-specific Perl bug.  Still, it would be nice
    > to work around it if we can.
    > 
    > I'm not nearly good enough in Perl to be sure about the semantics
    > of this loop.  Is it possible that it's changing the global contents
    > of the @$data structure, rather than just hacking a local copy of
    > each row before pushing some values into @fmgr?
    Yes, that is what would happen.  
    I have not read this script at all but that is how perl works...
    
    $row is an aliased to each scalar in the list '(@$data)'
    
    There is no copying.  Copying happens on list assignment, 
    but not with for/foreach.
    
    If you wanted a copy you need something like:
    foreach my $row (@{[ @$data ]}) {
    
    for a shallow copy.
    
    Is that a problem? (I haven't read the script)
    
    Garick
    
    > 
    > 			regards, tom lane
    > 
    > -- 
    > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
    > To make changes to your subscription:
    > http://www.postgresql.org/mailpref/pgsql-hackers
    
    
  18. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T19:42:03Z

    Garick Hamlin <ghamlin@isc.upenn.edu> writes:
    > On Tue, Jan 05, 2010 at 02:02:51PM -0500, Tom Lane wrote:
    >> I'm not nearly good enough in Perl to be sure about the semantics
    >> of this loop.  Is it possible that it's changing the global contents
    >> of the @$data structure, rather than just hacking a local copy of
    >> each row before pushing some values into @fmgr?
    
    > Yes, that is what would happen.  
    > Is that a problem? (I haven't read the script)
    
    Well, it *shouldn't* be a problem, but what it looks like to me is
    that Stefan's perl version is somehow leaking one copy of the whole
    $data structure each time through the loop.  If we were to copy and
    then modify each row individually, maybe that'd dodge the bug.
    
    			regards, tom lane
    
    
  19. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> — 2010-01-05T19:43:56Z

    Tom Lane wrote:
    > Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
    >> yeah it is probably some strange platform specific issue - however with 
    >> some help from the IRC channel I came up with the following patch that
    >> considerable reduces the memory bloat (but still needs ~55MB max) and 
    >> allows the build to succeed.
    > 
    > What about Alvaro's idea of adding
    > 
    > 	$row = undef;
    > 
    > at the bottom of the loop?  That seems marginally less ugly...
    
    not sure I want to argue about the ugliness of perl but that has the 
    same effect as my patch so either way would do to get spoonbill green again.
    
    Stefan
    
    
  20. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T20:23:57Z

    Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
    >> What about Alvaro's idea of adding
    >> $row = undef;
    >> at the bottom of the loop?  That seems marginally less ugly...
    
    > not sure I want to argue about the ugliness of perl but that has the 
    > same effect as my patch so either way would do to get spoonbill green again.
    
    OK, done.
    
    			regards, tom lane
    
    
  21. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Andrew Dunstan <andrew@dunslane.net> — 2010-01-05T20:36:30Z

    
    Tom Lane wrote:
    > I'm not nearly good enough in Perl to be sure about the semantics
    > of this loop.  Is it possible that it's changing the global contents
    > of the @$data structure, rather than just hacking a local copy of
    > each row before pushing some values into @fmgr?
    >   
    
    That's exactly what it does. The loop variable is an alias. See 
    perlsyn(1) for details.
    
    These two lines appear to be suspicious:
    
        $row->{bki_values} =~ s/"[^"]*"/"xxx"/g;
        @{$row}{@attnames} = split /\s+/, $row->{bki_values};
    
    Something like:
    
        (my $bkival = $row->{bki_values}) =~ s/"[^"]*"/"xxx"/g;
        my $atts = {};
        @{$atts}{@attnames} = split /\s+/, $bkival;
    
    might work better.
    
    cheers
    
    andrew
    
    
    
  22. Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-01-05T20:48:23Z

    Andrew Dunstan <andrew@dunslane.net> writes:
    > Something like:
    >     (my $bkival = $row->{bki_values}) =~ s/"[^"]*"/"xxx"/g;
    >     my $atts = {};
    >     @{$atts}{@attnames} = split /\s+/, $bkival;
    > might work better.
    
    I committed Alvaro's suggestion (undef at the bottom), but feel
    free to clean it up if you like this way better.
    
    			regards, tom lane