oom-use-tmp-storage:哪些算子支持使用临时磁盘空间

$ find . -name '*.go'|xargs grep EnableTmpStorageOnOOM
./config/config.go:	// TempStorageQuota describe the temporary storage Quota during query exector when TiDBEnableTmpStorageOnOOM is enabled
./executor/sort.go:	if variable.EnableTmpStorageOnOOM.Load() {
./executor/aggregate.go:	if e.ctx.GetSessionVars().TrackAggregateMemoryUsage && variable.EnableTmpStorageOnOOM.Load() {
./executor/executor.go:	if variable.EnableTmpStorageOnOOM.Load() && GlobalDiskUsageTracker != nil {
./executor/join.go:	if variable.EnableTmpStorageOnOOM.Load() {
./executor/cte.go:			if val.(bool) && variable.EnableTmpStorageOnOOM.Load() {
./executor/cte.go:	if variable.EnableTmpStorageOnOOM.Load() {
./executor/merge_join.go:		if variable.EnableTmpStorageOnOOM.Load() {
./planner/core/plan_cost.go:	oomUseTmpStorage := variable.EnableTmpStorageOnOOM.Load()
./planner/core/plan_cost.go:	oomUseTmpStorage := variable.EnableTmpStorageOnOOM.Load()
./tidb-server/main.go:	if variable.EnableTmpStorageOnOOM.Load() {
./tidb-server/main.go:	// check capacity and the quota when EnableTmpStorageOnOOM is enabled
./session/bootstrap.go:	importConfigOption(s, "oom-use-tmp-storage", variable.TiDBEnableTmpStorageOnOOM, valStr)
./sessionctx/variable/tidb_vars.go:	// TiDBEnableTmpStorageOnOOM controls whether to enable the temporary storage for some operators
./sessionctx/variable/tidb_vars.go:	TiDBEnableTmpStorageOnOOM = "tidb_enable_tmp_storage_on_oom"
./sessionctx/variable/tidb_vars.go:	DefTiDBEnableTmpStorageOnOOM                   = true
./sessionctx/variable/tidb_vars.go:	EnableTmpStorageOnOOM       = atomic.NewBool(DefTiDBEnableTmpStorageOnOOM)
./sessionctx/variable/sysvar.go:	{Scope: ScopeGlobal, Name: TiDBEnableTmpStorageOnOOM, Value: BoolToOnOff(DefTiDBEnableTmpStorageOnOOM), Type: TypeBool, SetGlobal: func(s *SessionVars, val string) error {
./sessionctx/variable/sysvar.go:		EnableTmpStorageOnOOM.Store(TiDBOptOn(val))
./sessionctx/variable/sysvar.go:		return BoolToOnOff(EnableTmpStorageOnOOM.Load()), nil

grep 了一下代码,大概有以下几个算子是处理了 spill 到磁盘的

  • sort
  • hashjoin
  • hashagg
  • cte
  • mergeJoin