Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go/cache/lru_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (lru *LRUCache) Oldest() (oldest time.Time) {
}

// Keys returns all the keys for the cache, ordered from most recently
// used to last recently used.
// used to least recently used.
func (lru *LRUCache) Keys() []string {
lru.mu.Lock()
defer lru.mu.Unlock()
Expand All @@ -235,7 +235,7 @@ func (lru *LRUCache) Keys() []string {
}

// Items returns all the values for the cache, ordered from most recently
// used to last recently used.
// used to least recently used.
func (lru *LRUCache) Items() []Item {
lru.mu.Lock()
defer lru.mu.Unlock()
Expand Down
22 changes: 8 additions & 14 deletions go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1345,20 +1345,15 @@ func (e *Executor) ServeHTTP(response http.ResponseWriter, request *http.Request
return
}
if request.URL.Path == "/debug/query_plans" {
keys := e.plans.Keys()
response.Header().Set("Content-Type", "text/plain")
response.Write([]byte(fmt.Sprintf("Length: %d\n", len(keys))))
for _, v := range keys {
response.Write([]byte(fmt.Sprintf("%#v\n", sqlparser.TruncateForUI(v))))
if plan, ok := e.plans.Peek(v); ok {
if b, err := json.MarshalIndent(plan, "", " "); err != nil {
response.Write([]byte(err.Error()))
} else {
response.Write(b)
}
response.Write(([]byte)("\n\n"))
}
response.Header().Set("Content-Type", "application/json; charset=utf-8")
buf, err := json.MarshalIndent(e.plans.Items(), "", " ")
if err != nil {
response.Write([]byte(err.Error()))
return
}
ebuf := bytes.NewBuffer(nil)
json.HTMLEscape(ebuf, buf)
response.Write(ebuf.Bytes())
} else if request.URL.Path == "/debug/vschema" {
response.Header().Set("Content-Type", "application/json; charset=utf-8")
b, err := json.MarshalIndent(e.VSchema(), "", " ")
Expand All @@ -1384,7 +1379,6 @@ func (e *Executor) updateQueryCounts(planType, keyspace, tableName string, shard
queriesRouted.Add(planType, shardQueries)
queriesProcessedByTable.Add([]string{planType, keyspace, tableName}, 1)
queriesRoutedByTable.Add([]string{planType, keyspace, tableName}, shardQueries)
return
}

// VSchemaStats returns the loaded vschema stats.
Expand Down