Exists with mutations execute on initator#97347
Conversation
|
Workflow [PR], commit [e168e9e] Summary: ❌
|
|
This bug can also crash the server in some cases such as the following: https://fiddle.clickhouse.com/99e7405f-a80c-48b3-919e-b514f2a86ec9 |
| ALTER TABLE t_mutations_nondeterministic | ||
| (UPDATE v = exists(( | ||
| SELECT count() | ||
| FROM system.numbers | ||
| WHERE number < 25 | ||
| )) WHERE 1); |
There was a problem hiding this comment.
strange thing is that I'm getting "Unknown function exists" in the fiddle:
https://fiddle.clickhouse.com/1178e949-a3ae-43e8-ae0c-181e57014589
maybe it's a manifestation of this bug in release build?
There was a problem hiding this comment.
Good question, I suppose something changed which made us skip the bug. I don't know what exactly though. But with the fix it should work normally, since it is a perfectly valid query, right?
There was a problem hiding this comment.
well, test is passing in CI and I downloaded both debug and release and it definitely works... but still strange...
this is a stacktrace from current head:
https://pastila.clickhouse.com/?0079b799/083dd9d85a2482d60a23bbbba7b2958c#hkwvO75/IPLUivGwi2T+5Q==GCM
I see you test it on 25.6 and it doesn't reproduce since 25.7 - was there some fix addressing this issue? |
|
@yakov-olkhovskiy I am not sure what made the server not to crash in the later versions, but in the latest version, we can still notice an erroneous behavior with these types of queries: To see this behavior we have to run the test first, and then restart the server, connect with the client again, and the error should be shown automatically. It should also be shown if you try to |
|
Also, in debug build the server should still crash AFAIK |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The problem appears when we set a setting:
And run an
ALTERquery with a functionexistswith a scalar subquery inside. This causes the scalar subquery inexsitsbeing evaluated to a number. Then, after the mutation is applied, we get either an error, or we getOKwith mutation stored with a corrupt command, which makes table unloadable on the next server restart. The response of the server depends of the query. Test in the pull request shows two queries, that cause different errors, but a rooted in the same problem.AST fuzzer report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96790&sha=cbdee8ffcd02bf966e588b7d06f2e39718da5486&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29
Continuation of #96985