【 TiDB 使用环境】生产环境
【 TiDB 版本】
【复现路径】
【遇到的问题:问题现象及影响】
执行sql:
select distinct t1.name
, t1.pid
as RK_pid , t1.times
as RK_times from database1.test1
t1 where (t1.times
=‘1’ and t1.pid
=‘P0000904975-0’) or (t1.times
=‘1’ and t1.pid
=‘P0000900320-0’) or (t1.times
=‘5’ and t1.pid
=‘P0000852293-0’) or (t1.times
=‘12’ and t1.pid
=‘P0000902892-0’) )
报错:
other error for mpp stream: Code: 10, e.displayText() = DB::Exception: Not found column generated_column_2 in block. There are only columns: pid, times, name, e.what() = DB::Exception
sql里面没有用到generated_column_2字段, 表里面也没有generated_column_2字段,mpp是开启的, 怀疑是执行计划优化后, 生成的该字段
有生成列, 我估计是8.1后, 某些情况会走mpp, 但是不支持生成列, 然后就报错了, 目前只能做兼容,如果是mpp报错, 就session级别关闭mpp, 然后就成功了
h5n1
(H5n1)
2024 年7 月 23 日 08:31
6
1 个赞
tidb-mpp-exception (4.3 KB)
这个问题不是稳定复现的
other error for mpp stream: Code: 10, e.displayText() = DB::Exception: Not found column generated_column_2 in block. There are only columns: pid, times, name, e.what() = DB::Exception
请问一下能否从 error 日志里捞一下这条报错的完整版,里面有堆栈。
java.sql.SQLException: other error for mpp stream: Code: 10, e.displayText() = DB::Exception: Not found column generated_column_8 in block. There are only columns: patient_id, times, name, request_day, unit_code, doctor_code, op_day, serial_no, sub_request_day, trim_patient_id, e.what() = DB::Exception,
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1201)
at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:217)
堆栈信息打的比较少, 执行后就直接报错了, 没答应mpp相关的信息
找到一个类似的问题,但不完全一样,正在尝试复现。
已打开 12:59AM - 26 Feb 24 UTC
已关闭 02:24AM - 17 Apr 24 UTC
type/bug
severity/major
component/compute
affects-6.5
affects-7.1
affects-7.5
affects-8.1
## Bug Report
Please answer these questions before submitting your issue. Tha… nks!
### 1. Minimal reproduce step (Required)
```sql
-- create table
create table generate_demo (
id bigint not null,
created_at datetime not null,
is_removed boolean not null,
updated_at datetime null,
__since_at datetime as (updated_at) virtual, -- generated column
primary key (id)
);
-- set tiflash replica
alter table test.generate_demo set tiflash replica 1;
-- init data
insert into generate_demo (id, created_at, is_removed, updated_at) values (1, now(), 0, null), (2, now(), 1, now())
;
```
This error occurs only if the __since_at column is set to virtual.
use 'alter table .... add column....' to add generated column is the same with the statement 'create table .....'
### 2. What did you expect to see? (Required)
I expect to see the below query execute successful and return correct results.
```sql
set tidb_isolation_read_engines = 'tikv,tiflash';
select * from generate_demo order by created_at asc limit 100;
set tidb_isolation_read_engines = 'tiflash';
explain select * from generate_demo order by created_at asc limit 100;
```
### 3. What did you see instead (Required)
I received error like this:
```plain
Error Code: 1105
Not found column table_scan_1 in block. There are only columns: table_scan_0, table_scan_2
```
the execution plan is:
```plain
id estRows task access object operator info
-------------------------- ------- ----------------- ------------------- ----------------------------------------------------
TopN_7 2.00 root test.generate_demo.created_at, offset:0, count:100
└─TableReader_14 2.00 root data:TopN_13
└─TopN_13 2.00 batchCop[tiflash] test.generate_demo.created_at, offset:0, count:100
└─TableFullScan_12 2.00 batchCop[tiflash] table:generate_demo keep order:false, stats:pseudo
```
tiflash error log:
```plain
DB Exception: Not found column table_scan_4 in block. There are only columns: table_scan_0, table_scan_1, table_scan_2, table_scan_3
0x1c541ae DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) [tiflash+29704622]
dbms/src/Common/Exception.h:46
0x76294f9 DB::Block::getByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) [tiflash+123901177]
dbms/src/Core/Block.cpp:205
0x788f11e DB::ExpressionAction::execute(DB::Block&) const [tiflash+126415134]
dbms/src/Interpreters/ExpressionActions.cpp:360
0x763d4cb DB::ExpressionBlockInputStream::readImpl() [tiflash+123983051]
dbms/src/DataStreams/ExpressionBlockInputStream.cpp:42
0x7645885 DB::IProfilingBlockInputStream::read(DB::PODArray<unsigned char, 4096ul, Allocator<false>, 15ul, 16ul>*&, bool) [tiflash+124016773]
dbms/src/DataStreams/IProfilingBlockInputStream.cpp:75
0x7645575 DB::IProfilingBlockInputStream::read() [tiflash+124015989]
dbms/src/DataStreams/IProfilingBlockInputStream.cpp:43
0x82c03f1 DB::DataStreamExecutor::execute(DB::ResultHandler&&) [tiflash+137102321]
dbms/src/Flash/Executor/DataStreamExecutor.cpp:49
0x82c6f79 DB::QueryExecutor::execute(std::__1::function<void (DB::Block const&)>) [tiflash+137129849]
dbms/src/Flash/Executor/QueryExecutor.cpp:27
0x8143a13 DB::DAGDriver<true>::execute() [tiflash+135543315]
dbms/src/Flash/Coprocessor/DAGDriver.cpp:145
0x8118cab DB::BatchCoprocessorHandler::execute() [tiflash+135367851]
dbms/src/Flash/BatchCoprocessorHandler.cpp:86
0x81151b6 std::__1::__function::__func<DB::FlashService::BatchCoprocessor(grpc::ServerContext*, coprocessor::BatchRequest const*, grpc::ServerWriter<coprocessor::BatchResponse>*)::$_9, std::__1::allocator<DB::FlashService::BatchCoprocessor(grpc::ServerContext*, coprocessor::BatchRequest const*, grpc::ServerWriter<coprocessor::BatchResponse>*)::$_9>, grpc::Status ()>::operator()() [tiflash+135352758]
/usr/local/bin/../include/c++/v1/__functional/function.h:345
0x8113648 std::__1::__packaged_task_func<std::__1::function<grpc::Status ()>, std::__1::allocator<std::__1::function<grpc::Status ()> >, grpc::Status ()>::operator()() [tiflash+135345736]
/usr/local/bin/../include/c++/v1/future:1687
0x8113805 std::__1::packaged_task<grpc::Status ()>::operator()() [tiflash+135346181]
/usr/local/bin/../include/c++/v1/future:1960
0x8680754 void* 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+141035348]
/usr/local/bin/../include/c++/v1/thread:291
0x7f2cbaf29609 start_thread [libpthread.so.0+34313]
0x7f2cbad6d353 clone [libc.so.6+1176403]
```
### 4. What is your TiFlash version? (Required)
```plain
TiDB
Release Version: v7.1.2
Edition: Community
Git Commit Hash: 1b60452040258606e96b830b040aabf54625a8f3
Git Branch: heads/refs/tags/v7.1.2
UTC Build Time: 2023-10-17 06:57:45
Enable Features: jemalloc sm4(GmSSL) avx2 avx512 unwind thinlto
Profile: RELWITHDEBINFO
Raft Proxy
Git Commit Hash: 7aed51bfdf89131d37eabb6b379de4b3c26cc1ac
Git Commit Branch: HEAD
UTC Build Time: 2023-10-17 07:11:55
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)
```
另外可以到 tiflash 日志里面找下报错的堆栈吗,可以快速定位是哪个模块的问题