diff --git a/go/cache/cache.go b/go/cache/cache.go index eaf51f43498..fae67d4d762 100644 --- a/go/cache/cache.go +++ b/go/cache/cache.go @@ -27,9 +27,9 @@ package cache // Regardless of the default value used here, the user can always override Vitess' configuration to // force a specific cache type (e.g. when passing a value in ENTRIES to vtgate, the service will use // a LRU cache). -const DefaultCacheSize = SizeInBytes(64 * 1024 * 1024) +const DefaultCacheSize = SizeInEntries(5000) -// const DefaultCacheSize = SizeInEntries(10000) +// const DefaultCacheSize = SizeInBytes(64 * 1024 * 1024) // Cache is a generic interface type for a data structure that keeps recently used // objects in memory and evicts them when it becomes full. diff --git a/go/vt/vttablet/tabletserver/query_engine_test.go b/go/vt/vttablet/tabletserver/query_engine_test.go index d597aa9475c..cdd6893dced 100644 --- a/go/vt/vttablet/tabletserver/query_engine_test.go +++ b/go/vt/vttablet/tabletserver/query_engine_test.go @@ -26,6 +26,7 @@ import ( "testing" "time" + "vitess.io/vitess/go/cache" "vitess.io/vitess/go/streamlog" "vitess.io/vitess/go/mysql/fakesqldb" @@ -166,7 +167,11 @@ func TestQueryPlanCache(t *testing.T) { ctx := context.Background() logStats := tabletenv.NewLogStats(ctx, "GetPlanStats") - qe.SetQueryPlanCacheCap(1024) + if cache.DefaultCacheSize.Bytes() != 0 { + qe.SetQueryPlanCacheCap(1024) + } else { + qe.SetQueryPlanCacheCap(1) + } firstPlan, err := qe.GetPlan(ctx, logStats, firstQuery, false, false /* inReservedConn */) if err != nil { t.Fatal(err) diff --git a/go/vt/vttablet/tabletserver/tabletenv/config_test.go b/go/vt/vttablet/tabletserver/tabletenv/config_test.go index aecfbc18e25..2fadf975929 100644 --- a/go/vt/vttablet/tabletserver/tabletenv/config_test.go +++ b/go/vt/vttablet/tabletserver/tabletenv/config_test.go @@ -119,7 +119,6 @@ hotRowProtection: maxGlobalQueueSize: 1000 maxQueueSize: 20 mode: disable -lfuQueryCacheSizeBytes: 67108864 messagePostponeParallelism: 4 olapReadPool: idleTimeoutSeconds: 1800 @@ -132,6 +131,7 @@ oltpReadPool: idleTimeoutSeconds: 1800 maxWaiters: 5000 size: 16 +queryCacheSize: 5000 replicationTracker: heartbeatIntervalSeconds: 0.25 mode: disable