Re: pgbench error: (setshell) of script 0; execution of meta-command failed
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>, Andy Fan <zhihuifan1213@163.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-01-13T16:04:31Z
Lists: pgsql-hackers
Attachments
- v1-0001-modify-pqsignal.patch (text/plain)
On Sat, Jan 11, 2025 at 02:04:13PM -0500, Tom Lane wrote: > After studying this more, I think what we should do in HEAD is > even more aggressive: let's make the real name of port/pqsignal.c's > function be either pqsignal_fe in frontend, or pqsignal_be in backend. > This positively ensures that there's no collision with libpq's > export, and it seems like a good idea for the additional reason that > the frontend and backend versions are not really interchangeable. That would be nice. > However, we can't get away with that in released branches because > it'd be an ABI break for any outside code that calls pqsignal. > What I propose doing in the released branches is what's shown in > the attached patch for v17: rename port/pqsignal.c's function to > pqsignal_fe in frontend, but leave it as pqsignal in the backend. > Leaving it as pqsignal in the backend preserves ABI for extension > modules, at the cost that it's not entirely clear which pqsignal > an extension that's also linked with libpq will get. But that > hazard affects none of our code, and it existed already for any > third-party extensions that call pqsignal. In principle using > "pqsignal_fe" in frontend creates an ABI hazard for outside users of > libpgport.a. But I think it's not really a problem, because we don't > support that as a shared library. As long as people build with > headers and .a files from the same minor release, they'll be OK. I don't have any concrete reasons to think you are wrong about this, but it does feel somewhat risky to me. It might be worth testing it with a couple of third-party projects that use the frontend version of pqsignal(). codesearch.debian.net shows a couple that may be doing so [0] [1] [2]. > BTW, this decouples legacy-pqsignal.c from pqsignal.c enough > that we could now do what's contemplated in the comments from > 3b00fdba9: simplify that version by making it return void, > or perhaps better just a true/false success report. > I've not touched that point here, though. I think it should just return void since AFAICT nobody checks the return value. But it would probably be a good idea to add some sort of error checking within the function. I've attached a draft patch that adds some new assertions. I originally tried to use elog() where it was available, but besides making the code even more unreadable, I think it's unnecessary (since AFAICT any problems are likely coding errors). [0] https://github.com/gleu/pgstats [1] https://github.com/hapostgres/pg_auto_failover [2] https://github.com/credativ/pg_checksums -- nathan
Commits
-
Avoid symbol collisions between pqsignal.c and legacy-pqsignal.c.
- cfd7aadebea1 13.19 landed
- b935691b8b2f 16.7 landed
- a3b709cf73e0 15.11 landed
- a0dfeae0dc9a 17.3 landed
- 9a45a89c38f3 18.0 landed
- 02e69313ad0c 14.16 landed
-
Suppress macOS warnings about duplicate libraries in link commands.
- 06843df4abc5 17.0 cited