data

package
v0.0.0-...-1390f1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForeachSQLQuery

func ForeachSQLQuery(loader IteratorLoader, f func(Query) error) error

ForeachSQLQuery reads a query log file and calls the provided function for each normal SQL query in the log. If the query log contains directives, they will be read and queries will be skipped as necessary.

func GetKeyspaces

func GetKeyspaces(vschemaFile, vtexplainVschemaFile, keyspaceName string, sharded bool) (keyspaces []*cluster.Keyspace, vschema *vindexes.VSchema, err error)

Types

type CSVConfig

type CSVConfig struct {
	Header bool

	QueryField        int
	ConnectionIDField *int
	QueryTimeField    *int
	LockTimeField     *int
	RowsSentField     *int
	RowsExaminedField *int
	TimestampField    *int
}

type CSVLogLoader

type CSVLogLoader struct {
	Config CSVConfig
}

func (CSVLogLoader) Load

func (c CSVLogLoader) Load(fileName string) IteratorLoader

type CmdType

type CmdType int
const (
	SQLQuery CmdType = iota
	Error
	Skip
	Unknown
	Comment
	CommentWithCommand
	EmptyLine
	SkipIfBelowVersion
	VExplain
	WaitForAuthoritative
	VitessOnly
	MysqlOnly
	Reference
	UsageCount
)

func FindType

func FindType(cmdName string) CmdType

func (CmdType) String

func (cmd CmdType) String() string

type FileType

type FileType int
const (
	UnknownFile FileType = iota
	TraceFile
	KeysFile
	DBInfoFile
	TransactionFile
	PlanalyzeFile
)

func GetFileType

func GetFileType(filename string) (FileType, error)

GetFileType reads the first key-value pair from a JSON file and returns the type of the file Note:

type IteratorLoader

type IteratorLoader interface {
	// Next returns the next query in the log file. The boolean return value is false if there are no more queries.
	Next() (Query, bool)

	// Close closes the iterator. If any errors have been accumulated, they are returned here.
	Close() error
}

type Loader

type Loader interface {
	Load(filename string) IteratorLoader
}

type MySQLLogLoader

type MySQLLogLoader struct{}

func (MySQLLogLoader) Load

func (MySQLLogLoader) Load(fileName string) IteratorLoader

type Query

type Query struct {
	FirstWord  string
	Query      string
	Line       int
	Type       CmdType
	UsageCount int

	// These fields are only set if the log file is a slow query log
	ConnectionID           int
	QueryTime, LockTime    float64
	RowsSent, RowsExamined int
	Timestamp              int64
}

type RawKeyspaceVindex

type RawKeyspaceVindex struct {
	Keyspaces map[string]interface{} `json:"keyspaces"`
}

func ReadVschema

func ReadVschema(file string, vtexplain bool) (RawKeyspaceVindex, *vindexes.VSchema, error)

type SlowQueryLogLoader

type SlowQueryLogLoader struct{}

func (SlowQueryLogLoader) Load

func (SlowQueryLogLoader) Load(filename string) IteratorLoader

type VtGateLogLoader

type VtGateLogLoader struct {
	NeedsBindVars bool
}

func (VtGateLogLoader) Load

func (vll VtGateLogLoader) Load(fileName string) IteratorLoader

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL