Fix query cache memory leak.
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 27 May 2017 11:28:40 +0000 (20:28 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 27 May 2017 11:32:10 +0000 (20:32 +0900)
Clearing cache buffers in case of no oid queries (like BEGIN,
CHECKPOINT, VACUUM, etc) should have been done, but it did not.
Patch from Dang Minh Huong.

pool_memqcache.c

index 4031d16c19ed257d85e5b6d6e3845cec2b700981..db05cb3d1e33349ecfa89d83bbcd3b5874c0650c 100644 (file)
@@ -3246,6 +3246,14 @@ void pool_handle_query_cache(POOL_CONNECTION_POOL *backend, char *query, Node *n
                                        pool_check_and_discard_cache_buffer(num_oids, oids);
                                } 
                        }
+                       else if (num_oids == 0)
+                       {
+                               /* 
+                                * It is also necessary to clear cache buffers in case of
+                                * no oid queries (like BEGIN, CHECKPOINT, VACUUM, etc) too.
+                                */
+                               pool_reset_memqcache_buffer();
+                       }
                }
        }
 }