Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
wshwsh12 committed Sep 27, 2022
1 parent fedca3e commit 774c0de
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"runtime"
"strconv"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -6149,11 +6150,17 @@ func TestGlobalMemoryControl2(t *testing.T) {
}

var test []int
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
test = make([]int, 128<<20) // Keep 1GB
time.Sleep(100 * time.Millisecond) // Make sure the sql is running.
test = make([]int, 128<<20) // Keep 1GB HeapInuse
wg.Done()
}()
sql := "select * from t t1 join t t2 join t t3 on t1.a=t2.a and t1.a=t3.a order by t1.a;" // Need 500MB
require.True(t, strings.Contains(tk0.QueryToErr(sql).Error(), "Out Of Memory Quota!"))
require.Equal(t, tk0.Session().GetSessionVars().StmtCtx.DiskTracker.MaxConsumed(), int64(0))
wg.Wait()
test[0] = 0
runtime.GC()
}

0 comments on commit 774c0de

Please sign in to comment.