开启了tiflash,有些查询报错

【 TiDB 使用环境】生产环境 or 测试环境 or POC
生产环境
【 TiDB 版本】
5.3
【遇到的问题】
开启了tiflash,查询一些sql报 other error for mpp stream: DB::Exception: Argument at index 1 for function substringUTF8 must be constant
通过执行计划发现

通过设置set @@session.tidb_isolation_read_engines = “tikv”;
再执行就没问题了
【复现路径】做过哪些操作出现的问题
【问题现象及影响】

【附件】

得帮忙找一下 TiDB 和 TiFlash 对应节点的那个执行报错时间的完整报错,看一下哈。收集一下信息,谢谢。

[] [“MPPTask: [task 3 query 432647022863450115] task running meets error: DB::Exception: Argument at index 1 for function substringUTF8 must be constant Stack Trace : 0. /tiflash/tiflash(StackTrace::StackTrace()+0x16) [0x370f6a6]\ 1. /tiflash/tiflash(DB::IExecutableFunction::defaultImplementationForConstantArguments(DB::Block&, std::vector<unsigned long, std::allocator > const&, unsigned long) const+0xeb3) [0x78531c3]\ 2. /tiflash/tiflash(DB::IExecutableFunction::execute(DB::Block&, std::vector<unsigned long, std::allocator > const&, unsigned long) const+0x1c) [0x78535ac]\ 3. /tiflash/tiflash(DB::IFunctionBase::execute(DB::Block&, std::vector<unsigned long, std::allocator > const&, unsigned long) const+0xcb) [0x388b03b]\ 4. /tiflash/tiflash(DB::ExpressionAction::execute(DB::Block&) const+0x65b) [0x79d084b]\ 5. /tiflash/tiflash(DB::ExpressionActions::execute(DB::Block&) const+0x6a) [0x79d1c9a]\ 6. /tiflash/tiflash(DB::ExpressionBlockInputStream::getHeader() const+0x1a4) [0x78aa534]\ 7. /tiflash/tiflash(DB::generateProjectExpressionActions(std::shared_ptrDB::IBlockInputStream const&, DB::Context const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > > const&)+0x5b) [0x7d63f3b]\ 8. /tiflash/tiflash(DB::DAGQueryBlockInterpreter::executeProject(DB::DAGPipeline&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >&)+0x44) [0x7d64654]\ 9. /tiflash/tiflash(DB::DAGQueryBlockInterpreter::executeImpl(DB::DAGPipeline&)+0x1c9a) [0x7d6f2ca]\ 10. /tiflash/tiflash(DB::DAGQueryBlockInterpreter::execute()+0x56) [0x7d6fca6]\ 11. /tiflash/tiflash(DB::InterpreterDAG::executeQueryBlock(DB::DAGQueryBlock&, std::vector<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, DB::SubqueryForSet, std::hash<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, DB::SubqueryForSet> > >, std::allocator<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, DB::SubqueryForSet, std::hash<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, DB::SubqueryForSet> > > > >&)+0x237) [0x7d0f937]\ 12. /tiflash/tiflash(DB::InterpreterDAG::executeQueryBlock(DB::DAGQueryBlock&, std::vector<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, DB::SubqueryForSet, std::hash<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, DB::SubqueryForSet> > >, std::allocator<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, DB::SubqueryForSet, std::hash<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, DB::SubqueryForSet> > > > >&)+0x96) [0x7d0f796]\ 13. /tiflash/tiflash(DB::InterpreterDAG::execute()+0xc9) [0x7d10f19]\ 14. /tiflash/tiflash() [0x748dc27]\ 15. /tiflash/tiflash(DB::executeQuery(DB::DAGQuerySource&, DB::Context&, bool, DB::QueryProcessingStage::Enum)+0x64) [0x748eec4]\ 16. /tiflash/tiflash(DB::MPPTask::preprocess()+0x76) [0x7d332b6]\ 17. /tiflash/tiflash(DB::MPPTask::runImpl()+0x189) [0x7d38119]\ 18. /tiflash/tiflash() [0x8b729ef]\ 19. /lib64/libpthread.so.0(+0x7dd5) [0x7f3f420d9dd5]\ 20. /lib64/libc.so.6(clone+0x6d) [0x7f3f41b00ead]\ ”] [thread_id=33427]

从数据库的控制台查询到的日志如上

说明没识别到tiflash

Argument at index 1 for function substringUTF8 must be constant
是substr() 这个函数第一个参数必须要是常量,在该版本不支持。
看了这里的写法是 substr(str,length(str)-1), 改写成 substr(str,-1) ,或者 right(str,1) 试试。

3 Likes