Re: experimental pg_qcache patch - Mailing list pgsql-hackers

From Karel Zak
Subject Re: experimental pg_qcache patch
Date
Msg-id 20020414223932.A13461@zf.jcu.cz
Whole thread Raw
In response to Re: experimental pg_qcache patch  (Karel Zak <zakkr@zf.jcu.cz>)
Responses Re: experimental pg_qcache patch  (Neil Conway <nconway@klamath.dyndns.org>)
List pgsql-hackers
On Sun, Apr 14, 2002 at 10:13:17PM +0200, Karel Zak wrote:
> > (2) Sometimes executing a PREPARE gives this warning:
> > 
> > nconway=> prepare q1 as select * from pg_class;
> > WARNING:  AllocSetFree: detected write past chunk end in TransactionCommandContext 0x83087ac
> > PREPARE
> > 
> > Does anyone know what problem this indicates?
> 
>  The memory managment is diffrent between 7.0 and 7.2. There is
>  needful port cache shared-memory managment. I will look at it.
Hmm, I probably found it be first look to patch file.
The WARNING message is from leak detection. I'm sure that you seethis message if you use SHARE cache type.
- PREPARE_KEY_PREFIX_SIZE is 4 not 3
- in the PrepareKey() is needful fix:


+       if (store == PREPARE_STORE_SHARE) {     /* shared between same DB */
+               *flag |= QCF_SHARE_NOTREMOVEABLE;
+               key = (char *) palloc(strlen(name) + PREPARE_KEY_PREFIX_SIZE
+                                       + strlen(DatabaseName) +1);
     ^^^^^^^                                                 must be 3 
 

+               sprintf(key, "%s_%s_", DatabaseName, PREPARE_KEY_PREFIX);                             ^^^^^^
   the space for '_' is not allocated :-(
 
It's my bug probably, I good knew why we need leak detection :-)
       Karel
PS. Sorry that I don't send a patch, but now I haven't my computer there. 
-- Karel Zak  <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/C, PostgreSQL, PHP, WWW, http://docs.linux.cz,
http://mape.jcu.cz


pgsql-hackers by date:

Previous
From: "Rod Taylor"
Date:
Subject: Re: command.c breakup
Next
From: John Gray
Date:
Subject: Re: command.c breakup