Draft
Conversation
|
This PR has a migration; here is the generated SQL for -- start migrations
-- forward migration events_analytics_platform : 0054_fix_bools_in_autocomplete
Local op: ALTER TABLE eap_item_co_occurring_attrs_1_local ON CLUSTER 'cluster_one_sh' MODIFY COLUMN key_hash UInt64 DEFAULT cityHash64(arraySort(arrayConcat(attributes_string, attributes_float, attributes_bool)));
-- end forward migration events_analytics_platform : 0054_fix_bools_in_autocomplete
-- backward migration events_analytics_platform : 0054_fix_bools_in_autocomplete
Local op: ALTER TABLE eap_item_co_occurring_attrs_1_local ON CLUSTER 'cluster_one_sh' MODIFY COLUMN key_hash UInt64 MATERIALIZED cityHash64(arraySort(arrayConcat(attributes_string, attributes_float)));
-- end backward migration events_analytics_platform : 0054_fix_bools_in_autocomplete |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is actually accomplishing what #7642 set out to do but failed. No AI was used in writing this PR because migrations are very delicate, as this incident shows.
What happened
#7642 set created a new materialized view to populate
attributes_bool. Alongside it, thekey_hashfield in the materialized view was updated to reflect this. The problem is that this key_hash field was never populated from this materialized view. It was actually populated from the materialized column on the table.It turns out that using a materialized column in a materialized view does absolutely nothing. I updated the view statement to look like this:
and it broke inserts! Turns out:
How this fixes it
This PR does the following:
How I tested it
This SQL statement on master reproduces the problem:
Note that each inserted row has the same string and float attributes and different boolean attributes. After this insert, run this query:
Switching to this branch, the same insert statement yields the following table:
Impacts
Even though this table has had the
attribute_boolcolumn, differingattribute_boolcolumn values would have been merged away because of this mistake. This means we have to wait another 30 days before we can stop double writing.