pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
8+ messages / 1 participants
[nested] [flat]

* pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
@ 2025-09-26 12:25  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-09-26 12:25 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pgbench: Fix assertion failure with retriable errors in pipeline mode.

When running pgbench with --verbose-errors option and a custom script that
triggered retriable errors (e.g., serialization errors) in pipeline mode,
an assertion failure could occur:

    Assertion failed: (sql_script[st->use_file].commands[st->command]->type == 1), function commandError, file pgbench.c, line 3062.

The failure happened because pgbench assumed these errors would only occur
during SQL commands, but in pipeline mode they can also happen during
\endpipeline meta command.

This commit fixes the assertion failure by adjusting the assertion check to
allow such errors during either SQL commands or \endpipeline.

Backpatch to v15, where the assertion check was introduced.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGWQMOzNkQs-LmpDHdNC0h8dmAuUMRvZrEntQi5a-b=Kg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8bb174295e8920fe202e2fb4c8d271e4546b9e98

Modified Files
--------------
src/bin/pgbench/pgbench.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
@ 2025-09-26 12:26  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-09-26 12:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pgbench: Fix assertion failure with retriable errors in pipeline mode.

When running pgbench with --verbose-errors option and a custom script that
triggered retriable errors (e.g., serialization errors) in pipeline mode,
an assertion failure could occur:

    Assertion failed: (sql_script[st->use_file].commands[st->command]->type == 1), function commandError, file pgbench.c, line 3062.

The failure happened because pgbench assumed these errors would only occur
during SQL commands, but in pipeline mode they can also happen during
\endpipeline meta command.

This commit fixes the assertion failure by adjusting the assertion check to
allow such errors during either SQL commands or \endpipeline.

Backpatch to v15, where the assertion check was introduced.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGWQMOzNkQs-LmpDHdNC0h8dmAuUMRvZrEntQi5a-b=Kg@mail.gmail.com

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c736808e03b77052f2e08f43210ba64517ff64d6

Modified Files
--------------
src/bin/pgbench/pgbench.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
@ 2025-09-26 12:26  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-09-26 12:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pgbench: Fix assertion failure with retriable errors in pipeline mode.

When running pgbench with --verbose-errors option and a custom script that
triggered retriable errors (e.g., serialization errors) in pipeline mode,
an assertion failure could occur:

    Assertion failed: (sql_script[st->use_file].commands[st->command]->type == 1), function commandError, file pgbench.c, line 3062.

The failure happened because pgbench assumed these errors would only occur
during SQL commands, but in pipeline mode they can also happen during
\endpipeline meta command.

This commit fixes the assertion failure by adjusting the assertion check to
allow such errors during either SQL commands or \endpipeline.

Backpatch to v15, where the assertion check was introduced.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGWQMOzNkQs-LmpDHdNC0h8dmAuUMRvZrEntQi5a-b=Kg@mail.gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f39d9164b70a8ead8e1b6847f067532b784bbf0e

Modified Files
--------------
src/bin/pgbench/pgbench.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
@ 2025-09-26 12:26  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-09-26 12:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pgbench: Fix assertion failure with retriable errors in pipeline mode.

When running pgbench with --verbose-errors option and a custom script that
triggered retriable errors (e.g., serialization errors) in pipeline mode,
an assertion failure could occur:

    Assertion failed: (sql_script[st->use_file].commands[st->command]->type == 1), function commandError, file pgbench.c, line 3062.

The failure happened because pgbench assumed these errors would only occur
during SQL commands, but in pipeline mode they can also happen during
\endpipeline meta command.

This commit fixes the assertion failure by adjusting the assertion check to
allow such errors during either SQL commands or \endpipeline.

Backpatch to v15, where the assertion check was introduced.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGWQMOzNkQs-LmpDHdNC0h8dmAuUMRvZrEntQi5a-b=Kg@mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8b2e290bde21767373df9eef4b14bba282df8bdb

Modified Files
--------------
src/bin/pgbench/pgbench.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
@ 2025-09-26 12:26  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-09-26 12:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pgbench: Fix assertion failure with retriable errors in pipeline mode.

When running pgbench with --verbose-errors option and a custom script that
triggered retriable errors (e.g., serialization errors) in pipeline mode,
an assertion failure could occur:

    Assertion failed: (sql_script[st->use_file].commands[st->command]->type == 1), function commandError, file pgbench.c, line 3062.

The failure happened because pgbench assumed these errors would only occur
during SQL commands, but in pipeline mode they can also happen during
\endpipeline meta command.

This commit fixes the assertion failure by adjusting the assertion check to
allow such errors during either SQL commands or \endpipeline.

Backpatch to v15, where the assertion check was introduced.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGWQMOzNkQs-LmpDHdNC0h8dmAuUMRvZrEntQi5a-b=Kg@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/704f517711b4330805571d65f49489a16bba27cb

Modified Files
--------------
src/bin/pgbench/pgbench.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: pgbench: Fix assertion failure with multiple \syncpipeline in pi
@ 2025-11-14 13:42  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-11-14 13:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4aa0ac05765edf6b5f0c13e18ac677287ce78206

Modified Files
--------------
src/bin/pgbench/pgbench.c | 39 ++++++++++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: pgbench: Fix assertion failure with multiple \syncpipeline in pi
@ 2025-11-14 13:43  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-11-14 13:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/00e64e35c8bd4e5a92b76feeb7f31defd7d08bd7

Modified Files
--------------
src/bin/pgbench/pgbench.c | 39 ++++++++++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: pgbench: Fix assertion failure with multiple \syncpipeline in pi
@ 2025-11-14 13:43  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2025-11-14 13:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5bc251b288392fc432b6174c2a6e6a040fe1698e

Modified Files
--------------
src/bin/pgbench/pgbench.c | 39 ++++++++++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2025-11-14 13:43 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-09-26 12:25 pgsql: pgbench: Fix assertion failure with retriable errors in pipeline Fujii Masao <fujii@postgresql.org>
2025-09-26 12:26 pgsql: pgbench: Fix assertion failure with retriable errors in pipeline Fujii Masao <fujii@postgresql.org>
2025-09-26 12:26 pgsql: pgbench: Fix assertion failure with retriable errors in pipeline Fujii Masao <fujii@postgresql.org>
2025-09-26 12:26 pgsql: pgbench: Fix assertion failure with retriable errors in pipeline Fujii Masao <fujii@postgresql.org>
2025-09-26 12:26 pgsql: pgbench: Fix assertion failure with retriable errors in pipeline Fujii Masao <fujii@postgresql.org>
2025-11-14 13:42 pgsql: pgbench: Fix assertion failure with multiple \syncpipeline in pi Fujii Masao <fujii@postgresql.org>
2025-11-14 13:43 pgsql: pgbench: Fix assertion failure with multiple \syncpipeline in pi Fujii Masao <fujii@postgresql.org>
2025-11-14 13:43 pgsql: pgbench: Fix assertion failure with multiple \syncpipeline in pi Fujii Masao <fujii@postgresql.org>

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