Repository navigation
Closed
Labels
kind/bugSomething isn't workingphase/testingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Milestone
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Other Environment Information
- Hardware parameters:
- OS type:
- Others:Actual Behavior
MO Regression On TKE Failed after #14871
https://github.com/matrixorigin/matrixone/actions/runs/8245287678/job/22549973813
2024-03-12 08:29:29 FATAL jTPCCTerminal:212 - [UNEXPECTED][TT_PAYMENT][EXECUTION] ErrorCode : 20101, ErrorMessage : internal error: panic counter cannot decrease in value:
github.com/matrixorigin/matrixone/pkg/util/metric.(*ratecounter).Add
/go/src/github.com/matrixorigin/matrixone/pkg/util/metric/mtype_counter.go:106
github.com/matrixorigin/matrixone/pkg/util/trace/impl/motrace.EndStatement
/go/src/github.com/matrixorigin/matrixone/pkg/util/trace/impl/motrace/report_statement.go:595
github.com/matrixorigin/matrixone/pkg/frontend.logStatementStringStatus
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/util.go:517
github.com/matrixorigin/matrixone/pkg/frontend.logStatementStatus
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/util.go:504
github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).executeStmt.func1
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:3200
github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).executeStmt.func4
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:3263
github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).executeStmt.func5
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:3275
github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).executeStmt
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:4165
github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).doComQuery
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:4371
github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).ExecRequest
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:4607
github.com/matrixorigin/matrixone/pkg/frontend.(*Routine).handleRequest
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/routine.go:284
github.com/matrixorigin/matrixone/pkg/frontend.(*RoutineManager).Handler
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/routine_manager.go:541
github.com/matrixorigin/matrixone/pkg/frontend.(*MOServer).handleMessage
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/server.go:145
github.com/fagongzi/goetty/v2.(*server).doStart.func2.1
/go/pkg/mod/github.com/matrixorigin/goetty/[email protected]/application.go:356
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1650
Expected Behavior
Steps to Reproduce
1. run action [MO Checkin Regression On TKE](https://github.com/matrixorigin/matrixone/actions/workflows/merge-trigger-tke.yaml)Additional information
No response
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingphase/testingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.

Activity
xzxiong commentedon Mar 12, 2024
取值远远没有越界
http://175.178.192.213:30088/explore?panes=%7B%22kPb%22:%7B%22datasource%22:%22prometheus%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22sum%20by%28account,%20sql_source_type%29%20%28sql_statement_cu%7Bnamespace%3D%5C%22mo-checkin-regression-14871%5C%22,%20matrixorigin_io_component%3D%5C%22CNSet%5C%22%7D%29%22,%22range%22:true,%22instant%22:true,%22datasource%22:%7B%22type%22:%22prometheus%22,%22uid%22:%22prometheus%22%7D,%22editorMode%22:%22builder%22,%22legendFormat%22:%22__auto%22,%22useBackend%22:false,%22disableTextWrap%22:false,%22fullMetaSearch%22:false,%22includeNullMetadata%22:true%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1
xzxiong commentedon Mar 12, 2024
原因:exec_plan 统计的 cpu 时间为 负数,导致 cu 计算为负数
复现方法:
note info for matrixorigin#14926, wait revert
xzxiong commentedon Mar 12, 2024
结论:statsInfo.IOAccessTimeConsumption 和 statsInfo.LockTimeConsumption 远大于 ExecPlan中统计的 cpu耗时
导致 CPU 计算出来的 CU 小于 0.
debug 代码
xzxiong commentedon Mar 12, 2024
@Morranto @ouyuanning ptal
[-][Bug]: MO Regression On TKE Failed after #14871[/-][+][Bug]: Cpu CU value < 0[/+][-][Bug]: Cpu CU value < 0[/-][+][Bug]: Cpu Time statistics value less then 0[/+]45 remaining items
qingxinhome commentedon Aug 22, 2024
analzye代码重构中
qingxinhome commentedon Aug 27, 2024
analzye代码重构中
qingxinhome commentedon Sep 10, 2024
算子分析器重构pr已合并,后期观察该问题是否仍然存在
qingxinhome commentedon Sep 18, 2024
经过explain分析发现,CPU时间的计算来自于如下部分:
1.物理计划执行的时间(pipeline算子执行)
2.SQL Parse时间
3.Compile 物理计划的时间
但是其中可能包含IO的时间,因此最后需要减去其中的IO时间,如下所示
val := int64(statsByte.GetTimeConsumed()) + statsInfo.BuildReaderDuration +
int64(statsInfo.ParseDuration+
statsInfo.CompileDuration+
statsInfo.PlanDuration) - (statsInfo.IOAccessTimeConsumption + statsInfo.IOMergerTimeConsumption())
但是系统IO时间的采集,是在Compile.Run开始执行时作为起始时间, Compile.Run执行结束作为结束时间,
我们默认这中间都是pipeline算子的执行时间,这么想是错误的,
因为我们物理计划可能会做并行化展开,其中会buildReader并执行disttae.Ranges()
该操作可能触发tae从S3读数据到cached中,从而产生 IO等待,这部分时间没有做排除,会导致最终的cpu时间小于0
qingxinhome commentedon Sep 18, 2024
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:26 +0x5e
github.com/matrixorigin/matrixone/pkg/fileservice.(*LocalFS).Read.func4()
/home/yiming/workspace/matrixone/pkg/fileservice/local_fs.go:376 +0x50
github.com/matrixorigin/matrixone/pkg/fileservice.(*LocalFS).Read(0xc00a150180, {0x55f7030, 0xc064b53220}, 0xc064b68000)
/home/yiming/workspace/matrixone/pkg/fileservice/local_fs.go:419 +0xeb1
github.com/matrixorigin/matrixone/pkg/objectio.ReadExtent({0x55f7030, 0xc064b53220}, {0xc037cefbf0, 0x2a}, 0xc0403ee160, 0x10, {0x5653960, 0xc00a150180}, 0x4f3fe50)
/home/yiming/workspace/matrixone/pkg/objectio/funcs.go:57 +0x211
github.com/matrixorigin/matrixone/pkg/objectio.ReadBloomFilter({0x55f7030?, 0xc064b53220?}, {0xc037cefbf0?, 0xc001128008?}, 0x56b9b00?, 0xff6eb1cf49f0d5bb?, {0x5653960?, 0xc00a150180?})
/home/yiming/workspace/matrixone/pkg/objectio/funcs.go:82 +0x3d
github.com/matrixorigin/matrixone/pkg/objectio.LoadBFWithMeta({0x55f7030, 0xc064b53220}, {0xc031194026, 0xc00a150180?, 0x10f77}, {0xc0403ee1e3, 0x22134c5?, 0x4f}, {0x5653960, 0xc00a150180})
/home/yiming/workspace/matrixone/pkg/objectio/cache.go:172 +0x1be
github.com/matrixorigin/matrixone/pkg/vm/engine/engine_util.init.0.func1.1({0x55f7030?, 0xc064b53220?}, 0x305f666665363162?, {0x0?, 0x10f9d00001fe400?, 0x7b000f424000?}, {0x0?, 0x0?, 0x0?})
/home/yiming/workspace/matrixone/pkg/vm/engine/engine_util/expr_filter.go:63 +0x2bd
github.com/matrixorigin/matrixone/pkg/vm/engine/engine_util.FilterObjects.func1(0xc021872000)
/home/yiming/workspace/matrixone/pkg/vm/engine/engine_util/exec_util.go:100 +0x193
github.com/matrixorigin/matrixone/pkg/vm/engine/engine_util.ForeachObjectsExecute(0xc0403ee6e0, 0xc0403ee878, {0x0?, 0xc0202ccf58?, 0x30?}, {0x0, 0x0, 0xc03bb83900?})
/home/yiming/workspace/matrixone/pkg/vm/engine/engine_util/exec_util.go:48 +0x3c8
github.com/matrixorigin/matrixone/pkg/vm/engine/engine_util.FilterObjects({0x55f7030?, 0xc064b53220?}, 0x53387d?, 0x4dbd7bd?, 0xa7ddfab06?, 0x83f39a0?, 0x7f85b5813848?, 0x30?, {0x0, 0x0, ...}, ...)
/home/yiming/workspace/matrixone/pkg/vm/engine/engine_util/exec_util.go:167 +0x16c
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.FilterTxnObjects({0x55f7030?, 0xc064b53220?}, 0x0?, {0x17f64d69620b6762, 0x1, 0x0, {}, {0x0, 0x0, 0x0}, ...}, ...)
/home/yiming/workspace/matrixone/pkg/vm/engine/disttae/filter.go:119 +0x1ba
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.TryFastFilterBlocks({0x55f7030, 0xc064b53220}, 0xc0233a41a0, {0x17f64d69620b6762, 0x1, 0x0, {}, {0x0, 0x0, 0x0}, ...}, ...)
/home/yiming/workspace/matrixone/pkg/vm/engine/disttae/filter.go:49 +0x165
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(*txnTable).rangesOnePart(0xc0233a41a0, {0x55f7030, 0xc064b53220}, 0xc0167ac000, 0xc021d6ed80, {0xc0202ccf60, 0x1, 0x1}, 0xc0403eee20, 0xc02b1e5940, ...)
/home/yiming/workspace/matrixone/pkg/vm/engine/disttae/txn_table.go:706 +0x1f7
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(*txnTable).doRanges(0xc0233a41a0, {0x55f7030, 0xc064b53220}, {0xc0202ccf60, 0x1, 0x1}, {0x0, 0x0, 0x0})
/home/yiming/workspace/matrixone/pkg/vm/engine/disttae/txn_table.go:656 +0x365
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(*txnTable).Ranges(0xc0233a41a0, {0x55f7030, 0xc064b53220}, {0xc0202ccf60, 0x1, 0x1}, 0xc064b533b0?)
/home/yiming/workspace/matrixone/pkg/vm/engine/disttae/txn_table.go:559 +0x66
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(*txnTableDelegate).Ranges(0xc044d1d940, {0x55f7030, 0xc064b53220}, {0xc0202ccf60, 0x1, 0x1}, 0x0)
/home/yiming/workspace/matrixone/pkg/vm/engine/disttae/txn_table_sharding.go:247 +0x145
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Compile).expandRanges(0xc00f5a7200, 0xc02cdb0008, {0x56baee0, 0xc044d1d940}, {0xc0202ccf60, 0x1, 0x1})
/home/yiming/workspace/matrixone/pkg/sql/compile/compile.go:3767 +0x84c
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Scope).handleRuntimeFilter(0xc00a2dab60, 0xc00f5a7200)
/home/yiming/workspace/matrixone/pkg/sql/compile/scope.go:562 +0x77a
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Scope).buildReaders(0xc00a2dab60, 0xc00f5a7200)
/home/yiming/workspace/matrixone/pkg/sql/compile/scope.go:765 +0x32
github.com/matrixorigin/matrixone/pkg/sql/compile.buildScanParallelRun(0xc00a2dab60, 0xc00f5a7200)
/home/yiming/workspace/matrixone/pkg/sql/compile/scope.go:438 +0xd0
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Scope).ParallelRun(0xc00a2dab60, 0xc00f5a7200)
/home/yiming/workspace/matrixone/pkg/sql/compile/scope.go:392 +0xef
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Scope).MergeRun(0xc00a2dab60, 0xc00f5a7200)
/home/yiming/workspace/matrixone/pkg/sql/compile/scope.go:286 +0x2af
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Scope).RemoteRun(0xc00a2dab60, 0xc00f5a7200)
/home/yiming/workspace/matrixone/pkg/sql/compile/scope.go:328 +0x368
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Compile).run(0xc00f5a7200, 0xc00a2dab60)
/home/yiming/workspace/matrixone/pkg/sql/compile/compile.go:319 +0x8b
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Compile).runOnce.func2()
/home/yiming/workspace/matrixone/pkg/sql/compile/compile.go:457 +0x65
github.com/panjf2000/ants/v2.(*goWorker).run.func1()
/home/yiming/workspace/matrixone/vendor/github.com/panjf2000/ants/v2/worker.go:67 +0x8a
created by github.com/panjf2000/ants/v2.(*goWorker).run in goroutine 1905
/home/yiming/workspace/matrixone/vendor/github.com/panjf2000/ants/v2/worker.go:48 +0x5c
xzxiong commentedon Sep 19, 2024
我理解一下:
statsInfo.BuildReaderDuration,补充算子的调度阶段的cpu消耗。Compile::run()),会调用 BuildReader 加载obj的元数据(例如 bloomfilter),会发生io读写算子的运行阶段,未统计算子的调度阶段的消耗。算子的调度也需要进行统计,目前仅针对 负值 的问题进行bugfixqingxinhome commentedon Sep 19, 2024
用户下发的DQL+DML语句 cu计算cpu时间出现负值问题已经解决; DDL语句执行可能会走内部执行器,其cu计费功能下个阶段作为featrure进行支持
qingxinhome commentedon Sep 21, 2024
该问题已经处理,建议关闭 @xzxiong @sukki37 @daviszhen
xzxiong commentedon Sep 21, 2024
@aressu1985 ptal