Repository navigation
Do not append stdin to INSERT ... FROM INFILE - #126564
Conversation
`ClientBase::sendData` appended the data piped to stdin after the `INFILE` data, and checking stdin waited for an open pipe to close. `clickhouse-client` does this on purpose (`02270_stdin_with_query_or_infile_data`); `clickhouse-local` now reads only the file and does not check stdin at all for such a query. Closes: ClickHouse#125137
alexey-milovidov
left a comment
There was a problem hiding this comment.
I think we should never append stdin to INFILE.
As suggested in review: `FROM INFILE` names the data source, so neither `clickhouse-client` nor `clickhouse-local` reads stdin for it, and stdin is not checked at all, so an open pipe cannot block the query. Remove `ClientBase::appendsStdinToInfileData`; `02270_stdin_with_query_or_infile_data` now expects only the file's row.
|
Done in 8afb409: |
|
🕵 Checked 8afb409: it addresses the review ( |
|
🕵 Merged current master (9a348d8) into the branch; it merged without conflicts. |
|
Workflow [PR], commit [1b526c1] Summary: ✅
AI ReviewSummary
Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units41 translation units recompiled, 54 s compile time in total, 7 of them have a recent master baseline. |
Closes: #125137
Related: #36254
INSERT ... FROM INFILEinserted the file and then everything piped to stdin, and when stdin was a pipe that stayed open, the query waited for it to close. Both come fromClientBase::sendData: it checksisStdinNotEmptyAndValid(which blocks until data or EOF arrives) and sends stdin after theINFILEdata.As suggested in review,
FROM INFILEnow never reads stdin, in bothclickhouse-clientandclickhouse-local: the file names the data source. For anINFILEinsert, stdin is not checked at all, so an open pipe cannot block it. Inserts with inline data or from stdin are unchanged. This reverts the stdin-after-INFILEpart of #36254 forclickhouse-client.02270_stdin_with_query_or_infile_datachecked the old client behaviour (echo "(42)" | clickhouse-client -q "INSERT ... FROM INFILE ..."inserted both rows); it now expects only the file's row.05409_local_infile_ignores_stdincovers the three forms from the issue inclickhouse-local(several queries, a singleINSERT INTO FUNCTION file(...) FROM INFILE, and--queries-file) with data on stdin, and a stdin pipe that stays open for a minute undertimeout 30. On the current master build the first three insert the stdin row too and the last one exits with 124.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
INSERT ... FROM INFILEinclickhouse-clientandclickhouse-localinserts only the data from the file and no longer also inserts the data piped to stdin. This also fixes the query waiting for an open stdin pipe to close.Workflow [PR]
Sync PR [sync-upstream/pr/126564]
Version info
26.11.1.972-master(included in26.11and later)