Documentation
¶
Index ¶
- Constants
- func MockConfigIdleTxnTimeout1() *config.Config
- func MockConfigMax16() *config.Config
- func MockDefaultConfig() *config.Config
- func RebalanceMigrate(log *xlog.Log, rebalance *Rebalance, max, min *BackendSize, ...) error
- func ShardBalanceAdvice(log *xlog.Log, spanner *Spanner, scatter *backend.Scatter, ...) error
- func SubTableToTable(from string) (isSub bool, to string)
- type AdminXA
- type Attach
- type BackendSize
- type Cleanup
- type DiskCheck
- type IP
- type IPTable
- type Manager
- type Proxy
- func MockProxy(log *xlog.Log) (*fakedb.DB, *Proxy, func())
- func MockProxy1(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func MockProxyPrivilegeN(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func MockProxyPrivilegeNotSuper(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func MockProxyPrivilegeUsers(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func NewProxy(log *xlog.Log, path string, serverVersion string, conf *config.Config) *Proxy
- func (p *Proxy) Address() string
- func (p *Proxy) Config() *config.Config
- func (p *Proxy) FlushConfig() error
- func (p *Proxy) IPTable() *IPTable
- func (p *Proxy) PeerAddress() string
- func (p *Proxy) Plugins() *plugins.Plugin
- func (p *Proxy) Router() *router.Router
- func (p *Proxy) Scatter() *backend.Scatter
- func (p *Proxy) Sessions() *Sessions
- func (p *Proxy) SetAllowIP(ips []string)
- func (p *Proxy) SetAuditMode(mode string)
- func (p *Proxy) SetAutocommitFalseIsTxn(enable bool)
- func (p *Proxy) SetBlocks(blocks int)
- func (p *Proxy) SetDDLTimeout(timeout int)
- func (p *Proxy) SetLoadBalance(val int)
- func (p *Proxy) SetLongQueryTime(longQueryTime int)
- func (p *Proxy) SetMaxConnections(connections int)
- func (p *Proxy) SetMaxJoinRows(size int)
- func (p *Proxy) SetMaxResultSize(size int)
- func (p *Proxy) SetQueryTimeout(timeout int)
- func (p *Proxy) SetReadOnly(val bool)
- func (p *Proxy) SetStreamBufferSize(streamBufferSize int)
- func (p *Proxy) SetThrottle(val int)
- func (p *Proxy) SetTwoPC(enable bool)
- func (p *Proxy) Spanner() *Spanner
- func (p *Proxy) Start()
- func (p *Proxy) Stop()
- func (p *Proxy) Syncer() *syncer.Syncer
- type Rebalance
- type Reshard
- func (reshard *Reshard) CheckReshardDBTable(db, singleTable, dstDB, dstTable string) (bool, error)
- func (reshard *Reshard) IsSingleTable(db, singleTable string) (bool, error)
- func (reshard *Reshard) ReShardTable(db, singleTable, dstDB, dstTable string) (*sqltypes.Result, error)
- func (reshard *Reshard) SetHandle(r ReshardHandle)
- func (reshard *Reshard) SetShiftProcessBar(finished int)
- func (reshard *Reshard) SetShiftStatus(err error)
- func (reshard *Reshard) ShiftProcess() error
- func (reshard *Reshard) ShiftProcessBar() int
- func (reshard *Reshard) ShiftStatus() error
- type ReshardHandle
- type SessionInfo
- type Sessions
- func (ss *Sessions) Add(s *driver.Session)
- func (ss *Sessions) Close()
- func (ss *Sessions) Kill(id uint32, reason string)
- func (ss *Sessions) MultiStmtTxnBinding(s *driver.Session, txn backend.Transaction, node sqlparser.Statement, ...)
- func (ss *Sessions) MultiStmtTxnUnBinding(s *driver.Session, isEnd bool)
- func (ss *Sessions) Reaches(quota int) bool
- func (ss *Sessions) Remove(s *driver.Session)
- func (ss *Sessions) Snapshot() []SessionInfo
- func (ss *Sessions) SnapshotTxn() []SessionInfo
- func (ss *Sessions) SnapshotUser(user string) []SessionInfo
- func (ss *Sessions) TxnBinding(s *driver.Session, txn backend.Transaction, node sqlparser.Statement, ...)
- func (ss *Sessions) TxnUnBinding(s *driver.Session)
- type Spanner
- func (spanner *Spanner) AuthCheck(s *driver.Session) error
- func (spanner *Spanner) Close() error
- func (spanner *Spanner) ComInitDB(session *driver.Session, database string) error
- func (spanner *Spanner) ComQuery(session *driver.Session, query string, ...) error
- func (spanner *Spanner) ExecuteBegin(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteCommit(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteDDL(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteDML(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteMultiStmtsInTxn(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteNormal(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteOnThisBackend(backend string, query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteRollback(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteScatter(query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteSingle(query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteSingleStmtTxnTwoPC(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteStreamFetch(session *driver.Session, database string, query string, ...) error
- func (spanner *Spanner) Init() error
- func (spanner *Spanner) IsAdminCmd(node sqlparser.Statement) bool
- func (spanner *Spanner) IsDDL(node sqlparser.Statement) bool
- func (spanner *Spanner) IsDML(node sqlparser.Statement) bool
- func (spanner *Spanner) IsDMLWrite(node sqlparser.Statement) bool
- func (spanner *Spanner) NewSession(s *driver.Session)
- func (spanner *Spanner) ReadOnly() bool
- func (spanner *Spanner) ServerVersion() string
- func (spanner *Spanner) SessionCheck(s *driver.Session) error
- func (spanner *Spanner) SessionClosed(s *driver.Session)
- func (spanner *Spanner) SessionDec(s *driver.Session)
- func (spanner *Spanner) SessionInc(s *driver.Session)
- func (spanner *Spanner) SetReadOnly(val bool)
- func (spanner *Spanner) SetServerVersion()
Constants ¶
const ( AttachDatabaseCheckTable = "attach_database_check_table_valid" AttachParamsCount = 3 DetachParamsCount = 1 )
const ( // R enum. R mode = iota // W enum. W )
Variables ¶
This section is empty.
Functions ¶
func MockConfigIdleTxnTimeout1 ¶ added in v1.0.6
MockConfigIdleTxnTimeout1 mocks the config with IdleTxnTimeout=1.
func MockConfigMax16 ¶
MockConfigMax16 mocks the config with MaxConnections=16.
func MockDefaultConfig ¶
MockDefaultConfig mocks the default config.
func RebalanceMigrate ¶ added in v1.1.2
func ShardBalanceAdvice ¶ added in v1.1.2
Types ¶
type AdminXA ¶ added in v1.1.2
type AdminXA struct {
// contains filtered or unexported fields
}
func NewAdminXA ¶ added in v1.1.2
func (*AdminXA) Commit ¶ added in v1.1.2
Commit used to handle the 'XA COMMIT' to all XAIDs an hour ago.
func (*AdminXA) Recover ¶ added in v1.1.2
Recover used to handle the 'XA RECOVER' to all backends .
type Attach ¶ added in v1.0.7
type Attach struct {
// contains filtered or unexported fields
}
func NewAttach ¶ added in v1.0.7
func NewAttach(log *xlog.Log, scatter *backend.Scatter, router *router.Router, spanner *Spanner) *Attach
NewAttach -- creates new Attach handler.
func (*Attach) Attach ¶ added in v1.0.7
func (*Attach) Detach ¶ added in v1.0.7
type BackendSize ¶ added in v1.1.2
type Cleanup ¶ added in v1.0.9
type Cleanup struct {
// contains filtered or unexported fields
}
Cleanup ...
type DiskCheck ¶
type DiskCheck struct {
// contains filtered or unexported fields
}
DiskCheck tuple.
func NewDiskCheck ¶
NewDiskCheck creates the DiskCheck tuple.
func (*DiskCheck) Close ¶
func (dc *DiskCheck) Close()
Close used to close the disk check goroutine.
func (*DiskCheck) HighWater ¶
HighWater returns the highwater mark. If true there is no space left on device.
type IPTable ¶
type IPTable struct {
// contains filtered or unexported fields
}
IPTable tuple.
func NewIPTable ¶
func NewIPTable(log *xlog.Log, conf *config.ProxyConfig) *IPTable
NewIPTable creates a new IPTable.
func (*IPTable) Check ¶
Check used to check whether the ip is in ip table or not.
type Manager ¶ added in v1.0.6
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶ added in v1.0.6
NewManager creates new Manager.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy tuple.
func MockProxy ¶
MockProxy mocks a proxy.
func MockProxy1 ¶
MockProxy1 mocks the proxy with config.
func MockProxyPrivilegeN ¶ added in v1.0.6
MockProxyPrivilegeN mocks the proxy with Privilege N.
func MockProxyPrivilegeNotSuper ¶ added in v1.0.6
MockProxyPrivilegeNotSuper mocks the proxy Not Super Privilege.
func MockProxyPrivilegeUsers ¶ added in v1.0.6
MockProxyPrivilegeUsers mocks the proxy with multipe users.
func NewProxy ¶
NewProxy creates new proxy.
func (*Proxy) FlushConfig ¶
FlushConfig used to flush the config to disk.
func (*Proxy) PeerAddress ¶
PeerAddress returns the peer address.
func (*Proxy) Plugins ¶ added in v1.0.9
Plugins return the plugins.
func (*Proxy) SetAllowIP ¶
SetAllowIP used to set allow ips.
func (*Proxy) SetAuditMode ¶
SetAuditMode used to set the mode of audit.
func (*Proxy) SetAutocommitFalseIsTxn ¶ added in v1.0.8
SetAutocommitFalseIsTxn used to set autocommitFalseIsTxn to true or false.
func (*Proxy) SetBlocks ¶ added in v1.0.9
SetBlocks used to set router blocks.
func (*Proxy) SetDDLTimeout ¶
SetDDLTimeout used to set the ddl timeout.
func (*Proxy) SetLoadBalance ¶ added in v1.1.1
SetLoadBalance used to set loadbalance.
func (*Proxy) SetLongQueryTime ¶ added in v1.0.1
SetLongQueryTime Set long Query Time used to set long query time.
func (*Proxy) SetMaxConnections ¶
SetMaxConnections used to set the max connections.
func (*Proxy) SetMaxJoinRows ¶ added in v1.0.7
SetMaxJoinRows used to set the max result size.
func (*Proxy) SetMaxResultSize ¶
SetMaxResultSize used to set the max result size.
func (*Proxy) SetQueryTimeout ¶
SetQueryTimeout used to set query timeout.
func (*Proxy) SetReadOnly ¶
SetReadOnly used to enable/disable readonly.
func (*Proxy) SetStreamBufferSize ¶ added in v1.0.3
SetStreamBufferSize used to set the streamBufferSize.
func (*Proxy) SetThrottle ¶
SetThrottle used to set the throttle.
func (*Proxy) SetTwoPC ¶
SetTwoPC used to set twopc to enable or disable.
type Rebalance ¶ added in v1.1.2
type Rebalance struct {
// contains filtered or unexported fields
}
Rebalance ...
type Reshard ¶ added in v1.0.8
type Reshard struct {
// contains filtered or unexported fields
}
Reshard ...
func NewReshard ¶ added in v1.0.8
func NewReshard(log *xlog.Log, scatter *backend.Scatter, router *router.Router, spanner *Spanner, user string) *Reshard
NewReshard ...
func (*Reshard) CheckReshardDBTable ¶ added in v1.0.8
CheckReshardDBTable check the database and table.
func (*Reshard) IsSingleTable ¶ added in v1.0.8
IsSingleTable check the table is Single or not.
func (*Reshard) ReShardTable ¶ added in v1.0.8
func (reshard *Reshard) ReShardTable(db, singleTable, dstDB, dstTable string) (*sqltypes.Result, error)
ReShardTable just reshard single table to the sharding table now.
func (*Reshard) SetHandle ¶ added in v1.0.8
func (reshard *Reshard) SetHandle(r ReshardHandle)
SetHandle set the handle
func (*Reshard) SetShiftProcessBar ¶ added in v1.0.8
SetShiftProcessBar set the Shift Process Bar.
func (*Reshard) SetShiftStatus ¶ added in v1.0.8
SetShiftStatus set the shift status.
func (*Reshard) ShiftProcess ¶ added in v1.0.8
ShiftProcess is call the shift tool cmd.
func (*Reshard) ShiftProcessBar ¶ added in v1.0.8
ShiftProcessBar about status of the Shift Process Bar.
type ReshardHandle ¶ added in v1.0.8
type ReshardHandle interface {
ShiftProcess() error
}
ReshardHandle ...
type SessionInfo ¶
type SessionInfo struct { ID uint32 User string Host string DB string Command string Time uint32 State string Info string RowsSent uint64 RowsExamined uint64 }
SessionInfo tuple.
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
Sessions tuple.
func (*Sessions) Add ¶
Add used to add the session to map when session created.
func (*Sessions) Kill ¶
Kill used to kill a live session. 1. remove from sessions list. 2. close the session from the server side. 3. abort the session's txn.
func (*Sessions) MultiStmtTxnBinding ¶ added in v1.0.4
func (ss *Sessions) MultiStmtTxnBinding(s *driver.Session, txn backend.Transaction, node sqlparser.Statement, query string)
MultiStmtTxnBinding used to bind txn, node, query to the session
func (*Sessions) MultiStmtTxnUnBinding ¶ added in v1.0.4
MultiStmtTxnUnBinding used to set transaction by isEnd
func (*Sessions) Reaches ¶
Reaches used to check whether the sessions count reaches(>=) the quota.
func (*Sessions) Remove ¶
Remove used to remove the session from the map when session exit.
func (*Sessions) Snapshot ¶
func (ss *Sessions) Snapshot() []SessionInfo
Snapshot returns all session info.
func (*Sessions) SnapshotTxn ¶ added in v1.0.6
func (ss *Sessions) SnapshotTxn() []SessionInfo
SnapshotTxn returns all sessions info in transaction.
func (*Sessions) SnapshotUser ¶ added in v1.0.6
func (ss *Sessions) SnapshotUser(user string) []SessionInfo
Snapshot returns all session info about the user.
type Spanner ¶
type Spanner struct {
// contains filtered or unexported fields
}
Spanner tuple.
func NewSpanner ¶
func NewSpanner(log *xlog.Log, conf *config.Config, iptable *IPTable, router *router.Router, scatter *backend.Scatter, sessions *Sessions, audit *audit.Audit, throttle *xbase.Throttle, plugins *plugins.Plugin, serverVersion string) *Spanner
NewSpanner creates a new spanner.
func (*Spanner) AuthCheck ¶
AuthCheck impl.
func (*Spanner) ComInitDB ¶
ComInitDB impl. Here, we will send a fake query 'SELECT 1' to the backend and check the 'USE DB'.
func (*Spanner) ComQuery ¶
func (spanner *Spanner) ComQuery(session *driver.Session, query string, bindVariables map[string]*querypb.BindVariable, callback func(qr *sqltypes.Result) error) error
ComQuery impl. Supports statements are: 1. DDL 2. DML 3. USE DB: MySQL client use 'database' won't pass here, FIXME.
func (*Spanner) ExecuteBegin ¶ added in v1.0.4
func (spanner *Spanner) ExecuteBegin(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteBegin used to execute "start transaction" or "begin".
func (*Spanner) ExecuteCommit ¶ added in v1.0.4
func (spanner *Spanner) ExecuteCommit(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteCommit used to execute multiple-statement transaction: "commit"
func (*Spanner) ExecuteDDL ¶
func (spanner *Spanner) ExecuteDDL(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteDDL used to execute ddl querys to the shards with DDLTimeout limits, used for create/drop index long time operation.
func (*Spanner) ExecuteDML ¶ added in v1.0.4
func (spanner *Spanner) ExecuteDML(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteDML used to execute some DML querys to shards.
func (*Spanner) ExecuteMultiStmtsInTxn ¶ added in v1.0.4
func (spanner *Spanner) ExecuteMultiStmtsInTxn(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteMultiStmtsInTxn used to execute multiple statements in the transaction.
func (*Spanner) ExecuteNormal ¶
func (spanner *Spanner) ExecuteNormal(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteNormal used to execute non-2pc querys to shards with QueryTimeout limits.
func (*Spanner) ExecuteOnThisBackend ¶
func (spanner *Spanner) ExecuteOnThisBackend(backend string, query string) (*sqltypes.Result, error)
ExecuteOnThisBackend used to executye query on the backend whitout planner.
func (*Spanner) ExecuteRollback ¶ added in v1.0.4
func (spanner *Spanner) ExecuteRollback(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteRollback used to execute multiple-statement transaction sql:"rollback"
func (*Spanner) ExecuteScatter ¶
ExecuteScatter used to execute query on all shards without planner.
func (*Spanner) ExecuteSingle ¶
ExecuteSingle used to execute query on one shard without planner. The query must contain the database, such as db.table.
func (*Spanner) ExecuteSingleStmtTxnTwoPC ¶ added in v1.0.4
func (spanner *Spanner) ExecuteSingleStmtTxnTwoPC(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteSingleStmtTxnTwoPC used to execute single statement transaction with 2pc commit.
func (*Spanner) ExecuteStreamFetch ¶
func (spanner *Spanner) ExecuteStreamFetch(session *driver.Session, database string, query string, node sqlparser.Statement, callback func(qr *sqltypes.Result) error) error
ExecuteStreamFetch used to execute a stream fetch query.
func (*Spanner) IsAdminCmd ¶ added in v1.0.9
IsAdminCmd returns the Admin query or not. Some of admin commands are prohibited when radon is read-only.
func (*Spanner) IsDDL ¶
IsDDL returns the DDL query or not.
func (*Spanner) IsDML ¶
IsDML returns the DML query or not.
func (*Spanner) IsDMLWrite ¶
IsDMLWrite returns the DML write or not.
func (*Spanner) ReadOnly ¶
ReadOnly returns the readonly or not.
func (*Spanner) ServerVersion ¶ added in v1.0.6
ServerVersion impl -- returns server version of Radon when greeting.
func (*Spanner) SessionCheck ¶
SessionCheck used to check authentication.
func (*Spanner) SessionClosed ¶
SessionClosed impl.
func (*Spanner) SessionDec ¶ added in v1.0.1
SessionDec decrease client connection metrics.
func (*Spanner) SessionInc ¶ added in v1.0.1
SessionInc increase client connection metrics, it need the user is assigned
func (*Spanner) SetReadOnly ¶
SetReadOnly used to set readonly.
Source Files
¶
- admin_attach.go
- admin_cleanup.go
- admin_rebalance.go
- admin_reshard.go
- admin_shift.go
- admin_xa.go
- audit.go
- auth.go
- checksumtable.go
- connector.go
- ddl.go
- delete.go
- disk.go
- execute.go
- explain.go
- initdb.go
- insert.go
- iptable.go
- kill.go
- manager.go
- mock.go
- multistmt_txn.go
- proxy.go
- query.go
- radon.go
- select.go
- selectsystem.go
- session.go
- sessions.go
- set.go
- show.go
- spanner.go
- update.go
- usedb.go
- version.go