Hi, > The current problem is that a race condition may occur on some systems, when > oidjoins test starts a moment later than normally and affects logins count > for on-login trigger test. The problem is quite a rare one and I only faced > it once. But rare or not - the problem is a problem and it should be > addressed.
Thanks for the patch and the steps to reproduce. I tested the patch and it does what is claimed. Including the steps to reproduce as a separate patch with .txt extension so cfbot will ignore it. I think it's a good find and a good fix. -- Best regards, Aleksander Alekseev
commit 80df7cf26476a3ede42310354715e972fa40a8cf Author: Aleksander Alekseev <aleksan...@timescale.com> Date: Thu Oct 19 16:30:27 2023 +0300 reproduce diff --git a/src/test/regress/expected/event_trigger.out b/src/test/regress/expected/event_trigger.out index eaaff6ba6f..741099747c 100644 --- a/src/test/regress/expected/event_trigger.out +++ b/src/test/regress/expected/event_trigger.out @@ -648,6 +648,13 @@ BEGIN END; $$ LANGUAGE plpgsql; CREATE EVENT TRIGGER on_login_trigger ON login EXECUTE PROCEDURE on_login_proc(); +-- AALEKSEEV DEBUG +select pg_sleep(5); + pg_sleep +---------- + +(1 row) + ALTER EVENT TRIGGER on_login_trigger ENABLE ALWAYS; \c NOTICE: You are welcome! diff --git a/src/test/regress/expected/oidjoins.out b/src/test/regress/expected/oidjoins.out index 215eb899be..01f4959f21 100644 --- a/src/test/regress/expected/oidjoins.out +++ b/src/test/regress/expected/oidjoins.out @@ -1,3 +1,11 @@ +-- AALEKSEEV DEBUG +select pg_sleep(2); + pg_sleep +---------- + +(1 row) + +\c -- -- Verify system catalog foreign key relationships -- diff --git a/src/test/regress/sql/event_trigger.sql b/src/test/regress/sql/event_trigger.sql index 9c2b7903fb..84b0b7fac8 100644 --- a/src/test/regress/sql/event_trigger.sql +++ b/src/test/regress/sql/event_trigger.sql @@ -506,6 +506,10 @@ BEGIN END; $$ LANGUAGE plpgsql; CREATE EVENT TRIGGER on_login_trigger ON login EXECUTE PROCEDURE on_login_proc(); + +-- AALEKSEEV DEBUG +select pg_sleep(5); + ALTER EVENT TRIGGER on_login_trigger ENABLE ALWAYS; \c SELECT COUNT(*) FROM user_logins; diff --git a/src/test/regress/sql/oidjoins.sql b/src/test/regress/sql/oidjoins.sql index 8b22e6d10c..576d5f03a9 100644 --- a/src/test/regress/sql/oidjoins.sql +++ b/src/test/regress/sql/oidjoins.sql @@ -1,3 +1,7 @@ +-- AALEKSEEV DEBUG +select pg_sleep(2); +\c + -- -- Verify system catalog foreign key relationships --