matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.74k stars 271 forks source link

[Bug]: Terminate Restore statement the Incrservice internal SQL caused a null pointer and CN crash #17262

Open qingxinhome opened 1 month ago

qingxinhome commented 1 month ago

Is there an existing issue for the same bug?

Branch Name

main

Commit ID

5656737fac3ca70f9a3fe201f721de4060762541

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

企业微信截图_17198888929455

image

Expected Behavior

mysql> restore account sys database mo_sample_data_tpch_sf123 table lineitem from snapshot sp03; ^C^C -- query aborted ERROR 1105 (HY000): context canceled

Steps to Reproduce

CREATE DATABASE IF NOT EXISTS mo_sample_data_tpch_sf123;
NOT NULL, L_QUANTITY DECIMAL(15,2) NOT NULL, L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL, L_DISCOUNT DECIMAL(15,2) NOT NULL, L_TAX DECIMAL(15,2) NOT NULL, L_RETURNFLAG CHAR(1) NOT NULL, L_LINESTATUS CHAR(1) NOT NULL, L_SHIPDATE DATE NOT NULL, L_COMMITDATE DATE NOT NULL, L_RECEIPTDATE DATE NOT NULL, L_SHIPINSTRUCT CHAR(25) NOT NULL, L_SHIPMODE CHAR(10) NOT NULL, L_COMMENT VARCHAR(44) NOT NULL);
use mo_sample_data_tpch_sf123;
CREATE TABLE IF NOT EXISTS mo_sample_data_tpch_sf123.lineitem( L_ORDERKEY BIGINT NOT NULL, L_PARTKEY INTEGER NOT NULL, L_SUPPKEY INTEGER NOT NULL, L_LINENUMBER INTEGER NOT NULL, L_QUANTITY DECIMAL(15,2) NOT NULL, L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL, L_DISCOUNT DECIMAL(15,2) NOT NULL, L_TAX DECIMAL(15,2) NOT NULL, L_RETURNFLAG CHAR(1) NOT NULL, L_LINESTATUS CHAR(1) NOT NULL, L_SHIPDATE DATE NOT NULL, L_COMMITDATE DATE NOT NULL, L_RECEIPTDATE DATE NOT NULL, L_SHIPINSTRUCT CHAR(25) NOT NULL, L_SHIPMODE CHAR(10) NOT NULL, L_COMMENT VARCHAR(44) NOT NULL);
load data infile '/home/yiming/workspace/loadfile/lineitem.tbl' into table mo_sample_data_tpch_sf123.lineitem FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
create snapshot sp03 for account sys;
drop database mo_sample_data_tpch_sf123;
restore account sys database mo_sample_data_tpch_sf123 table lineitem from snapshot sp03;  --> ctrl + C

Additional information

No response

qingxinhome commented 1 month ago

Error Stack: github.com/matrixorigin/matrixone/pkg/container/vector.(Vector).IsConst(...) /home/yiming/workspace/performance/matrixone/pkg/container/vector/vector.go:337 github.com/matrixorigin/matrixone/pkg/container/vector.(Vector).Shrink(0x0?, {0x0?, 0x0?, 0x0?}, 0x0?) /home/yiming/workspace/performance/matrixone/pkg/container/vector/vector.go:687 +0x17 github.com/matrixorigin/matrixone/pkg/container/batch.(Batch).Shrink(0xc093df3200, {0x0, 0x0, 0x0}, 0x1) /home/yiming/workspace/performance/matrixone/pkg/container/batch/batch.go:122 +0x6a github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(Transaction).compactionBlksLocked(0xc033a4ddc0) /home/yiming/workspace/performance/matrixone/pkg/vm/engine/disttae/txn.go:941 +0x90a github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(Transaction).mergeTxnWorkspaceLocked(0xc033a4ddc0?) /home/yiming/workspace/performance/matrixone/pkg/vm/engine/disttae/txn.go:837 +0x4c github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(Transaction).Adjust(0xc033a4ddc0, 0x111) /home/yiming/workspace/performance/matrixone/pkg/vm/engine/disttae/types.go:413 +0x1d6 github.com/matrixorigin/matrixone/pkg/sql/compile.(Compile).Run(0xc0161bcd80, 0x543c9e0?) /home/yiming/workspace/performance/matrixone/pkg/sql/compile/compile.go:608 +0xb8a github.com/matrixorigin/matrixone/pkg/sql/compile.(txnExecutor).Exec(0xc003d6efc0, {0xc02a185a80, 0x72}, {0x7fabbc0?, 0x0?}) /home/yiming/workspace/performance/matrixone/pkg/sql/compile/sql_executor.go:344 +0xb78 github.com/matrixorigin/matrixone/pkg/incrservice.(sqlStore).Allocate.func2({0x543d4c0, 0xc003d6efc0}) /home/yiming/workspace/performance/matrixone/pkg/incrservice/store_sql.go:132 +0x18b github.com/matrixorigin/matrixone/pkg/sql/compile.(sqlExecutor).ExecTxn(0xc00060a820, {0x543c9e0?, 0xc008991570?}, 0xc01a90abd0, {0x1, {0x54f81f0, 0xc03db5fc08}, {0x494375a, 0xa}, 0x0, ...}) /home/yiming/workspace/performance/matrixone/pkg/sql/compile/sql_executor.go:136 +0xad github.com/matrixorigin/matrixone/pkg/incrservice.(sqlStore).Allocate(0xc0073ff580, {0x543c9e0, 0xc008991570}, 0x4287e, {0x4954827, 0x10}, 0x2710, {0x54f81f0, 0xc03db5fc08}) /home/yiming/workspace/performance/matrixone/pkg/incrservice/store_sql.go:127 +0x624 github.com/matrixorigin/matrixone/pkg/incrservice.(allocator).doAllocate(0xc00eb3c8d0, {{0x54f81f0, 0xc03db5fc08}, 0x0, 0x0, 0x4287e, {0x4954827, 0x10}, 0x2710, 0x0, ...}) /home/yiming/workspace/performance/matrixone/pkg/incrservice/allocator.go:164 +0xec github.com/matrixorigin/matrixone/pkg/incrservice.(allocator).run(0xc00eb3c8d0, {0x543c938, 0xc00eb3c900}) /home/yiming/workspace/performance/matrixone/pkg/incrservice/allocator.go:151 +0x1c5 github.com/matrixorigin/matrixone/pkg/common/stopper.(Stopper).doRunCancelableTask.func1() /home/yiming/workspace/performance/matrixone/pkg/common/stopper/stopper.go:277 +0x6e created by github.com/matrixorigin/matrixone/pkg/common/stopper.(*Stopper).doRunCancelableTask in goroutine 1670 /home/yiming/workspace/performance/matrixone/pkg/common/stopper/stopper.go:272 +0xb0

qingxinhome commented 1 month ago

对正在执行的restore语句执行cancel时, 自增列服务在内部事务中下发了一条查询sql,执行该sql时,发生空指针panic,并导致cn crash

m-schen commented 1 month ago

好像是在调整txn operator结构里的workspace过程中发生了panic

zhangxu19830126 commented 1 month ago

看上去是workspace的问题。

triump2020 commented 1 month ago

Not working on this

triump2020 commented 1 month ago

Not working on this

triump2020 commented 1 month ago

Not working on this

triump2020 commented 1 month ago

Not working on this

triump2020 commented 3 weeks ago

Not working on this

triump2020 commented 2 weeks ago

Not working on this

triump2020 commented 2 weeks ago

Not working on this

triump2020 commented 1 week ago

Working on other S-1 issues

triump2020 commented 1 week ago

Not working on this.

triump2020 commented 3 days ago

Not working on this.