vreplication

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// CreateCopyState is the list of statements to execute for creating
	// the _vt.copy_state table
	CreateCopyState = []string{
		`create table if not exists _vt.copy_state (
  vrepl_id int,
  table_name varbinary(128),
  lastpk varbinary(2000),
  primary key (vrepl_id, table_name))`}
)

Functions

func AddStatusPart

func AddStatusPart()

AddStatusPart adds the vreplication status to the status page.

func StatusSummary

func StatusSummary() (maxSecondsBehindMaster int64, binlogPlayersCount int32)

StatusSummary returns the summary status of vreplication.

Types

type ControllerStatus

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

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

Engine is the engine for handling vreplication.

func NewEngine

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

func (vre *Engine) Close()

Close closes the Engine service.

func (*Engine) Exec

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

func (vre *Engine) IsOpen() bool

IsOpen returns true if Engine is open.

func (*Engine) Open

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

Open starts the Engine service.

func (*Engine) WaitForPos

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

WaitForPos waits for the replication to reach the specified position.

type EngineStatus

type EngineStatus struct {
	IsOpen      bool
	Controllers []*ControllerStatus
}

EngineStatus contains a renderable status of the Engine.

type ReplicatorPlan added in v1.6.0

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 added in v1.6.0

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

MarshalJSON performs a custom JSON Marshalling.

type TablePlan added in v1.5.0

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 added in v1.6.0

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

MarshalJSON performs a custom JSON Marshalling.

Jump to

Keyboard shortcuts

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