From: | Robins Tharakan <tharakan(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | autoprewarm worker failing to load |
Date: | 2022-07-27 14:48:52 |
Message-ID: | CAEP4nAzndnQv3-1QKb=D-hLoK3Rko12HHMFHHtdj2GQAUXO3gw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
089480c077056 seems to have broken pg_prewarm. When pg_prewarm
is added to shared_preload_libraries, each new connection results in
thousands of errors such as this:
2022-07-27 04:25:14.325 UTC [2903955] LOG: background worker
"autoprewarm leader" (PID 2904146) exited with exit code 1
2022-07-27 04:25:14.325 UTC [2904148] ERROR: could not find function
"autoprewarm_main" in file
"/home/ubuntu/proj/tempdel/lib/postgresql/pg_prewarm.so"
Checking pg_prewarm.so the function 'autoprewarm_main' visibility
switched from GLOBAL to LOCAL. Per [1], using PGDLLEXPORT
makes it GLOBAL again, which appears to fix the issue:
Before commit (089480c077056) -
ubuntu:~/proj/tempdel$ readelf -sW lib/postgresql/pg_prewarm.so | grep main
103: 0000000000003d79 609 FUNC GLOBAL DEFAULT 14 autoprewarm_main
109: 00000000000045ad 873 FUNC GLOBAL DEFAULT 14 autoprewarm_database_main
128: 0000000000003d79 609 FUNC GLOBAL DEFAULT 14 autoprewarm_main
187: 00000000000045ad 873 FUNC GLOBAL DEFAULT 14 autoprewarm_database_main
After commit (089480c077056) -
78: 0000000000002d79 609 FUNC LOCAL DEFAULT 14 autoprewarm_main
85: 00000000000035ad 873 FUNC LOCAL DEFAULT 14 autoprewarm_database_main
After applying the attached fix:
103: 0000000000003d79 609 FUNC GLOBAL DEFAULT 14 autoprewarm_main
84: 00000000000045ad 873 FUNC LOCAL DEFAULT 14 autoprewarm_database_main
129: 0000000000003d79 609 FUNC GLOBAL DEFAULT 14 autoprewarm_main
Please let me know your thoughts on this approach.
diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index b2d6026093..ec619be9f2 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -82,7 +82,7 @@ typedef struct AutoPrewarmSharedState
int prewarmed_blocks;
} AutoPrewarmSharedState;
-void autoprewarm_main(Datum main_arg);
+PGDLLEXPORT void autoprewarm_main(Datum main_arg);
void autoprewarm_database_main(Datum main_arg);
PG_FUNCTION_INFO_V1(autoprewarm_start_worker);
-
Robins Tharakan
Amazon Web Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-07-27 14:58:44 | Re: fairywren hung in pg_basebackup tests |
Previous Message | Andrew Dunstan | 2022-07-27 14:32:29 | Re: fairywren hung in pg_basebackup tests |