[Pgpool-general] Large insert queries

Lee Smith lee.smith at aionex.com
Thu Nov 9 21:18:49 UTC 2006


And the second one, sorry for the flood.

After some more investigation, I've located another issue; however fixing this one seems to clear up any crashing, although it's probably leaking memory now (or something worse).

In pool_memory_alloc (pool_memory.c):

                int fidx = get_free_index(size + POOL_HEADER_SIZE);
                int allocsize = 1 << (fidx + ALIGN);

                /* pick up from freelist */
                if (pool->freelist[fidx] != NULL)
                {
                        chunk = pool->freelist[fidx];

                .......

get_free_index is returning 11 for fidx which is off-by-one according to the declaration of pool->freelist in pool_memory.h:

...
#define SLOT_NUM 11
...
POOL_CHUNK *freelist[SLOT_NUM];


Thus indexing pool->freelist[fidx] where fidx is 11 should break stuff I'd assume (and it is :)). Adding these lines to get_free_index, right before the return seems to alleviate the symptoms:

        if(idx >= SLOT_NUM)
          idx--;

However, not being that familiar with this code, there is no telling what sort of awful things I'm causing just by hacking out the crashes :).

----- Original Message -----
From: Yoshiyuki Asaba <y-asaba at sraoss.co.jp>
To: lee smith <lee.smith at aionex.com>
Cc: pgpool-general at pgfoundry.org
Sent: Saturday, November 4, 2006 1:43:17 AM GMT-0600 US/Central
Subject: Re: [Pgpool-general] Large insert queries

Hi,

From: Lee Smith <lee.smith at aionex.com>
Subject: [Pgpool-general] Large insert queries
Date: Fri, 3 Nov 2006 14:29:12 -0800 (PST)

>    There seems to be some issues with really large insert queries (~50k into a text column, its not my fault ;)).  The first issue is in parser/pool_memory.c in the function pool_memory_free.  

Thank you for the report. I fixed it.

http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/pgpool/pgpool-II/parser/pool_memory.c.diff?r1=1.1&r2=1.2&f=u

--
Yoshiyuki Asaba
y-asaba at sraoss.co.jp



More information about the Pgpool-general mailing list