Skip to content

Do not fuzz queries with implicit transactions#97861

Closed
antaljanosbenjamin wants to merge 3 commits intomasterfrom
do-not-fuzz-queries-with-implicit-transactions
Closed

Do not fuzz queries with implicit transactions#97861
antaljanosbenjamin wants to merge 3 commits intomasterfrom
do-not-fuzz-queries-with-implicit-transactions

Conversation

@antaljanosbenjamin
Copy link
Copy Markdown
Member

@antaljanosbenjamin antaljanosbenjamin commented Feb 24, 2026

#97568 introduced server side fuzzing, but it is broken with implicit transactions.

Implicit transactions cause issues with fuzzing because we copy the query context which can contain an already committed transaction. Because of the different assertions in setCurrentTransaction, initCurrentTransaction and MergeTreeTransactionHolder, it is not trivial how to start a new transaction in the same session context for a new query, thus let's just not fuzz queries with implicit transactions.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a [user-readable short description]

Do not use server side query fuzzer with implicit transactions because it violates the logic around transactions.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@antaljanosbenjamin antaljanosbenjamin marked this pull request as ready for review February 24, 2026 13:50
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Feb 24, 2026

Workflow [PR], commit [bcebafb]

Summary:

job_name test_name status info comment
Stateless tests (amd_binary, old analyzer, s3 storage, DatabaseReplicated, parallel) failure
03988_implicit_transactions_with_fuzzing FAIL cidb
Stateless tests (amd_tsan, s3 storage, parallel, 2/2) failure
03988_implicit_transactions_with_fuzzing FAIL cidb
BuzzHouse (amd_ubsan) failure
Logical error: A B is not allowed in expression context. In scope C (STID: 3968-4ade) FAIL cidb

@clickhouse-gh clickhouse-gh bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Feb 24, 2026
@antaljanosbenjamin antaljanosbenjamin mentioned this pull request Feb 24, 2026
1 task
@pamarcos pamarcos self-requested a review February 24, 2026 14:19
@pamarcos pamarcos self-assigned this Feb 24, 2026
@pamarcos
Copy link
Copy Markdown
Member

but it is broken with implicit transactions

@antaljanosbenjamin care to elaborate or provide a proof to understand why it's broken with implicit transactions?

Comment on lines +2116 to +2119
// Implicit transactions cause issues with fuzzing because we copy the query context which can contain an already
// committed transaction. Because of the different assertions in setCurrentTransaction, initCurrentTransaction and
// MergeTreeTransactionHolder, it is not trivial how to start a new transaction in the same session context for a
// new query, thus let's just not fuzz queries with implicit transactions.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. The explanation is here. I think this comment should use /// as per the coding style. Also, this same explanation could have been added to the commit message itself, and definitely should have been added to the description (and IMHO also in the changelog)

@antaljanosbenjamin
Copy link
Copy Markdown
Member Author

Maybe #97835 is better

@alexey-milovidov
Copy link
Copy Markdown
Member

Interesting - if we disable transactions and clean up the copied context from the in-progress transaction, will it be better?

@antaljanosbenjamin
Copy link
Copy Markdown
Member Author

I am not sure how to make that work. I am not sure if having different transactions in session and query context is okay or not. Second, to make it work properly, we have to use MergeTreeTransactionHolder which can be used only with session context as far as I understood. I opted to disable it, because it is an experimental feature. Azat's PR might make it work though.

Copy link
Copy Markdown
Member

@azat azat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this one first to fix CI, I will finish mine later (need to solve leaking of transaction from session context)

@azat
Copy link
Copy Markdown
Member

azat commented Feb 24, 2026

Although last version should work

@antaljanosbenjamin
Copy link
Copy Markdown
Member Author

Mine failed the tests, your passed. Will close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants