OSDN Git Service

A strange message is emitted after a crash or the first time
authorTatsuhito Kasahara <kasahara.tatsuhito@gmail.com>
Mon, 24 Jan 2022 05:36:36 +0000 (14:36 +0900)
committerKyotaro Horiguchi <horikyota.ntt@gmail.com>
Mon, 24 Jan 2022 06:00:43 +0000 (15:00 +0900)
pg_store_plans is loaded on a fresh database cluster.

WARNING:  1 temporary files and directories not closed at end-of-transaction

pgsp_shmem_startup forgot to close the temporary plan storeage file
when the main persistent storage file is missing.  It should be closed
before exiting the function.

pg_store_plans.c

index 9e35ad8..a2fd7bd 100644 (file)
@@ -688,10 +688,14 @@ pgsp_shmem_startup(void)
        file = AllocateFile(PGSP_DUMP_FILE, PG_BINARY_R);
        if (file == NULL)
        {
-               if (errno == ENOENT)
-                       return;                         /* ignore not-found error */
+               /* ignore not-found error */
+               if (errno != ENOENT)
+                       goto read_error;
+
                /* No existing persisted stats file, so we're done */
-               goto read_error;
+               if (pfile)
+                       FreeFile(pfile);
+               return;
        }
 
        buffer_size = plan_size;