On 24/11/2023 21:14, Heikki Linnakangas wrote:
What do you think?
Hello! Thank you for researching the problem! I'm more of a tester than
a developer, so I was able to check the patches from that side.
I've configured the server with CFLAGS=" -O0" and cassert enabled and
checked the following queries:
#CommitTransactionCommand
(n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT
s$i;"; done; printf "ERROR; COMMIT;") | psql >/dev/null
#ShowTransactionStateRec
(n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT
s$i;"; done; printf "SET log_min_messages = 'DEBUG5'; SAVEPOINT sp;") |
psql >/dev/null
#MemoryContextCheck
(n=1000000; printf "begin;"; for ((i=1;i<=$n;i++)); do printf "savepoint
s$i;"; done; printf "release s1;" ) | psql >/dev/null
#MemoryContextStatsInternal
(n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT
s$i;"; done; printf "SELECT
pg_log_backend_memory_contexts(pg_backend_pid())") | psql >/dev/null
On my system, every of that queries led to a server crash at a number of
savepoints in the range from 174,400 to 174,700.
With your patches applied, the savepoint counter goes well beyond these
values, I settled on an amount of approximately 300,000 savepoints.
Your patches look good to me.
Best regards,
Egor Chindyaskin
Postgres Professional: http://postgrespro.com/