tikvhandler

package
v1.1.0-beta.0...-0c22a2d Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// OpTableRegions is the operation for getting regions of a table.
	OpTableRegions = "regions"
	// OpTableRanges is the operation for getting ranges of a table.
	OpTableRanges = "ranges"
	// OpTableDiskUsage is the operation for getting disk usage of a table.
	OpTableDiskUsage = "disk-usage"
	// OpTableScatter is the operation for scattering a table.
	OpTableScatter = "scatter-table"
	// OpStopTableScatter is the operation for stopping scattering a table.
	OpStopTableScatter = "stop-scatter-table"
)
View Source
const (
	// OpMvccGetByHex is the operation for getting mvcc value by hex format.
	OpMvccGetByHex = "hex"
	// OpMvccGetByKey is the operation for getting mvcc value by key.
	OpMvccGetByKey = "key"
	// OpMvccGetByIdx is the operation for getting mvcc value by idx.
	OpMvccGetByIdx = "idx"
	// OpMvccGetByTxn is the operation for getting mvcc value by txn.
	OpMvccGetByTxn = "txn"
)

Variables

This section is empty.

Functions

func WriteDBTablesData

func WriteDBTablesData(w http.ResponseWriter, tbs []*model.TableInfo)

WriteDBTablesData writes all the table data in a database. The format is the marshal result of []*model.TableInfo, you can unmarshal it to []*model.TableInfo.

Note: It would return StatusOK even if errors occur. But if errors occur, there must be some bugs.

Types

type AllServerInfoHandler

type AllServerInfoHandler struct {
	*handler.TikvHandlerTool
}

AllServerInfoHandler is the handler for getting all servers information.

func NewAllServerInfoHandler

func NewAllServerInfoHandler(tool *handler.TikvHandlerTool) *AllServerInfoHandler

NewAllServerInfoHandler creates a new AllServerInfoHandler.

func (AllServerInfoHandler) ServeHTTP

ServeHTTP handles request of all ddl servers info.

type ClusterServerInfo

type ClusterServerInfo struct {
	ServersNum                   int                             `json:"servers_num,omitempty"`
	OwnerID                      string                          `json:"owner_id"`
	IsAllServerVersionConsistent bool                            `json:"is_all_server_version_consistent,omitempty"`
	AllServersDiffVersions       []infosync.ServerVersionInfo    `json:"all_servers_diff_versions,omitempty"`
	AllServersInfo               map[string]*infosync.ServerInfo `json:"all_servers_info,omitempty"`
}

ClusterServerInfo is used to report cluster servers info when do http request.

type DBTableHandler

type DBTableHandler struct {
	*handler.TikvHandlerTool
}

DBTableHandler is the handler for list table's regions.

func NewDBTableHandler

func NewDBTableHandler(tool *handler.TikvHandlerTool) *DBTableHandler

NewDBTableHandler creates a new DBTableHandler.

func (DBTableHandler) ServeHTTP

