Skip to content

Commit

Permalink
cache: use the legacy LRU cache by default
Browse files Browse the repository at this point in the history
Signed-off-by: Vicent Marti <[email protected]>
  • Loading branch information
vmg committed Feb 3, 2021
1 parent 7c0c56f commit f7ad521
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions go/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion go/vt/vttablet/tabletserver/query_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"testing"
"time"

"vitess.io/vitess/go/cache"
"vitess.io/vitess/go/streamlog"

"vitess.io/vitess/go/mysql/fakesqldb"
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletserver/tabletenv/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ hotRowProtection:
maxGlobalQueueSize: 1000
maxQueueSize: 20
mode: disable
lfuQueryCacheSizeBytes: 67108864
messagePostponeParallelism: 4
olapReadPool:
idleTimeoutSeconds: 1800
Expand All @@ -132,6 +131,7 @@ oltpReadPool:
idleTimeoutSeconds: 1800
maxWaiters: 5000
size: 16
queryCacheSize: 5000
replicationTracker:
heartbeatIntervalSeconds: 0.25
mode: disable
Expand Down

0 comments on commit f7ad521

Please sign in to comment.