You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We already have a small enough tableReaderExecutorContext to be cloned. Let's figure out how to clone each fields of it:
*distsqlctx.DistSQLContext. Most of the fields in DistSQLContext is just a value and it's safe to clone. However, there are still some fields that need us to take care of:
(Clone) *tikvstore.Variables. I'm not sure why it's a pointer, maybe some fields of it will be changed during execution 🤔 .
(Optional) *stmtstats.KvExecCounter. It'll not be re-used for each statement, so it's safe to just use the reference directly.
(No) SessionMemTracker *memory.Tracker. As it always points to the memory tracker on session, so it's safe to use the reference directly.
(Optional) *execdetails.RuntimeStatsColl. It'll not be re-used, so use the reference directly is safe.
(TODO) *sqlkiller.SQLKiller.
(Optional) *execdetails.SyncExecDetails. It'll not be re-used, so it's safe to just use the reference directly.
*rangerctx.RangerContext. Most of the fields are fine. We only need to re-build it with a cloned WarnHandler. We'll discuss WarnHandler field later.
*planctx.BuildPBContext.
AppendWarning and AppendExtraWarning. We'll need to refactor them into the WarnHandler before considering clone it.
(Clone) isctx.MetaOnlyInfoSchema. The base of MetaOnlyInfoSchema is returned from vars.SnapshotInfoschema. It's not safe to use by different statements concurrently. Therefore, it'll need to be cloned.
(No) getDDLOwner. The current implementation of getDDLOwner only depends on ownerManager (of ddl), which is safe to be used in multiple statements.
Fields which are used across many contexts
Warnhandler. It's widely used in errctx, typectx and many other contexts, which means that we'll need to re-build all these contexts according to the dependency.
kv.Client. TODO. I'm not sure whether it can be used in parallel statement safely.
The text was updated successfully, but these errors were encountered:
Enhancement
We already have a small enough
tableReaderExecutorContext
to be cloned. Let's figure out how to clone each fields of it:*distsqlctx.DistSQLContext
. Most of the fields inDistSQLContext
is just a value and it's safe to clone. However, there are still some fields that need us to take care of:*tikvstore.Variables
. I'm not sure why it's a pointer, maybe some fields of it will be changed during execution 🤔 .*stmtstats.KvExecCounter
. It'll not be re-used for each statement, so it's safe to just use the reference directly.SessionMemTracker *memory.Tracker
. As it always points to the memory tracker on session, so it's safe to use the reference directly.*execdetails.RuntimeStatsColl
. It'll not be re-used, so use the reference directly is safe.*sqlkiller.SQLKiller
.*execdetails.SyncExecDetails
. It'll not be re-used, so it's safe to just use the reference directly.*rangerctx.RangerContext
. Most of the fields are fine. We only need to re-build it with a clonedWarnHandler
. We'll discussWarnHandler
field later.*planctx.BuildPBContext
.AppendWarning
andAppendExtraWarning
. We'll need to refactor them into theWarnHandler
before considering clone it.exprctx.BuildContext
. We already haveStaticEvalContext
https://github.com/pingcap/tidb/pull/52631/filesisctx.MetaOnlyInfoSchema
. The base ofMetaOnlyInfoSchema
is returned fromvars.SnapshotInfoschema
. It's not safe to use by different statements concurrently. Therefore, it'll need to be cloned.getDDLOwner
. The current implementation ofgetDDLOwner
only depends onownerManager
(ofddl
), which is safe to be used in multiple statements.Fields which are used across many contexts
Warnhandler
. It's widely used inerrctx
,typectx
and many other contexts, which means that we'll need to re-build all these contexts according to the dependency.kv.Client
. TODO. I'm not sure whether it can be used in parallel statement safely.The text was updated successfully, but these errors were encountered: