Documentation
¶
Index ¶
- type CliEnv
- type Env
- type PrepareClient
- type Preparer
- func (p *Preparer) AdvanceState(ctx context.Context) error
- func (p *Preparer) DriveLoopAndWaitPrepare(ctx context.Context) error
- func (p *Preparer) Finalize(ctx context.Context) error
- func (p *Preparer) MarshalLogObject(om zapcore.ObjectEncoder) error
- func (p *Preparer) PrepareConnections(ctx context.Context) error
- func (p *Preparer) WaitAndHandleNextEvent(ctx context.Context) error
- type Region
- type RetryAndSplitRequestEnv
- type SplitRequestClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CliEnv ¶
type CliEnv struct {
Cache *tikv.RegionCache
Mgr *utils.StoreManager
}
func (CliEnv) ConnectToStore ¶
func (CliEnv) GetAllLiveStores ¶
type PrepareClient ¶
type PrepareClient interface {
Send(*brpb.PrepareSnapshotBackupRequest) error
Recv() (*brpb.PrepareSnapshotBackupResponse, error)
}
func AdaptForGRPCInTest ¶
func AdaptForGRPCInTest(p PrepareClient) PrepareClient
type Preparer ¶
type Preparer struct {
/* Some configurations. They aren't thread safe.
You may need to configure them before starting the Preparer. */
RetryBackoff time.Duration
RetryLimit int
LeaseDuration time.Duration
/* Observers. Initialize them before starting.*/
AfterConnectionsEstablished func()
// contains filtered or unexported fields
}
func (*Preparer) AdvanceState ¶
AdvanceState is exported for test usage. This call will check whether now we are safe to forward the whole procedure. If we can, this will set `p.waitApplyFinished` to true. Generally `DriveLoopAndWaitPrepare` is all you need, you may not want to call this.
func (*Preparer) DriveLoopAndWaitPrepare ¶
DriveLoopAndWaitPrepare drives the state machine and block the current goroutine until we are safe to start taking snapshot.
After this invoked, you shouldn't share this `Preparer` with any other goroutines.
After this the cluster will enter the land between normal and taking snapshot. This state will continue even this function returns, until `Finalize` invoked. Splitting, ingesting and conf changing will all be blocked.
func (*Preparer) Finalize ¶
Finalize notify the cluster to go back to the normal mode. This will return an error if the cluster has already entered the normal mode when this is called.
func (*Preparer) MarshalLogObject ¶
func (p *Preparer) MarshalLogObject(om zapcore.ObjectEncoder) error
func (*Preparer) PrepareConnections ¶
PrepareConnections prepares the connections for each store. This will pause the admin commands for each store.
type RetryAndSplitRequestEnv ¶
func (RetryAndSplitRequestEnv) ConnectToStore ¶
func (r RetryAndSplitRequestEnv) ConnectToStore(ctx context.Context, storeID uint64) (PrepareClient, error)
type SplitRequestClient ¶
type SplitRequestClient struct {
PrepareClient
MaxRequestSize int
}
func (SplitRequestClient) Send ¶
func (s SplitRequestClient) Send(req *brpb.PrepareSnapshotBackupRequest) error