pgpool2.git / summary / log / commit / refs

commit    84c9c074104f7b607f87b38d6428ed4e096e3743
Author:   Muhammad Usama <m.usama@gmail.com>
Date:     Thu Apr 23 10:55:48 2015 +0000

    Fixing problem with memory cache invalidation
    
    [pgpool-general: 3643] Error in pgpool memory cache invalidation
    The internal buffer for storing the table oids needs to be homed in
    long living memory context as it has to survive throughout the child life.


src/query_cache/pool_memqcache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/query_cache/pool_memqcache.c b/src/query_cache/pool_memqcache.c index df74df344..b7f5584ab 100644 --- a/src/query_cache/pool_memqcache.c +++ b/src/query_cache/pool_memqcache.c @@ -1105,8 +1105,15 @@ void pool_add_dml_table_oid(int oid) if (oidbufp >= oidbuf_size) { + MemoryContext oldcxt; oidbuf_size += POOL_OIDBUF_SIZE; + /* + * This need to live throughout the life of child so home it in + * TopMemoryContext + */ + oldcxt = MemoryContextSwitchTo(TopMemoryContext); tmp = repalloc(oidbuf, sizeof(int) * oidbuf_size); + oldcxt = MemoryContextSwitchTo(oldcxt); if (tmp == NULL) return; @@ -1116,12 +1123,13 @@ void pool_add_dml_table_oid(int oid) for (i=0;i<oidbufp;i++) { if (oidbuf[i] == oid) - /* Already same oid exists */ + /* Already same oid exists */ return; } oidbuf[oidbufp++] = oid; } + /* * Get table oid buffer */ [parent: a87042d15768]