Skip to content

compread with null will let tiflash crash  #7383

@aytrack

Description

@aytrack

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `IDT_26539` (
    `COL102` float DEFAULT NULL,
    `COL103` float DEFAULT NULL,
    `COL1` float GENERATED ALWAYS AS ((`COL102` DIV 10)) VIRTUAL,
    `COL2` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL,
    `COL4` datetime DEFAULT NULL,
    `COL3` bigint DEFAULT NULL,
    `COL5` float DEFAULT NULL,
    KEY `UK_COL1` (`COL1`) /*!80000 INVISIBLE */
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
alter table IDT_26539 set tiflash replica 1;
select * from IDT_26539 where col2 = "r2Ic" ;
select * from IDT_26539 where col1 = NULL or col2 = "r2Ic";

2. What did you expect to see? (Required)

query success and tiflash works well

3. What did you see instead (Required)

there are two issue here.

mysql>  select * from IDT_26539 where col2 = "r2Ic" ;
ERROR 1105 (HY000): Not found column: 'col4'
mysql>  select * from IDT_26539 where col1 = NULL or col2 = "r2Ic";
ERROR 9012 (HY000): TiFlash server timeout

tiflash log

[2023/04/25 19:47:51.469 +08:00] [ERROR] [SegmentReader.cpp:123] ["ErrMsg: Not found column: 'col4' StackTrace \n       0x1bfea3e\tDB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) [tiflash+29354558]\n                \tdbms/src/Common/Exception.h:46\n       0x787a5ca\tDB::ExpressionAction::execute(DB::Block&) const [tiflash+126330314]\n                \tdbms/src/Interpreters/ExpressionActions.cpp:325\n       0x762ef2b\tDB::FilterTransformAction::FilterTransformAction(DB::Block const&, std::__1::shared_ptr<DB::ExpressionActions> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) [tiflash+123924267]\n                \tdbms/src/DataStreams/FilterTransformAction.cpp:41\n       0x762c113\tDB::FilterBlockInputStream::FilterBlockInputStream(std::__1::shared_ptr<DB::IBlockInputStream> const&, std::__1::shared_ptr<DB::ExpressionActions> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) [tiflash+123912467]\n                \tdbms/src/DataStreams/FilterBlockInputStream.cpp:37\n       0x73ac292\tDB::DM::Segment::getBitmapFilterInputStream(DB::DM::DMContext const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::vector<DB::DM::RowKeyRange, std::__1::allocator<DB::DM::RowKeyRange> > const&, std::__1::shared_ptr<DB::DM::PushDownFilter> const&, unsigned long, unsigned long) [tiflash+121291410]\n                \tdbms/src/Storages/DeltaMerge/Segment.cpp:2852\n       0x73a981a\tDB::DM::Segment::getInputStream(DB::DM::ReadMode const&, DB::DM::DMContext const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::vector<DB::DM::RowKeyRange, std::__1::allocator<DB::DM::RowKeyRange> > const&, std::__1::shared_ptr<DB::DM::PushDownFilter> const&, unsigned long, unsigned long) [tiflash+121280538]\n                \tdbms/src/Storages/DeltaMerge/Segment.cpp:709\n       0x7421fe6\tDB::DM::SegmentReadTaskPool::buildInputStream(std::__1::shared_ptr<DB::DM::SegmentReadTask>&) [tiflash+121774054]\n                \tdbms/src/Storages/DeltaMerge/SegmentReadTaskPool.cpp:163\n       0x750bedf\tDB::DM::MergedTask::initOnce() [tiflash+122732255]\n                \tdbms/src/Storages/DeltaMerge/ReadThread/MergedTask.cpp:50\n       0x751261e\tDB::DM::SegmentReader::run() [tiflash+122758686]\n                \tdbms/src/Storages/DeltaMerge/ReadThread/SegmentReader.cpp:153\n       0x7513d62\tvoid* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (DB::DM::SegmentReader::*)(), DB::DM::SegmentReader*> >(void*) [tiflash+122764642]\n                \t/usr/local/bin/../include/c++/v1/thread:291\n  0x7f6df2f0d802\tstart_thread [libc.so.6+653314]\n  0x7f6df2ead450\tclone3 [libc.so.6+259152]"] [thread_id=4]
[2023/04/25 19:47:51.470 +08:00] [ERROR] [DAGDriver.cpp:209] ["DB Exception: Not found column: 'col4'\n\n       0x1bfea3e\tDB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) [tiflash+29354558]\n                \tdbms/src/Common/Exception.h:46\n       0x787a5ca\tDB::ExpressionAction::execute(DB::Block&) const [tiflash+126330314]\n                \tdbms/src/Interpreters/ExpressionActions.cpp:325\n       0x762ef2b\tDB::FilterTransformAction::FilterTransformAction(DB::Block const&, std::__1::shared_ptr<DB::ExpressionActions> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) [tiflash+123924267]\n                \tdbms/src/DataStreams/FilterTransformAction.cpp:41\n       0x762c113\tDB::FilterBlockInputStream::FilterBlockInputStream(std::__1::shared_ptr<DB::IBlockInputStream> const&, std::__1::shared_ptr<DB::ExpressionActions> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) [tiflash+123912467]\n                \tdbms/src/DataStreams/FilterBlockInputStream.cpp:37\n       0x73ac292\tDB::DM::Segment::getBitmapFilterInputStream(DB::DM::DMContext const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::vector<DB::DM::RowKeyRange, std::__1::allocator<DB::DM::RowKeyRange> > const&, std::__1::shared_ptr<DB::DM::PushDownFilter> const&, unsigned long, unsigned long) [tiflash+121291410]\n                \tdbms/src/Storages/DeltaMerge/Segment.cpp:2852\n       0x73a981a\tDB::DM::Segment::getInputStream(DB::DM::ReadMode const&, DB::DM::DMContext const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::vector<DB::DM::RowKeyRange, std::__1::allocator<DB::DM::RowKeyRange> > const&, std::__1::shared_ptr<DB::DM::PushDownFilter> const&, unsigned long, unsigned long) [tiflash+121280538]\n                \tdbms/src/Storages/DeltaMerge/Segment.cpp:709\n       0x7421fe6\tDB::DM::SegmentReadTaskPool::buildInputStream(std::__1::shared_ptr<DB::DM::SegmentReadTask>&) [tiflash+121774054]\n                \tdbms/src/Storages/DeltaMerge/SegmentReadTaskPool.cpp:163\n       0x750bedf\tDB::DM::MergedTask::initOnce() [tiflash+122732255]\n                \tdbms/src/Storages/DeltaMerge/ReadThread/MergedTask.cpp:50\n       0x751261e\tDB::DM::SegmentReader::run() [tiflash+122758686]\n                \tdbms/src/Storages/DeltaMerge/ReadThread/SegmentReader.cpp:153\n       0x7513d62\tvoid* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (DB::DM::SegmentReader::*)(), DB::DM::SegmentReader*> >(void*) [tiflash+122764642]\n                \t/usr/local/bin/../include/c++/v1/thread:291\n  0x7f6df2f0d802\tstart_thread [libc.so.6+653314]\n  0x7f6df2ead450\tclone3 [libc.so.6+259152]"] [source=DAGDriver] [thread_id=53]
[2023/04/25 19:48:07.250 +08:00] [ERROR] [BaseDaemon.cpp:376] [########################################] [source=BaseDaemon] [thread_id=55]
[2023/04/25 19:48:07.250 +08:00] [ERROR] [BaseDaemon.cpp:377] ["(from thread 54) Received signal Segmentation fault(11)."] [source=BaseDaemon] [thread_id=55]
[2023/04/25 19:48:07.250 +08:00] [ERROR] [BaseDaemon.cpp:405] ["Address: NULL pointer."] [source=BaseDaemon] [thread_id=55]
[2023/04/25 19:48:07.250 +08:00] [ERROR] [BaseDaemon.cpp:413] ["Access: read."] [source=BaseDaemon] [thread_id=55]
[2023/04/25 19:48:07.250 +08:00] [ERROR] [BaseDaemon.cpp:425] ["Unknown si_code."] [source=BaseDaemon] [thread_id=55]
[2023/04/25 19:48:07.293 +08:00] [ERROR] [BaseDaemon.cpp:569] ["\n       0x7540661\tfaultSignalHandler(int, siginfo_t*, void*) [tiflash+122947169]\n                \tlibs/libdaemon/src/BaseDaemon.cpp:220\n  0x7f6df2ec2d90\t<unknown symbol> [libc.so.6+347536]\n       0x86d30bd\tmemcpy [tiflash+141373629]\n                \tlibs/libmemcpy/memcpy.cpp:23\n       0x812ca91\tDB::DAGExpressionAnalyzer::buildExtraCastsAfterTS(std::__1::shared_ptr<DB::ExpressionActions> const&, std::__1::vector<DB::ExtraCastAfterTSMode, std::__1::allocator<DB::ExtraCastAfterTSMode> > const&, std::__1::vector<TiDB::ColumnInfo, std::__1::allocator<TiDB::ColumnInfo> > const&) [tiflash+135449233]\n                \tdbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.cpp:921\n       0x7e42d05\tDB::StorageDeltaMerge::buildPushDownFilter(std::__1::shared_ptr<DB::DM::RSOperator> const&, std::__1::vector<TiDB::ColumnInfo, std::__1::allocator<TiDB::ColumnInfo> > const&, google::protobuf::RepeatedPtrField<tipb::Expr> const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, DB::Context const&, std::__1::shared_ptr<DB::Logger> const&) [tiflash+132394245]\n                \tdbms/src/Storages/StorageDeltaMerge.cpp:797\n       0x7e44ae8\tDB::StorageDeltaMerge::parsePushDownFilter(DB::SelectQueryInfo const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, DB::Context const&, std::__1::shared_ptr<DB::Logger> const&) [tiflash+132401896]\n                \tdbms/src/Storages/StorageDeltaMerge.cpp:840\n       0x7e44e7f\tDB::StorageDeltaMerge::read(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&, DB::SelectQueryInfo const&, DB::Context const&, DB::QueryProcessingStage::Enum&, unsigned long, unsigned int) [tiflash+132402815]\n                \tdbms/src/Storages/StorageDeltaMerge.cpp:881\n       0x818e4f2\tDB::DAGStorageInterpreter::buildLocalStreams(DB::DAGPipeline&, unsigned long) [tiflash+135849202]\n                \tdbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp:789\n       0x818941b\tDB::DAGStorageInterpreter::executeImpl(DB::DAGPipeline&) [tiflash+135828507]\n                \tdbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp:287\n       0x831df8a\tDB::PhysicalTableScan::buildBlockInputStreamImpl(DB::DAGPipeline&, DB::Context&, unsigned long) [tiflash+137486218]\n                \tdbms/src/Flash/Planner/Plans/PhysicalTableScan.cpp:68\n       0x82c2146\tDB::PhysicalPlanNode::buildBlockInputStream(DB::DAGPipeline&, DB::Context&, unsigned long) [tiflash+137109830]\n                \tdbms/src/Flash/Planner/PhysicalPlanNode.cpp:83\n       0x831ad36\tDB::PhysicalProjection::buildBlockInputStreamImpl(DB::DAGPipeline&, DB::Context&, unsigned long) [tiflash+137473334]\n                \tdbms/src/Flash/Planner/Plans/PhysicalProjection.cpp:143\n       0x82c2146\tDB::PhysicalPlanNode::buildBlockInputStream(DB::DAGPipeline&, DB::Context&, unsigned long) [tiflash+137109830]\n                \tdbms/src/Flash/Planner/PhysicalPlanNode.cpp:83\n       0x82c9bde\tDB::Planner::execute() [tiflash+137141214]\n                \tdbms/src/Flash/Planner/Planner.cpp:36\n       0x811b889\tDB::(anonymous namespace)::doExecuteAsBlockIO(DB::IQuerySource&, DB::Context&, bool) [tiflash+135379081]\n                \tdbms/src/Flash/executeQuery.cpp:95\n       0x811aa3f\tDB::queryExecute(DB::Context&, bool) [tiflash+135375423]\n                \tdbms/src/Flash/executeQuery.cpp:177\n       0x8115c8e\tDB::DAGDriver<false>::execute() [tiflash+135355534]\n                \tdbms/src/Flash/Coprocessor/DAGDriver.cpp:94\n       0x80bfe68\tDB::CoprocessorHandler::execute() [tiflash+135003752]\n                \tdbms/src/Flash/CoprocessorHandler.cpp:122\n       0x80e4fa3\tstd::__1::__function::__func<DB::FlashService::Coprocessor(grpc::ServerContext*, coprocessor::Request const*, coprocessor::Response*)::$_6, std::__1::allocator<DB::FlashService::Coprocessor(grpc::ServerContext*, coprocessor::Request const*, coprocessor::Response*)::$_6>, grpc::Status ()>::operator()() [tiflash+135155619]\n                \t/usr/local/bin/../include/c++/v1/__functional/function.h:345\n       0x80e3bb8\tstd::__1::__packaged_task_func<std::__1::function<grpc::Status ()>, std::__1::allocator<std::__1::function<grpc::Status ()> >, grpc::Status ()>::operator()() [tiflash+135150520]\n                \t/usr/local/bin/../include/c++/v1/future:1687\n       0x80e3d75\tstd::__1::packaged_task<grpc::Status ()>::operator()() [tiflash+135150965]\n                \t/usr/local/bin/../include/c++/v1/future:1960\n       0x865cf94\tvoid* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, legacy::ThreadPool::ThreadPool(unsigned long, std::__1::function<void ()>)::$_0> >(void*) [tiflash+140890004]\n                \t/usr/local/bin/../include/c++/v1/thread:291\n  0x7f6df2f0d802\tstart_thread [libc.so.6+653314]"] [source=BaseDaemon] [thread_id=55]

4. What is your TiFlash version? (Required)

TiFlash
Release Version: v7.1.0-rc.0
Edition:         Community
Git Commit Hash: 4ee141267ff83314ae85313860b1bd007c29b658
Git Branch:      heads/refs/tags/v7.1.0-rc.0
UTC Build Time:  2023-04-21 10:16:18
Enable Features: jemalloc sm4(GmSSL) avx2 avx512 unwind thinlto
Profile:         RELWITHDEBINFO

Raft Proxy
Git Commit Hash:   23dea9183f921908963801854324029d066c0be9
Git Commit Branch: HEAD
UTC Build Time:    2023-04-21 10:22:36
Rust Version:      rustc 1.67.0-nightly (96ddd32c4 2022-11-14)
Storage Engine:    tiflash
Prometheus Prefix: tiflash_proxy_
Profile:           release
Enable Features:   Unknown (env var does not exist when building)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions