Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Apr 17, 2023
1 parent 29075d8 commit 876583e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions planner/core/plan_cache_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,10 @@ type planCacheKey struct {
// Hash implements Key interface.
func (key *planCacheKey) Hash() []byte {
if len(key.hash) == 0 {
var (
dbBytes = hack.Slice(key.stmtText)
bufferSize = len(dbBytes) * 2
)
if key.hash == nil {
key.hash = make([]byte, 0, bufferSize)
key.hash = make([]byte, 0, len(key.stmtText)*2)
}
key.hash = append(key.hash, dbBytes...)
key.hash = append(key.hash, hack.Slice(key.database)...)
key.hash = codec.EncodeInt(key.hash, int64(key.connID))
key.hash = append(key.hash, hack.Slice(key.stmtText)...)
key.hash = codec.EncodeInt(key.hash, key.schemaVersion)
Expand Down

0 comments on commit 876583e

Please sign in to comment.