go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/vttablet/tabletmanager/vreplication Index | Files

package vreplication

import "gopkg.in/src-d/go-vitess.v1/vt/vttablet/tabletmanager/vreplication"


Package Files

controller.go controller_plan.go engine.go relaylog.go replicator_plan.go stats.go table_plan_builder.go tablet_picker.go vcopier.go vdbclient.go vplayer.go vreplicator.go


var (
    CreateCopyState = []string{
        "" /* 154 byte string literal not displayed */,

func AddStatusPart Uses

func AddStatusPart()

AddStatusPart adds the vreplication status to the status page.

func StatusSummary Uses

func StatusSummary() (maxSecondsBehindMaster int64, binlogPlayersCount int32)

StatusSummary returns the summary status of vreplication.

type ControllerStatus Uses

type ControllerStatus struct {
    Index               uint32
    Source              string
    SourceShard         string
    StopPosition        string
    LastPosition        string
    SecondsBehindMaster int64
    Counts              map[string]int64
    Rates               map[string][]float64
    State               string
    SourceTablet        string
    Messages            []string

ControllerStatus contains a renderable status of a controller.

type Engine Uses

type Engine struct {
    // contains filtered or unexported fields

Engine is the engine for handling vreplication.

func NewEngine Uses

func NewEngine(ts *topo.Server, cell string, mysqld mysqlctl.MysqlDaemon, dbClientFactory func() binlogplayer.DBClient, dbName string) *Engine

NewEngine creates a new Engine. A nil ts means that the Engine is disabled.

func (*Engine) Close Uses

func (vre *Engine) Close()

Close closes the Engine service.

func (*Engine) Exec Uses

func (vre *Engine) Exec(query string) (*sqltypes.Result, error)

Exec executes the query and the related actions. Example insert statement: insert into _vt.vreplication

(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state)
values ('Resharding', 'keyspace:"ks" shard:"0" tables:"a" tables:"b" ', 'MariaDB/0-1-1083', 9223372036854775807, 9223372036854775807, 481823, 0, 'Running')`

Example update statement: update _vt.vreplication set state='Stopped', message='testing stop' where id=1 Example delete: delete from _vt.vreplication where id=1 Example select: select * from _vt.vreplication

func (*Engine) IsOpen Uses

func (vre *Engine) IsOpen() bool

IsOpen returns true if Engine is open.

func (*Engine) Open Uses

func (vre *Engine) Open(ctx context.Context) error

Open starts the Engine service.

func (*Engine) WaitForPos Uses

func (vre *Engine) WaitForPos(ctx context.Context, id int, pos string) error

WaitForPos waits for the replication to reach the specified position.

type EngineStatus Uses

type EngineStatus struct {
    IsOpen      bool
    Controllers []*ControllerStatus

EngineStatus contains a renderable status of the Engine.

type ReplicatorPlan Uses

type ReplicatorPlan struct {
    VStreamFilter *binlogdatapb.Filter
    TargetTables  map[string]*TablePlan
    TablePlans    map[string]*TablePlan
    // contains filtered or unexported fields

ReplicatorPlan is the execution plan for the replicator. The constructor for this is buildReplicatorPlan in table_plan_builder.go The initial build identifies the tables that need to be replicated, and builds partial TablePlan objects for them. The partial plan is used to send streaming requests. As the responses return field info, this information is used to build the final execution plan (buildExecutionPlan).

func (*ReplicatorPlan) MarshalJSON Uses

func (rp *ReplicatorPlan) MarshalJSON() ([]byte, error)

MarshalJSON performs a custom JSON Marshalling.

type TablePlan Uses

type TablePlan struct {
    TargetName   string
    SendRule     *binlogdatapb.Rule
    PKReferences []string
    // BulkInsertFront, BulkInsertValues and BulkInsertOnDup are used
    // by vcopier.
    BulkInsertFront  *sqlparser.ParsedQuery
    BulkInsertValues *sqlparser.ParsedQuery
    BulkInsertOnDup  *sqlparser.ParsedQuery
    // Insert, Update and Delete are used by vplayer.
    // If the plan is an insertIgnore type, then Insert
    // and Update contain 'insert ignore' statements and
    // Delete is nil.
    Insert *sqlparser.ParsedQuery
    Update *sqlparser.ParsedQuery
    Delete *sqlparser.ParsedQuery
    Fields []*querypb.Field

TablePlan is the execution plan for a table within a player stream. The ParsedQuery objects assume that a map of before and after values will be built based on the streaming rows. Before image values will be prefixed with a "b_", and after image values will be prefixed with a "a_".

func (*TablePlan) MarshalJSON Uses

func (tp *TablePlan) MarshalJSON() ([]byte, error)

MarshalJSON performs a custom JSON Marshalling.

Package vreplication imports 34 packages (graph) and is imported by 1 packages. Updated 2019-06-10. Refresh now. Tools for package owners.