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

ALTER to LowCardinality was leading to segfault on empty parts #7985

Merged
merged 2 commits into from
Dec 2, 2019

Conversation

filimonov
Copy link
Contributor

@filimonov filimonov commented Dec 2, 2019

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Non-significant (changelog entry is not needed)

Detailed description (optional):
When empty part was altered to LowCardinality segmentation fault was happening with a stack trace like that:

2019.11.15 12:11:14.565554 [ 392 ] {} <Error> BaseDaemon: ########################################
2019.11.15 12:11:14.565607 [ 392 ] {} <Error> BaseDaemon: (version 19.11.12.69 (official build)) (from thread 41) Received signal Segmentation fault (11).
2019.11.15 12:11:14.565639 [ 392 ] {} <Error> BaseDaemon: Address: NULL pointer. Access: read. Address not mapped to object.
2019.11.15 12:11:14.606264 [ 392 ] {} <Error> BaseDaemon: 0. /usr/bin/clickhouse-server(StackTrace::StackTrace(ucontext_t const&)+0x31) [0x7dcc1f1]
1. /usr/bin/clickhouse-server() [0x3d15f3e]
2. /lib64/libpthread.so.0(+0xf5d0) [0x7f2109a805d0]
3. /usr/bin/clickhouse-server() [0x6bb8bf3]
4. /usr/bin/clickhouse-server(DB::DataTypeLowCardinality::serializeBinaryBulkStateSuffix(DB::IDataType::SerializeBinaryBulkSettings&, std::shared_ptr<DB::IDataType::Seria
5. /usr/bin/clickhouse-server(DB::MergedColumnOnlyOutputStream::writeSuffixAndGetChecksums()+0x1f6) [0x7010966]
6. /usr/bin/clickhouse-server(DB::MergeTreeData::alterDataPart(DB::NamesAndTypesList const&, std::vector<std::shared_ptr<DB::ASTIndexDeclaration>, std::allocator<std::sha
7. /usr/bin/clickhouse-server(ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::_List_iterator<ThreadFromGlobalPool>)+0x1a7) [0x772b977]
8. /usr/bin/clickhouse-server(ThreadFromGlobalPool::ThreadFromGlobalPool<ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::function<void ()>, int, std::option
9. /usr/bin/clickhouse-server(ThreadPoolImpl<std::thread>::worker(std::_List_iterator<std::thread>)+0x1a6) [0x7729486]
10. /usr/bin/clickhouse-server() [0xb89e440]
11. /lib64/libpthread.so.0(+0x7dd5) [0x7f2109a78dd5]
12. /lib64/libc.so.6(clone+0x6d) [0x7f210929c02d

It like the root of the problem was fixed between 19.11.12 and 19.11.13.
Most probably it was that fix: #7062
It was fixed in #6780

Adding test just in case.

It looks like those 2 issues can be also closed: #5289 and #6877

create table lc_empty_part_bug (id UInt64, s String) Engine=MergeTree ORDER BY id;
insert into lc_empty_part_bug select number as id, toString(rand()) from numbers(100);
alter table lc_empty_part_bug delete where id < 100;
SELECT 'wait for delete to finish', sleep(1);
Copy link
Member

Choose a reason for hiding this comment

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

This will make the test flacky.

Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

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

Look at the examples for waiting for mutation to finish in another tests.

@alexey-milovidov alexey-milovidov removed the request for review from KochetovNicolai December 2, 2019 23:05
@alexey-milovidov alexey-milovidov mentioned this pull request Dec 2, 2019
@alexey-milovidov alexey-milovidov merged commit bd72b57 into ClickHouse:master Dec 2, 2019
@alexey-milovidov
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enum8 -> LowCardinality(String) column type modification SegFault
2 participants