s_lock_test no longer works

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: s_lock_test no longer works
Date: 2024-01-24 11:14:17
Message-ID: 202401241114.ied53jcich72@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just discovered that doing "make -C src/backend/storage/lmgr check" no
longer works, because commit 92daeca45df6 ("Add wait event for
pg_usleep() in perform_spin_delay()") added a requirement for
my_wait_event_info to be present at link time:

$ LC_ALL=C make -C src/backend/storage/lmgr/ s_lock_test
make: Entering directory '/home/alvherre/Code/pgsql-build/master/src/backend/storage/lmgr'
gcc -I. -I../../../../src/include -I/pgsql/source/master/src/include -D_GNU_SOURCE -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -DS_LOCK_TEST=1 /pgsql/source/master/src/backend/storage/lmgr/s_lock.c \
-L ../../../../src/common -lpgcommon \
-L ../../../../src/port -lpgport -lm -o s_lock_test
/usr/bin/ld: /run/user/1000/alvherre-tmp/ccMaAvVj.o: warning: relocation against `my_wait_event_info' in read-only section `.text'
/usr/bin/ld: /run/user/1000/alvherre-tmp/ccMaAvVj.o: in function `pgstat_report_wait_start':
/pgsql/source/master/src/include/utils/wait_event.h:94: undefined reference to `my_wait_event_info'
/usr/bin/ld: /run/user/1000/alvherre-tmp/ccMaAvVj.o: in function `pgstat_report_wait_end':
/pgsql/source/master/src/include/utils/wait_event.h:107: undefined reference to `my_wait_event_info'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [Makefile:35: s_lock_test] Error 1
make: Leaving directory '/home/alvherre/Code/pgsql-build/master/src/backend/storage/lmgr'

This is after I added -lm, to fix these other problems:

/home/alvherre/Code/pgsql-build/master/src/common/../../../../../../../pgsql/source/master/src/common/pg_prng.c:269: undefined reference to `log'
/usr/bin/ld: /home/alvherre/Code/pgsql-build/master/src/common/../../../../../../../pgsql/source/master/src/common/pg_prng.c:269: undefined reference to `sin'
/usr/bin/ld: /home/alvherre/Code/pgsql-build/master/src/common/../../../../../../../pgsql/source/master/src/common/pg_prng.c:269: undefined reference to `sqrt'

On my machine, it's enough to patch s_lock_test.c to have a local definition
for the missing symbol. Since the file already has a test mode, it
turns out to be quite simple -- attached.

I do wonder if we want to keep this around, given that it's been more
than one year broken and nobody seems to have noticed, and the Meson
build does not support the test as a target.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
Are you not unsure you want to delete Firefox?
[Not unsure] [Not not unsure] [Cancel]
http://smylers.hates-software.com/2008/01/03/566e45b2.html

Attachment Content-Type Size
0001-fix-s_lock_test-compile.patch text/x-diff 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2024-01-24 11:29:07 Re: Network failure may prevent promotion
Previous Message shveta malik 2024-01-24 10:39:15 Re: Synchronizing slots from primary to standby