Fix crash when using ReplicatedCollapsingMergeTree with async_insert and async_insert_deduplicate #51701
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed a crash when using a combination of ReplicatedCollapsingMergeTree, async_insert, and async_insert_deduplicate. On older versions, use
optimize_on_insert=0
as a workaround.Basically
optimize_on_insert
andasync_insert_deduplicate
are incompatible. This PR makes the latter implicitly disable the former, in a not particularly elegant way.optimize_on_insert
code was mutating a block, thenasync_insert_deduplicate
code expected the block to not have been mutated (for filtering subranges of rows within the block that correspond to original INSERT queries).Part of the stack trace (to make this searchable):
(For a quick manual repro, copy-paste this megabyte of text into
clickhouse client -nm
: https://pastila.nl/?1aa66bad/d77374fa44563912bdde9fc10c1076d0 )