pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: pgbench: Fail cleanly when finding a COPY result state 7+ messages / 1 participants [nested] [flat]
* pgsql: pgbench: Fail cleanly when finding a COPY result state @ 2025-10-03 05:04 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2025-10-03 05:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgbench: Fail cleanly when finding a COPY result state Currently, pgbench aborts when a COPY response is received in readCommandResponse(). However, as PQgetResult() returns an empty result when there is no asynchronous result, through getCopyResult(), the logic done at the end of readCommandResponse() for the error path leads to an infinite loop. This commit forcefully exits the COPY state with PQendcopy() before moving to the error handler when fiding a COPY state, avoiding the infinite loop. The COPY protocol is not supported by pgbench anyway, as an error is assumed in this case, so giving up is better than having the tool be stuck forever. pgbench was interruptible in this state. A TAP test is added to check that an error happens if trying to use COPY. Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com Backpatch-through: 13 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/902c08887aa183100b161ef48f1a2434af079213 Modified Files -------------- src/bin/pgbench/pgbench.c | 14 ++++++++++++++ src/bin/pgbench/t/001_pgbench_with_server.pl | 11 +++++++++++ 2 files changed, 25 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: pgbench: Fail cleanly when finding a COPY result state @ 2025-10-03 05:04 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2025-10-03 05:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgbench: Fail cleanly when finding a COPY result state Currently, pgbench aborts when a COPY response is received in readCommandResponse(). However, as PQgetResult() returns an empty result when there is no asynchronous result, through getCopyResult(), the logic done at the end of readCommandResponse() for the error path leads to an infinite loop. This commit forcefully exits the COPY state with PQendcopy() before moving to the error handler when fiding a COPY state, avoiding the infinite loop. The COPY protocol is not supported by pgbench anyway, as an error is assumed in this case, so giving up is better than having the tool be stuck forever. pgbench was interruptible in this state. A TAP test is added to check that an error happens if trying to use COPY. Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com Backpatch-through: 13 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c00637b5fdbf756d48021db82f1f9a877429e2a7 Modified Files -------------- src/bin/pgbench/pgbench.c | 14 ++++++++++++++ src/bin/pgbench/t/001_pgbench_with_server.pl | 11 +++++++++++ 2 files changed, 25 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: pgbench: Fail cleanly when finding a COPY result state @ 2025-10-03 05:04 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2025-10-03 05:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgbench: Fail cleanly when finding a COPY result state Currently, pgbench aborts when a COPY response is received in readCommandResponse(). However, as PQgetResult() returns an empty result when there is no asynchronous result, through getCopyResult(), the logic done at the end of readCommandResponse() for the error path leads to an infinite loop. This commit forcefully exits the COPY state with PQendcopy() before moving to the error handler when fiding a COPY state, avoiding the infinite loop. The COPY protocol is not supported by pgbench anyway, as an error is assumed in this case, so giving up is better than having the tool be stuck forever. pgbench was interruptible in this state. A TAP test is added to check that an error happens if trying to use COPY. Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com Backpatch-through: 13 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/de6de069d9c6b432a5dfd98b0784ed7f60a793ce Modified Files -------------- src/bin/pgbench/pgbench.c | 14 ++++++++++++++ src/bin/pgbench/t/001_pgbench_with_server.pl | 11 +++++++++++ 2 files changed, 25 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: pgbench: Fail cleanly when finding a COPY result state @ 2025-10-03 05:04 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2025-10-03 05:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgbench: Fail cleanly when finding a COPY result state Currently, pgbench aborts when a COPY response is received in readCommandResponse(). However, as PQgetResult() returns an empty result when there is no asynchronous result, through getCopyResult(), the logic done at the end of readCommandResponse() for the error path leads to an infinite loop. This commit forcefully exits the COPY state with PQendcopy() before moving to the error handler when fiding a COPY state, avoiding the infinite loop. The COPY protocol is not supported by pgbench anyway, as an error is assumed in this case, so giving up is better than having the tool be stuck forever. pgbench was interruptible in this state. A TAP test is added to check that an error happens if trying to use COPY. Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com Backpatch-through: 13 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/640590bb423823d60346f14558f93a8b3bafe1dd Modified Files -------------- src/bin/pgbench/pgbench.c | 14 ++++++++++++++ src/bin/pgbench/t/001_pgbench_with_server.pl | 10 ++++++++++ 2 files changed, 24 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: pgbench: Fail cleanly when finding a COPY result state @ 2025-10-03 05:04 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2025-10-03 05:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgbench: Fail cleanly when finding a COPY result state Currently, pgbench aborts when a COPY response is received in readCommandResponse(). However, as PQgetResult() returns an empty result when there is no asynchronous result, through getCopyResult(), the logic done at the end of readCommandResponse() for the error path leads to an infinite loop. This commit forcefully exits the COPY state with PQendcopy() before moving to the error handler when fiding a COPY state, avoiding the infinite loop. The COPY protocol is not supported by pgbench anyway, as an error is assumed in this case, so giving up is better than having the tool be stuck forever. pgbench was interruptible in this state. A TAP test is added to check that an error happens if trying to use COPY. Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com Backpatch-through: 13 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b5cefc197e5d9587de62e00519eca68cbf3d83bc Modified Files -------------- src/bin/pgbench/pgbench.c | 14 ++++++++++++++ src/bin/pgbench/t/001_pgbench_with_server.pl | 10 ++++++++++ 2 files changed, 24 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: pgbench: Fail cleanly when finding a COPY result state @ 2025-10-03 05:04 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2025-10-03 05:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgbench: Fail cleanly when finding a COPY result state Currently, pgbench aborts when a COPY response is received in readCommandResponse(). However, as PQgetResult() returns an empty result when there is no asynchronous result, through getCopyResult(), the logic done at the end of readCommandResponse() for the error path leads to an infinite loop. This commit forcefully exits the COPY state with PQendcopy() before moving to the error handler when fiding a COPY state, avoiding the infinite loop. The COPY protocol is not supported by pgbench anyway, as an error is assumed in this case, so giving up is better than having the tool be stuck forever. pgbench was interruptible in this state. A TAP test is added to check that an error happens if trying to use COPY. Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com Backpatch-through: 13 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9b3beb7c6f12597830c68ffa36abe1c23f366454 Modified Files -------------- src/bin/pgbench/pgbench.c | 14 ++++++++++++++ src/bin/pgbench/t/001_pgbench_with_server.pl | 11 +++++++++++ 2 files changed, 25 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: pgbench: Fail cleanly when finding a COPY result state @ 2025-10-03 05:04 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2025-10-03 05:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgbench: Fail cleanly when finding a COPY result state Currently, pgbench aborts when a COPY response is received in readCommandResponse(). However, as PQgetResult() returns an empty result when there is no asynchronous result, through getCopyResult(), the logic done at the end of readCommandResponse() for the error path leads to an infinite loop. This commit forcefully exits the COPY state with PQendcopy() before moving to the error handler when fiding a COPY state, avoiding the infinite loop. The COPY protocol is not supported by pgbench anyway, as an error is assumed in this case, so giving up is better than having the tool be stuck forever. pgbench was interruptible in this state. A TAP test is added to check that an error happens if trying to use COPY. Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com Backpatch-through: 13 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f1a2f3a0c4ea51d9904fd30c9c11cb474312353b Modified Files -------------- src/bin/pgbench/pgbench.c | 14 ++++++++++++++ src/bin/pgbench/t/001_pgbench_with_server.pl | 11 +++++++++++ 2 files changed, 25 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2025-10-03 05:04 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-10-03 05:04 pgsql: pgbench: Fail cleanly when finding a COPY result state Michael Paquier <michael@paquier.xyz> 2025-10-03 05:04 pgsql: pgbench: Fail cleanly when finding a COPY result state Michael Paquier <michael@paquier.xyz> 2025-10-03 05:04 pgsql: pgbench: Fail cleanly when finding a COPY result state Michael Paquier <michael@paquier.xyz> 2025-10-03 05:04 pgsql: pgbench: Fail cleanly when finding a COPY result state Michael Paquier <michael@paquier.xyz> 2025-10-03 05:04 pgsql: pgbench: Fail cleanly when finding a COPY result state Michael Paquier <michael@paquier.xyz> 2025-10-03 05:04 pgsql: pgbench: Fail cleanly when finding a COPY result state Michael Paquier <michael@paquier.xyz> 2025-10-03 05:04 pgsql: pgbench: Fail cleanly when finding a COPY result state Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox