-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#25773] YSQL: fix INSERT ON CONFLICT batching with SPI
Summary: INSERT ON CONFLICT batching was introduced by commit a000dbb. Since then, commit a120c25 allowed batching for INSERT ON CONFLICT with RETURNING clause. That breaks cases where the INSERT ON CONFLICT query is sent using SPI_execute_with_args with a positive tcount. That tcount can cause ExecutePlan to stop calling the insert's ExecModifyTable partway and then go to ExecEndModifyTable. In that case, ExecEndModifyTable is called with a partially processed insert on conflict state, which is unexpected. Modify expectations to allow this and free up such state. I could not find a way to get ExecutePlan to be called with numberTuples > 0 besides via SPI_execute_with_args, so for testing, create a C function yb_run_spi in regress.c that calls SPI_execute_with_args on the given query and returns the number of rows returned. As part of this, add checks to make sure that slots are dropped before clearing them from the C++ maps. Jira: DB-15059 Test Plan: On Almalinux 8: #!/usr/bin/env bash set -euo pipefail ./yb_build.sh fastdebug --gcc11 find java/yb-pgsql/src/test/java/org/yb/pgsql -name 'TestPgRegressInsertOnConflict*' \ | grep -oE 'TestPgRegress\w+' \ | while read -r testname; do ./yb_build.sh fastdebug --gcc11 --java-test "$testname" --sj done Close: #25773 Reviewers: kramanathan Reviewed By: kramanathan Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D41471
- Loading branch information
Showing
14 changed files
with
1,177 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.