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 table MODIFY COLUMN is failing when there are NULL values involved #1322

Closed
silviucpp opened this issue Oct 5, 2017 · 4 comments
Closed
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release

Comments

@silviucpp
Copy link
Contributor

Clickhouse version: 1.1.54293

CREATE TABLE table2(`boolean_false` Nullable(String), `ck.partition` Date, `ck.timestamp` DateTime) ENGINE = ReplicatedMergeTree('/var/lib/clickhouse/tables/{shard}/table2','{replica}',`ck.partition`,`ck.timestamp`,8192);
INSERT INTO table2(`ck.timestamp`,`ck.partition`, `boolean_false`) VALUES (1507193820,17444,NULL);
ALTER TABLE table2 MODIFY COLUMN `boolean_false` Nullable(UInt8)

Last command fails with:

Code: 341, e.displayText() = DB::Exception: Alter is not finished because timeout when waiting for some replicas: 01 (replication_alter_columns_timeout = 60). Alter will be done asynchronously., e.what() = DB::Exceptio

And logs is spammed with the following:

0. clickhouse-server(StackTrace::StackTrace()+0x16) [0x2fed876]
1. clickhouse-server(DB::Exception::Exception(std::string const&, int)+0x1f) [0x12ee80f]
2. clickhouse-server(DB::throwReadAfterEOF()+0x3c) [0x12ee86c]
3. clickhouse-server(DB::ConvertImpl<DB::DataTypeString, DB::DataTypeNumber<unsigned char>, DB::NameToUInt8>::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x2c4) [0x19baaa4]
4. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeInternal(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x445) [0x19ca195]
5. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x20) [0x19ca3d0]
6. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
7. clickhouse-server(DB::FunctionCast::prepare(std::shared_ptr<DB::IDataType> const&, DB::IDataType const*, unsigned long)::{lambda(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)#1}::operator()(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long) const+0x1f2) [0x1984362]
8. clickhouse-server(DB::FunctionCast::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x8c) [0x198410c]
9. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
10. clickhouse-server(DB::ExpressionAction::execute(DB::Block&) const+0x292) [0x2fd0072]
11. clickhouse-server(DB::ExpressionActions::execute(DB::Block&) const+0x32) [0x2fd21f2]
12. clickhouse-server(DB::ExpressionBlockInputStream::readImpl()+0x33) [0x328e7b3]
13. clickhouse-server(DB::IProfilingBlockInputStream::read()+0x1e6) [0x298a4f6]
14. clickhouse-server(DB::MergeTreeData::alterDataPart(std::shared_ptr<DB::MergeTreeDataPart const> const&, DB::NamesAndTypesList const&, std::shared_ptr<DB::IAST> const&, bool)+0x127c) [0x314b9fc]
15. clickhouse-server(DB::ReplicatedMergeTreeAlterThread::run()+0xd16) [0x31e76c6]
16. clickhouse-server() [0x3d2f20f]
17. /lib/x86_64-linux-gnu/libpthread.so.0(+0x8184) [0x7f12f9673184]
18. /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f12f8c8dffd]

2017.10.05 09:15:12.422550 [ 68 ] <Warning> system.table2 (Data): Aborting ALTER of part 20171005_20171005_0_0_0
2017.10.05 09:15:12.457086 [ 68 ] <Error> void DB::ReplicatedMergeTreeAlterThread::run(): Code: 32, e.displayText() = DB::Exception: Attempt to read after eof: Cannot parse UInt8 from String, because value is too short, e.what() = DB::Exception, Stack trace:

0. clickhouse-server(StackTrace::StackTrace()+0x16) [0x2fed876]
1. clickhouse-server(DB::Exception::Exception(std::string const&, int)+0x1f) [0x12ee80f]
2. clickhouse-server(DB::throwReadAfterEOF()+0x3c) [0x12ee86c]
3. clickhouse-server(DB::ConvertImpl<DB::DataTypeString, DB::DataTypeNumber<unsigned char>, DB::NameToUInt8>::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x2c4) [0x19baaa4]
4. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeInternal(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x445) [0x19ca195]
5. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x20) [0x19ca3d0]
6. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
7. clickhouse-server(DB::FunctionCast::prepare(std::shared_ptr<DB::IDataType> const&, DB::IDataType const*, unsigned long)::{lambda(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)#1}::operator()(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long) const+0x1f2) [0x1984362]
8. clickhouse-server(DB::FunctionCast::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x8c) [0x198410c]
9. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
10. clickhouse-server(DB::ExpressionAction::execute(DB::Block&) const+0x292) [0x2fd0072]
11. clickhouse-server(DB::ExpressionActions::execute(DB::Block&) const+0x32) [0x2fd21f2]
12. clickhouse-server(DB::ExpressionBlockInputStream::readImpl()+0x33) [0x328e7b3]
13. clickhouse-server(DB::IProfilingBlockInputStream::read()+0x1e6) [0x298a4f6]
14. clickhouse-server(DB::MergeTreeData::alterDataPart(std::shared_ptr<DB::MergeTreeDataPart const> const&, DB::NamesAndTypesList const&, std::shared_ptr<DB::IAST> const&, bool)+0x127c) [0x314b9fc]
15. clickhouse-server(DB::ReplicatedMergeTreeAlterThread::run()+0xd16) [0x31e76c6]
16. clickhouse-server() [0x3d2f20f]
17. /lib/x86_64-linux-gnu/libpthread.so.0(+0x8184) [0x7f12f9673184]
18. /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f12f8c8dffd]

2017.10.05 09:15:22.458944 [ 68 ] <Warning> system.table2 (Data): Aborting ALTER of part 20171005_20171005_0_0_0
2017.10.05 09:15:22.493252 [ 68 ] <Error> void DB::ReplicatedMergeTreeAlterThread::run(): Code: 32, e.displayText() = DB::Exception: Attempt to read after eof: Cannot parse UInt8 from String, because value is too short, e.what() = DB::Exception, Stack trace:

0. clickhouse-server(StackTrace::StackTrace()+0x16) [0x2fed876]
1. clickhouse-server(DB::Exception::Exception(std::string const&, int)+0x1f) [0x12ee80f]
2. clickhouse-server(DB::throwReadAfterEOF()+0x3c) [0x12ee86c]
3. clickhouse-server(DB::ConvertImpl<DB::DataTypeString, DB::DataTypeNumber<unsigned char>, DB::NameToUInt8>::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x2c4) [0x19baaa4]
4. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeInternal(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x445) [0x19ca195]
5. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x20) [0x19ca3d0]
6. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
7. clickhouse-server(DB::FunctionCast::prepare(std::shared_ptr<DB::IDataType> const&, DB::IDataType const*, unsigned long)::{lambda(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)#1}::operator()(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long) const+0x1f2) [0x1984362]
8. clickhouse-server(DB::FunctionCast::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x8c) [0x198410c]
9. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
10. clickhouse-server(DB::ExpressionAction::execute(DB::Block&) const+0x292) [0x2fd0072]
11. clickhouse-server(DB::ExpressionActions::execute(DB::Block&) const+0x32) [0x2fd21f2]
12. clickhouse-server(DB::ExpressionBlockInputStream::readImpl()+0x33) [0x328e7b3]
13. clickhouse-server(DB::IProfilingBlockInputStream::read()+0x1e6) [0x298a4f6]
14. clickhouse-server(DB::MergeTreeData::alterDataPart(std::shared_ptr<DB::MergeTreeDataPart const> const&, DB::NamesAndTypesList const&, std::shared_ptr<DB::IAST> const&, bool)+0x127c) [0x314b9fc]
15. clickhouse-server(DB::ReplicatedMergeTreeAlterThread::run()+0xd16) [0x31e76c6]
16. clickhouse-server() [0x3d2f20f]
17. /lib/x86_64-linux-gnu/libpthread.so.0(+0x8184) [0x7f12f9673184]
18. /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f12f8c8dffd]

2017.10.05 09:15:32.495881 [ 68 ] <Warning> system.table2 (Data): Aborting ALTER of part 20171005_20171005_0_0_0
2017.10.05 09:15:32.529583 [ 68 ] <Error> void DB::ReplicatedMergeTreeAlterThread::run(): Code: 32, e.displayText() = DB::Exception: Attempt to read after eof: Cannot parse UInt8 from String, because value is too short, e.what() = DB::Exception, Stack trace:

0. clickhouse-server(StackTrace::StackTrace()+0x16) [0x2fed876]
1. clickhouse-server(DB::Exception::Exception(std::string const&, int)+0x1f) [0x12ee80f]
2. clickhouse-server(DB::throwReadAfterEOF()+0x3c) [0x12ee86c]
3. clickhouse-server(DB::ConvertImpl<DB::DataTypeString, DB::DataTypeNumber<unsigned char>, DB::NameToUInt8>::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x2c4) [0x19baaa4]
4. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeInternal(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x445) [0x19ca195]
5. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x20) [0x19ca3d0]
6. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
7. clickhouse-server(DB::FunctionCast::prepare(std::shared_ptr<DB::IDataType> const&, DB::IDataType const*, unsigned long)::{lambda(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)#1}::operator()(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long) const+0x1f2) [0x1984362]
8. clickhouse-server(DB::FunctionCast::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x8c) [0x198410c]
9. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
10. clickhouse-server(DB::ExpressionAction::execute(DB::Block&) const+0x292) [0x2fd0072]
11. clickhouse-server(DB::ExpressionActions::execute(DB::Block&) const+0x32) [0x2fd21f2]
12. clickhouse-server(DB::ExpressionBlockInputStream::readImpl()+0x33) [0x328e7b3]
13. clickhouse-server(DB::IProfilingBlockInputStream::read()+0x1e6) [0x298a4f6]
14. clickhouse-server(DB::MergeTreeData::alterDataPart(std::shared_ptr<DB::MergeTreeDataPart const> const&, DB::NamesAndTypesList const&, std::shared_ptr<DB::IAST> const&, bool)+0x127c) [0x314b9fc]
15. clickhouse-server(DB::ReplicatedMergeTreeAlterThread::run()+0xd16) [0x31e76c6]
16. clickhouse-server() [0x3d2f20f]
17. /lib/x86_64-linux-gnu/libpthread.so.0(+0x8184) [0x7f12f9673184]
18. /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f12f8c8dffd]

2017.10.05 09:15:42.531570 [ 68 ] <Warning> system.table2 (Data): Aborting ALTER of part 20171005_20171005_0_0_0
2017.10.05 09:15:42.566048 [ 68 ] <Error> void DB::ReplicatedMergeTreeAlterThread::run(): Code: 32, e.displayText() = DB::Exception: Attempt to read after eof: Cannot parse UInt8 from String, because value is too short, e.what() = DB::Exception, Stack trace:

0. clickhouse-server(StackTrace::StackTrace()+0x16) [0x2fed876]
1. clickhouse-server(DB::Exception::Exception(std::string const&, int)+0x1f) [0x12ee80f]
2. clickhouse-server(DB::throwReadAfterEOF()+0x3c) [0x12ee86c]
3. clickhouse-server(DB::ConvertImpl<DB::DataTypeString, DB::DataTypeNumber<unsigned char>, DB::NameToUInt8>::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x2c4) [0x19baaa4]
4. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeInternal(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x445) [0x19ca195]
5. clickhouse-server(DB::FunctionConvert<DB::DataTypeNumber<unsigned char>, DB::NameToUInt8, DB::ToIntMonotonicity<unsigned char> >::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x20) [0x19ca3d0]
6. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
7. clickhouse-server(DB::FunctionCast::prepare(std::shared_ptr<DB::IDataType> const&, DB::IDataType const*, unsigned long)::{lambda(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)#1}::operator()(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long) const+0x1f2) [0x1984362]
8. clickhouse-server(DB::FunctionCast::executeImpl(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x8c) [0x198410c]
9. clickhouse-server(DB::IFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long)+0x125) [0x3205c55]
10. clickhouse-server(DB::ExpressionAction::execute(DB::Block&) const+0x292) [0x2fd0072]
11. clickhouse-server(DB::ExpressionActions::execute(DB::Block&) const+0x32) [0x2fd21f2]
12. clickhouse-server(DB::ExpressionBlockInputStream::readImpl()+0x33) [0x328e7b3]
13. clickhouse-server(DB::IProfilingBlockInputStream::read()+0x1e6) [0x298a4f6]
14. clickhouse-server(DB::MergeTreeData::alterDataPart(std::shared_ptr<DB::MergeTreeDataPart const> const&, DB::NamesAndTypesList const&, std::shared_ptr<DB::IAST> const&, bool)+0x127c) [0x314b9fc]
15. clickhouse-server(DB::ReplicatedMergeTreeAlterThread::run()+0xd16) [0x31e76c6]
16. clickhouse-server() [0x3d2f20f]
17. /lib/x86_64-linux-gnu/libpthread.so.0(+0x8184) [0x7f12f9673184]
18. /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f12f8c8dffd]
@silviucpp silviucpp changed the title alter table is failing and leaves cluster in a strange state alter table MODIFY COLUMN is failing when there are NULL values involved Nov 1, 2017
@silviucpp
Copy link
Contributor Author

@alexey-milovidov This bug is still present on master

@silviucpp
Copy link
Contributor Author

@alexey-milovidov Also this one I'm not sure was not fixed in the meantime. I didn't checked on the master but seems nobody reviewed it to mark it as bug or close it.

@alexey-milovidov alexey-milovidov self-assigned this Jul 11, 2018
@alexey-milovidov alexey-milovidov added the bug Confirmed user-visible misbehaviour in official release label Jul 11, 2018
@alexey-milovidov
Copy link
Member

Yes, it isn't fixed.

@alexey-milovidov
Copy link
Member

The most simple case:

SELECT CAST(arrayJoin(['1', NULL]), 'Nullable(UInt8)')

Received exception from server (version 1.1.54391):
Code: 32. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Attempt to read after eof: Cannot parse UInt8 from String, because value is too short. 

alexey-milovidov added a commit that referenced this issue Jul 11, 2018
alexey-milovidov added a commit that referenced this issue Jul 14, 2018
alexey-milovidov added a commit that referenced this issue Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release
Projects
None yet
Development

No branches or pull requests

2 participants