Skip to content

Commit

Permalink
cache: review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Vicent Marti <[email protected]>
  • Loading branch information
vmg committed Feb 5, 2021
1 parent 915e019 commit 431da53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions go/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ type cachedObject interface {
CachedSize(alloc bool) int64
}

// NewDefaultCacheImpl returns the default cache implementation for Vitess. If the given capacity
// is given in bytes, the implementation will be LFU-based and keep track of the total memory usage
// for the cache. If the implementation is given in entries, the legacy LRU implementation will be used,
// keeping track
// NewDefaultCacheImpl returns the default cache implementation for Vitess. The options in the
// Config struct control the memory and entry limits for the cache, and the underlying cache
// implementation.
func NewDefaultCacheImpl(cfg *Config) Cache {
switch {
case cfg == nil || (cfg.MaxEntries == 0 && cfg.MaxMemoryUsage == 0):
Expand Down
4 changes: 1 addition & 3 deletions go/vt/vtgate/planbuilder/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,7 @@ func BenchmarkSelectVsDML(b *testing.B) {
var selectCases []testCase

for tc := range iterateExecFile("dml_cases.txt") {
if tc.output2ndPlanner != "" {
dmlCases = append(dmlCases, tc)
}
dmlCases = append(dmlCases, tc)
}

for tc := range iterateExecFile("select_cases.txt") {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/endtoend/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestConsolidatorReplicasOnly(t *testing.T) {
}

func TestQueryPlanCache(t *testing.T) {
if cache.DefaultCacheSize.Bytes() != 0 {
if cache.DefaultConfig.LFU {
const cacheItemSize = 40
const cachedPlanSize = 2275 + cacheItemSize
const cachePlanSize2 = 2254 + cacheItemSize
Expand Down

0 comments on commit 431da53

Please sign in to comment.