[pgpool-hackers: 4272] Re: Fixing query cache bugs

Tatsuo Ishii ishii at sraoss.co.jp
Sun Jan 29 19:46:36 JST 2023


> Hi,
> 
> I have found multiple query cache bugs.
> 
> 1) pool_add_item_shmem_cache() calls pool_init_cache_block() when
>    there's no free cache item hash table entry. But this is
>    unnecessary since pool_reuse_block() is already called from
>    pool_add_item_shmem_cache(). This is actually harmless because the
>    second pool_init_cache_block() call just set the same data as the
>    first call of pool_init_cache_block(). It's just a waste of CPU
>    cycle.
> 
> 2) The cache blocks are supposed to be initialized while Pgpool-II
>    starts up but actually not. Each cache block has the free space
>    length in the block header after initialization. Since the free
>    space length is not set, pool_get_block() fails to find a cache
>    block which has enough free space, and it calls pool_reuse_block(),
>    which is actually unnecessary (you will see something like
>    "pool_reuse_block: blockid: 0" in pgpool log). Since
>    pool_reuse_block() returns a free block anyway, this is just a
>    waste of CPU cyle but better to fix.
> 
> Attached is a proposed fix (along with assorted comment fixes).

Previous patch was incomplete. It lacked patches against
pool_memqcache.h and pgpool_main.c.  Attached is the v2 patch.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_query_cache_v2.patch
Type: text/x-patch
Size: 4150 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20230129/6cdf97fa/attachment.bin>


More information about the pgpool-hackers mailing list