Re: Providing catalog view to pg_hba.conf file - Patch submission

From: Greg Stark <stark(at)mit(dot)edu>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Providing catalog view to pg_hba.conf file - Patch submission
Date: 2015-03-02 19:51:26
Message-ID: CAM-w4HPRvGQh3CRdOoaKBbEAbJ6bg4uOoryt-CzSMEhKpMvrYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 2, 2015 at 7:42 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> Uh, maybe because it's trying to allocate over 1GB and palloc() doesn't
> support that?

Nobody's allocating anything that big. It's a list of 25,000 pointers
to 472-byte structs. That should add up to about 11MB. Instead the
memory context is a total of 954606152 bytes which is still under a
gigabyte and the database does start up. It drives my laptop to a
crawl and Autovacuum crashes when it tries to start but the postmaster
is mostly happy. That's about 38k per line or about 80x as much as it
should be taking.

The tokenizer is run in a separate memory context which gets reset
when this is done. Then during parsing it copies things from that
memory context over as needed to fill in the struct. In my example
pg_hba.c it shouldn't have to copy anything over though so even if
there's a bug there I don't see how it would cause this.

My best guess is that some functions called allocate some temporary
storage. I haven't spotted them yet though I put this aside when I
first sent my message. It seems like it would be safest to use a
temporary memory context throughout the whole process and only copy
things to the hba memory context manually.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2015-03-02 19:57:57 Re: Bug in pg_dump
Previous Message Stephen Frost 2015-03-02 19:42:41 Re: Providing catalog view to pg_hba.conf file - Patch submission