tidb: github.com/pingcap/tidb/bindinfo Index | Files

package bindinfo

import "github.com/pingcap/tidb/bindinfo"

Index

Package Files

bind.go cache.go handle.go session_handle.go

Constants

const (
    // Using is the bind info's in use status.
    Using = "using"

    // Invalid is the bind info's invalid status.
    Invalid = "invalid"
)
const SessionBindInfoKeyType sessionBindInfoKeyType = 0

SessionBindInfoKeyType is a variable key for store session bind info.

Variables

var Lease = 3 * time.Second

Lease influences the duration of loading bind info and handling invalid bind.

func BindHint Uses

func BindHint(stmt ast.StmtNode, hintsSet *HintsSet) ast.StmtNode

BindHint will add hints for stmt according to the hints in `hintsSet`.

type BindHandle Uses

type BindHandle struct {
    // contains filtered or unexported fields
}

BindHandle is used to handle all global sql bind operations.

func NewBindHandle Uses

func NewBindHandle(ctx sessionctx.Context) *BindHandle

NewBindHandle creates a new BindHandle.

func (*BindHandle) AddBindRecord Uses

func (h *BindHandle) AddBindRecord(record *BindRecord) (err error)

AddBindRecord adds a BindRecord to the storage and BindMeta to the cache.

func (*BindHandle) AddDropInvalidBindTask Uses

func (h *BindHandle) AddDropInvalidBindTask(invalidBindRecord *BindRecord)

AddDropInvalidBindTask add bindRecord to invalidBindRecordMap when the bindRecord need to be deleted.

func (*BindHandle) DropBindRecord Uses

func (h *BindHandle) DropBindRecord(record *BindRecord) (err error)

DropBindRecord drops a BindRecord to the storage and BindMeta int the cache.

func (*BindHandle) DropInvalidBindRecord Uses

func (h *BindHandle) DropInvalidBindRecord()

DropInvalidBindRecord execute the drop bindRecord task.

func (*BindHandle) GetAllBindRecord Uses

func (h *BindHandle) GetAllBindRecord() (bindRecords []*BindMeta)

GetAllBindRecord return all bind record in cache.

func (*BindHandle) GetBindRecord Uses

func (h *BindHandle) GetBindRecord(hash, normdOrigSQL, db string) *BindMeta

GetBindRecord return the bindMeta of the (normdOrigSQL,db) if bindMeta exist.

func (*BindHandle) Size Uses

func (h *BindHandle) Size() int

Size return the size of bind info cache.

func (*BindHandle) Update Uses

func (h *BindHandle) Update(fullLoad bool) (err error)

Update updates the global sql bind cache.

type BindMeta Uses

type BindMeta struct {
    *BindRecord
    // HintSet stores the set of hints of binding sql.
    *HintsSet
}

BindMeta stores the basic bind info and bindSql astNode.

type BindRecord Uses

type BindRecord struct {
    OriginalSQL string
    BindSQL     string
    Db          string
    // Status represents the status of the binding. It can only be one of the following values:
    // 1. deleted: BindRecord is deleted, can not be used anymore.
    // 2. using: BindRecord is in the normal active mode.
    Status     string
    CreateTime types.Time
    UpdateTime types.Time
    Charset    string
    Collation  string
}

BindRecord represents a sql bind record retrieved from the storage.

type HintsSet Uses

type HintsSet struct {
    // contains filtered or unexported fields
}

HintsSet contains all hints of a query.

func CollectHint Uses

func CollectHint(in ast.StmtNode) *HintsSet

CollectHint collects hints for a statement.

type SessionHandle Uses

type SessionHandle struct {
    // contains filtered or unexported fields
}

SessionHandle is used to handle all session sql bind operations.

func NewSessionBindHandle Uses

func NewSessionBindHandle(parser *parser.Parser) *SessionHandle

NewSessionBindHandle creates a new SessionBindHandle.

func (*SessionHandle) AddBindRecord Uses

func (h *SessionHandle) AddBindRecord(record *BindRecord) error

AddBindRecord new a BindRecord with BindMeta, add it to the cache.

func (*SessionHandle) Close Uses

func (h *SessionHandle) Close()

Close closes the session handle.

func (*SessionHandle) DropBindRecord Uses

func (h *SessionHandle) DropBindRecord(record *BindRecord)

DropBindRecord drops a BindRecord in the cache.

func (*SessionHandle) GetAllBindRecord Uses

func (h *SessionHandle) GetAllBindRecord() (bindRecords []*BindMeta)

GetAllBindRecord return all session bind info.

func (*SessionHandle) GetBindRecord Uses

func (h *SessionHandle) GetBindRecord(normdOrigSQL, db string) *BindMeta

GetBindRecord return the BindMeta of the (normdOrigSQL,db) if BindMeta exist.

Package bindinfo imports 18 packages (graph) and is imported by 10 packages. Updated 2019-09-16. Refresh now. Tools for package owners.