connect the context.Context in modules (frontend,metric and trace) (#4494)
In previous design, there is not context.Context going through the frontend and the computation engine. In 0.6, the computation engine introduces the context.Context. So, I add the context.Context in the frontend and try to connect context.Context with modules -- metric and trace. I am not sure the usage of the conext.Context in these modules is right. So I propose the PR. The hierarchy of the context.Context: ``` rootCtx(context.Background) | | WithCancel() | | \|/ cancelMoServerCtx | | WithValue(configuration) | | moServerCtx | | ----------------------------> context in metric, trace | | \|/ cancelRoutineCtx (every network connection has an independent context) | | ------> WithCancel----->AuthenticateCtx (login authentication -- user, password, role) | | cancelRequestCtx (every request from the client has a new context) | | -------> WithCancel ------> LoadBatchCtx ( every batch has a independent context) ``` Approved by: @fengttt, @yingfeng, @aptend
Showing
- cmd/db-server/main.go 16 additions, 7 deletionscmd/db-server/main.go
- go.mod 1 addition, 1 deletiongo.mod
- go.sum 2 additions, 2 deletionsgo.sum
- pkg/config/configuration.go 16 additions, 0 deletionspkg/config/configuration.go
- pkg/frontend/cmd_executor.go 3 additions, 1 deletionpkg/frontend/cmd_executor.go
- pkg/frontend/init_db.go 7 additions, 13 deletionspkg/frontend/init_db.go
- pkg/frontend/internal_executor.go 6 additions, 5 deletionspkg/frontend/internal_executor.go
- pkg/frontend/internal_executor_test.go 4 additions, 3 deletionspkg/frontend/internal_executor_test.go
- pkg/frontend/load.go 99 additions, 55 deletionspkg/frontend/load.go
- pkg/frontend/load_test.go 13 additions, 10 deletionspkg/frontend/load_test.go
- pkg/frontend/mysql_cmd_executor.go 51 additions, 54 deletionspkg/frontend/mysql_cmd_executor.go
- pkg/frontend/mysql_cmd_executor_test.go 13 additions, 13 deletionspkg/frontend/mysql_cmd_executor_test.go
- pkg/frontend/mysql_protocol_test.go 4 additions, 3 deletionspkg/frontend/mysql_protocol_test.go
- pkg/frontend/routine.go 26 additions, 21 deletionspkg/frontend/routine.go
- pkg/frontend/routine_manager.go 6 additions, 2 deletionspkg/frontend/routine_manager.go
- pkg/frontend/routine_manager_test.go 3 additions, 1 deletionpkg/frontend/routine_manager_test.go
- pkg/frontend/server.go 3 additions, 2 deletionspkg/frontend/server.go
- pkg/frontend/session.go 46 additions, 13 deletionspkg/frontend/session.go
- pkg/frontend/test/iosession_mock.go 1 addition, 1 deletionpkg/frontend/test/iosession_mock.go
- pkg/frontend/test/types_mock.go 2 additions, 1 deletionpkg/frontend/test/types_mock.go
... | ... | @@ -24,7 +24,7 @@ require ( |
github.com/lni/dragonboat/v4 v4.0.0-20220803152440-a83f853de8b1 | ||
github.com/lni/goutils v1.3.1-0.20220604063047-388d67b4dbc4 | ||
github.com/matrixorigin/matrixcube v0.3.1-0.20220606032431-c944d801f1e5 | ||
github.com/matrixorigin/simdcsv v0.0.0-20210926114300-591bf748a770 | ||
github.com/matrixorigin/simdcsv v0.0.0-20220815110641-d4a2c7888f52 | ||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 | ||
github.com/panjf2000/ants/v2 v2.4.6 | ||
github.com/pierrec/lz4/v4 v4.1.14 | ||
... | ... |
Please register or sign in to comment