Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove strange code from MutateTask #48666

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

alesapin
Copy link
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

cc @amosbird

@robot-ch-test-poll robot-ch-test-poll added the pr-not-for-changelog This PR should not be mentioned in the changelog label Apr 11, 2023
@alesapin
Copy link
Member Author

Test failure reported #48688

@alesapin alesapin merged commit 55c3f1e into master Apr 12, 2023
137 checks passed
@alesapin alesapin deleted the remove_strange_code_from_mutation_task branch April 12, 2023 10:38
azat added a commit to azat/ClickHouse that referenced this pull request Aug 9, 2023
In ClickHouse#20202 DROP COLUMN had been made no-op, i.e. it simply hardlinked
everything and no columns had been removed. In most of the cases this is
OK, however Vertical merge may inject another column instead of current
if it does not exists
(injectRequiredColumns(LoadedMergeTreeDataPartInfoForReader{}) in
MergeTreeSequentialSource ctor), and it may select this already removed
column and it will fail with an error:

    DB::Exception: There is no column legacy_features_Map.count in table. (NO_SUCH_COLUMN_IN_TABLE), Stack trace (when copying this message, always include the lines below):
    0. src/Common/Exception.cpp:91: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0xe0c67d5 in /usr/lib/debug/usr/bin/clickhouse.debug
    2. src/Storages/StorageSnapshot.cpp:111: DB::StorageSnapshot::getColumn(DB::GetColumnsOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const @ 0x13ff1cb3 in /usr/lib/debug/usr/bin/clickhouse.debug
    3. contrib/llvm-project/libcxx/include/new:246: DB::StorageSnapshot::getColumnsByNames(DB::GetColumnsOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) const @ 0x13ff19f1 in /usr/lib/debug/usr/bin/clickhouse.debug
    4. src/Storages/MergeTree/MergeTreeSequentialSource.cpp:0: DB::MergeTreeSequentialSource::MergeTreeSequentialSource(DB::MergeTreeData const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, std::__1::optional<DB::MarkRanges>, bool, bool, bool, bool) @ 0x143d108c in /usr/lib/debug/usr/bin/clickhouse.debug
    5. contrib/llvm-project/libcxx/include/__memory/construct_at.h:35: DB::createMergeTreeSequentialSource(DB::MergeTreeData const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, bool, bool, bool, std::__1::shared_ptr<std::__1::atomic<unsigned long>>) @ 0x143d25ee in /usr/lib/debug/usr/bin/clickhouse.debug
    6. contrib/llvm-project/libcxx/include/vector:434: DB::MergeTask::VerticalMergeStage::prepareVerticalMergeForOneColumn() const @ 0x1422c525 in /usr/lib/debug/usr/bin/clickhouse.debug

Such merges can be distinguished with the following message in logs:

    Part X doesn't change up to mutation version Y (optimized)
                                                   ^^^^^^^^^^^

Funny that this has been accidentally fixed in the PR with the title
"Remove strange code from MutateTask" (ClickHouse#48666)

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
azat added a commit to azat/ClickHouse that referenced this pull request Aug 17, 2023
In ClickHouse#20202 DROP COLUMN had been made no-op, i.e. it simply hardlinked
everything and no columns had been removed. In most of the cases this is
OK, however Vertical merge may inject another column instead of current
if it does not exists
(injectRequiredColumns(LoadedMergeTreeDataPartInfoForReader{}) in
MergeTreeSequentialSource ctor), and it may select this already removed
column and it will fail with an error:

    DB::Exception: There is no column legacy_features_Map.count in table. (NO_SUCH_COLUMN_IN_TABLE), Stack trace (when copying this message, always include the lines below):
    0. src/Common/Exception.cpp:91: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0xe0c67d5 in /usr/lib/debug/usr/bin/clickhouse.debug
    2. src/Storages/StorageSnapshot.cpp:111: DB::StorageSnapshot::getColumn(DB::GetColumnsOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const @ 0x13ff1cb3 in /usr/lib/debug/usr/bin/clickhouse.debug
    3. contrib/llvm-project/libcxx/include/new:246: DB::StorageSnapshot::getColumnsByNames(DB::GetColumnsOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) const @ 0x13ff19f1 in /usr/lib/debug/usr/bin/clickhouse.debug
    4. src/Storages/MergeTree/MergeTreeSequentialSource.cpp:0: DB::MergeTreeSequentialSource::MergeTreeSequentialSource(DB::MergeTreeData const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, std::__1::optional<DB::MarkRanges>, bool, bool, bool, bool) @ 0x143d108c in /usr/lib/debug/usr/bin/clickhouse.debug
    5. contrib/llvm-project/libcxx/include/__memory/construct_at.h:35: DB::createMergeTreeSequentialSource(DB::MergeTreeData const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, bool, bool, bool, std::__1::shared_ptr<std::__1::atomic<unsigned long>>) @ 0x143d25ee in /usr/lib/debug/usr/bin/clickhouse.debug
    6. contrib/llvm-project/libcxx/include/vector:434: DB::MergeTask::VerticalMergeStage::prepareVerticalMergeForOneColumn() const @ 0x1422c525 in /usr/lib/debug/usr/bin/clickhouse.debug

Such merges can be distinguished with the following message in logs:

    Part X doesn't change up to mutation version Y (optimized)
                                                   ^^^^^^^^^^^

Funny that this has been accidentally fixed in the PR with the title
"Remove strange code from MutateTask" (ClickHouse#48666)

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
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.

None yet

2 participants