postgresql/src/bin
Fujii Masao 00e64e35c8 pgbench: Fix assertion failure with multiple \syncpipeline in pipeline mode.
Previously, when pgbench ran a custom script that triggered retriable errors
(e.g., deadlocks) followed by multiple \syncpipeline commands in pipeline mode,
the following assertion failure could occur:

    Assertion failed: (res == ((void*)0)), function discardUntilSync, file pgbench.c, line 3594.

The issue was that discardUntilSync() assumed a pipeline sync result
(PGRES_PIPELINE_SYNC) would always be followed by either another sync result
or NULL. This assumption was incorrect: when multiple sync requests were sent,
a sync result could instead be followed by another result type. In such cases,
discardUntilSync() mishandled the results, leading to the assertion failure.

This commit fixes the issue by making discardUntilSync() correctly handle cases
where a pipeline sync result is followed by other result types. It now continues
discarding results until another pipeline sync followed by NULL is reached.

Backpatched to v17, where support for \syncpipeline command in pgbench was
introduced.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20251111105037.f3fc554616bc19891f926c5b@sraoss.co.jp
Backpatch-through: 17
2025-11-14 22:41:55 +09:00
..
initdb Translation updates 2025-11-10 12:58:04 +01:00
pg_amcheck Translation updates 2025-11-10 12:58:04 +01:00
pg_archivecleanup Translation updates 2025-11-10 12:58:04 +01:00
pg_basebackup Translation updates 2025-11-10 12:58:04 +01:00
pg_checksums Translation updates 2025-11-10 12:58:04 +01:00
pg_combinebackup Translation updates 2025-11-10 12:58:04 +01:00
pg_config Translation updates 2025-11-10 12:58:04 +01:00
pg_controldata Translation updates 2025-11-10 12:58:04 +01:00
pg_ctl Translation updates 2025-11-10 12:58:04 +01:00
pg_dump Translation updates 2025-11-10 12:58:04 +01:00
pg_resetwal Fix pg_upgrade around multixid and mxoff wraparound 2025-11-12 12:21:30 +02:00
pg_rewind Translation updates 2025-11-10 12:58:04 +01:00
pg_test_fsync Translation updates 2025-11-10 12:58:04 +01:00
pg_test_timing Translation updates 2025-11-10 12:58:04 +01:00
pg_upgrade Translation updates 2025-11-10 12:58:04 +01:00
pg_verifybackup Translation updates 2025-11-10 12:58:04 +01:00
pg_waldump Translation updates 2025-11-10 12:58:04 +01:00
pg_walsummary Translation updates 2025-11-10 12:58:04 +01:00
pgbench pgbench: Fix assertion failure with multiple \syncpipeline in pipeline mode. 2025-11-14 22:41:55 +09:00
pgevent Update copyright for 2025 2025-01-01 11:21:55 -05:00
psql Translation updates 2025-11-10 12:58:04 +01:00
scripts Translation updates 2025-11-10 12:58:04 +01:00
Makefile Update copyright for 2025 2025-01-01 11:21:55 -05:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00