func (h DBTableHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of database information and table information by tableID.

type DBTableInfo

type DBTableInfo struct {
	DBInfo        *model.DBInfo    `json:"db_info"`
	TableInfo     *model.TableInfo `json:"table_info"`
	SchemaVersion int64            `json:"schema_version"`
}

DBTableInfo is used to report the database, table information and the current schema version.

type DDLHistoryJobHandler

type DDLHistoryJobHandler struct {
	*handler.TikvHandlerTool
}

DDLHistoryJobHandler is the handler for list job history.

func NewDDLHistoryJobHandler

func NewDDLHistoryJobHandler(tool *handler.TikvHandlerTool) *DDLHistoryJobHandler

NewDDLHistoryJobHandler creates a new DDLHistoryJobHandler.

func (DDLHistoryJobHandler) ServeHTTP

func (h DDLHistoryJobHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of ddl jobs history.

type DDLHookHandler

type DDLHookHandler struct{}

DDLHookHandler is the handler for use pre-defined ddl callback. It's convenient to provide some APIs for integration tests.

func (DDLHookHandler) ServeHTTP

func (DDLHookHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of resigning ddl owner.

type DDLResignOwnerHandler

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

DDLResignOwnerHandler is the handler for resigning ddl owner.

func NewDDLResignOwnerHandler

func NewDDLResignOwnerHandler(store kv.Storage) *DDLResignOwnerHandler

NewDDLResignOwnerHandler creates a new DDLResignOwnerHandler.

func (DDLResignOwnerHandler) ServeHTTP

func (h DDLResignOwnerHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of resigning ddl owner.

type FlashReplicaHandler

type FlashReplicaHandler struct {
	*handler.TikvHandlerTool
}

FlashReplicaHandler is the handler for flash replica.

func NewFlashReplicaHandler

func NewFlashReplicaHandler(tool *handler.TikvHandlerTool) *FlashReplicaHandler

NewFlashReplicaHandler creates a new FlashReplicaHandler.

func (FlashReplicaHandler) ServeHTTP

func (h FlashReplicaHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements the HTTPHandler interface.

type FrameItem

type FrameItem struct {
	DBName      string   `json:"db_name"`
	TableName   string   `json:"table_name"`
	TableID     int64    `json:"table_id"`
	IsRecord    bool     `json:"is_record"`
	RecordID    int64    `json:"record_id,omitempty"`
	IndexName   string   `json:"index_name,omitempty"`
	IndexID     int64    `json:"index_id,omitempty"`
	IndexValues []string `json:"index_values,omitempty"`
}

FrameItem includes a index's or record's meta data with table's info.

type IndexRegions

type IndexRegions struct {
	Name    string               `json:"name"`
	ID      int64                `json:"id"`
	Regions []handler.RegionMeta `json:"regions"`
}

IndexRegions is the region info for one index.

type LabelHandler

type LabelHandler struct{}

LabelHandler is the handler for set labels

func (LabelHandler) ServeHTTP

func (LabelHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of set server labels.

type MvccTxnHandler

type MvccTxnHandler struct {
	*handler.TikvHandlerTool
	// contains filtered or unexported fields
}

MvccTxnHandler is the handler for txn debugger.

func NewMvccTxnHandler

func NewMvccTxnHandler(tool *handler.TikvHandlerTool, op string) *MvccTxnHandler

NewMvccTxnHandler creates a new MvccTxnHandler.

func (MvccTxnHandler) ServeHTTP

func (h MvccTxnHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of list a table's regions.

type ProfileHandler

type ProfileHandler struct {
	*handler.TikvHandlerTool
}

ProfileHandler is the handler for getting profile.

func NewProfileHandler

func NewProfileHandler(tool *handler.TikvHandlerTool) *ProfileHandler

NewProfileHandler creates a new ProfileHandler.

func (ProfileHandler) ServeHTTP

func (h ProfileHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of TiDB metric profile.

type RangeDetail

type RangeDetail struct {
	StartKey    []byte `json:"start_key"`
	EndKey      []byte `json:"end_key"`
	StartKeyHex string `json:"start_key_hex"`
	EndKeyHex   string `json:"end_key_hex"`
}

RangeDetail contains detail information about a particular range

type RegionDetail

type RegionDetail struct {
	RangeDetail `json:",inline"`
	RegionID    uint64              `json:"region_id"`
	Frames      []*helper.FrameItem `json:"frames"`
}

RegionDetail is the response data for get region by ID it includes indices and records detail in current region.

type RegionHandler

type RegionHandler struct {
	*handler.TikvHandlerTool
}

RegionHandler is the common field for http handler. It contains some common functions for all handlers.

func NewRegionHandler

func NewRegionHandler(tool *handler.TikvHandlerTool) *RegionHandler

NewRegionHandler creates a new RegionHandler.

func (RegionHandler) ServeHTTP

func (h RegionHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of get region by ID.

type SchemaHandler

type SchemaHandler struct {
	*handler.TikvHandlerTool
}

SchemaHandler is the handler for list database or table schemas.

func NewSchemaHandler

func NewSchemaHandler(tool *handler.TikvHandlerTool) *SchemaHandler

NewSchemaHandler creates a new SchemaHandler.

func (SchemaHandler) ServeHTTP

func (h SchemaHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of list a database or table's schemas.

type SchemaStorageHandler

type SchemaStorageHandler struct {
	*handler.TikvHandlerTool
}

SchemaStorageHandler is the handler for list database or table schemas.

func NewSchemaStorageHandler

func NewSchemaStorageHandler(tool *handler.TikvHandlerTool) *SchemaStorageHandler

NewSchemaStorageHandler creates a new SchemaStorageHandler.

func (SchemaStorageHandler) ServeHTTP

func (h SchemaStorageHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of list a database or table's schemas.

type SchemaTableStorage

type SchemaTableStorage struct {
	TableSchema   string `json:"table_schema"`
	TableName     string `json:"table_name"`
	TableRows     int64  `json:"table_rows"`
	AvgRowLength  int64  `json:"avg_row_length"`
	DataLength    int64  `json:"data_length"`
	MaxDataLength int64  `json:"max_data_length"`
	IndexLength   int64  `json:"index_length"`
	DataFree      int64  `json:"data_free"`
}

SchemaTableStorage is the schema table storage info.

type ServerInfo

type ServerInfo struct {
	IsOwner  bool `json:"is_owner"`
	MaxProcs int  `json:"max_procs"`
	GOGC     int  `json:"gogc"`
	*infosync.ServerInfo
}

ServerInfo is used to report the servers info when do http request.

type ServerInfoHandler

type ServerInfoHandler struct {
	*handler.TikvHandlerTool
}

ServerInfoHandler is the handler for getting statistics.

func NewServerInfoHandler

func NewServerInfoHandler(tool *handler.TikvHandlerTool) *ServerInfoHandler

NewServerInfoHandler creates a new ServerInfoHandler.

func (ServerInfoHandler) ServeHTTP

func (h ServerInfoHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)

ServeHTTP handles request of ddl server info.

type SettingsHandler

type SettingsHandler struct {
	*handler.TikvHandlerTool
}

SettingsHandler is the handler for list tidb server settings.

func NewSettingsHandler

func NewSettingsHandler(tool *handler.TikvHandlerTool) *SettingsHandler

NewSettingsHandler creates a new SettingsHandler.

func (SettingsHandler) ServeHTTP

func (h SettingsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of list tidb server settings.

type TableFlashReplicaInfo

type TableFlashReplicaInfo struct {
	// Modifying the field name needs to negotiate with TiFlash colleague.
	ID             int64    `json:"id"`
	ReplicaCount   uint64   `json:"replica_count"`
	LocationLabels []string `json:"location_labels"`
	Available      bool     `json:"available"`
	HighPriority   bool     `json:"high_priority"`
}

TableFlashReplicaInfo is the replica information of a table.

type TableHandler

type TableHandler struct {
	*handler.TikvHandlerTool
	// contains filtered or unexported fields
}

TableHandler is the handler for list table's regions.

func NewTableHandler

func NewTableHandler(tool *handler.TikvHandlerTool, op string) *TableHandler

NewTableHandler creates a new TableHandler.

func (*TableHandler) ServeHTTP

func (h *TableHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles table related requests, such as table's region information, disk usage.

type TableRanges

type TableRanges struct {
	TableName string                 `json:"name"`
	TableID   int64                  `json:"id"`
	Range     RangeDetail            `json:"table"`
	Record    RangeDetail            `json:"record"`
	Index     RangeDetail            `json:"index"`
	Indices   map[string]RangeDetail `json:"indices,omitempty"`
}

TableRanges is the response data for list table's ranges. It contains ranges list for record and indices as well as the whole table.

type TableRegions

type TableRegions struct {
	TableName     string               `json:"name"`
	TableID       int64                `json:"id"`
	RecordRegions []handler.RegionMeta `json:"record_regions"`
	Indices       []IndexRegions       `json:"indices"`
}

TableRegions is the response data for list table's regions. It contains regions list for record and indices.

type TestHandler

type TestHandler struct {
	*handler.TikvHandlerTool
	// contains filtered or unexported fields
}

TestHandler is the handler for tests. It's convenient to provide some APIs for integration tests.

func NewTestHandler

func NewTestHandler(tool *handler.TikvHandlerTool, gcIsRunning uint32) *TestHandler

NewTestHandler creates a new TestHandler.

func (*TestHandler) ServeHTTP

func (h *TestHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles test related requests.

type ValueHandler

type ValueHandler struct {
}

ValueHandler is the handler for get value.

func (ValueHandler) ServeHTTP

func (ValueHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP handles request of list a database or table's schemas.

Jump to

Keyboard shortcuts

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