schema

package
v0.0.0-...-bcc2220 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snapshot

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

Snapshot stores the source TiDB all schema information. If no special comments, all public methods are thread-safe.

func NewEmptySnapshot

func NewEmptySnapshot(forceReplicate bool) *Snapshot

NewEmptySnapshot creates an empty schema snapshot.

func NewSnapshotFromMeta

func NewSnapshotFromMeta(
	id model.ChangeFeedID,
	meta timeta.Reader,
	currentTs uint64,
	forceReplicate bool,
	filter filter.Filter,
) (*Snapshot, error)

NewSnapshotFromMeta creates a schema snapshot from meta.

func (*Snapshot) Copy

func (s *Snapshot) Copy() *Snapshot

Copy creates a new schema snapshot based on the given one. The copied one shares same internal data structures with the old one to save memory usage.

func (*Snapshot) CurrentTs

func (s *Snapshot) CurrentTs() uint64

CurrentTs returns the finish timestamp of the schema snapshot.

func (*Snapshot) DoHandleDDL

func (s *Snapshot) DoHandleDDL(job *timodel.Job) error

DoHandleDDL is like HandleDDL but doesn't fill schema name into job. NOTE: it's public because some tests in the upper package need this.

func (*Snapshot) Drop

func (s *Snapshot) Drop()

Drop drops the snapshot. It must be called when GC some snapshots. Drop a snapshot will also drop all snapshots with a less timestamp.

func (*Snapshot) DumpToString

func (s *Snapshot) DumpToString() string

DumpToString dumps the snapshot to a string.

func (*Snapshot) FillSchemaName

func (s *Snapshot) FillSchemaName(job *timodel.Job) error

FillSchemaName fills the schema name in ddl job.

func (*Snapshot) HandleDDL

func (s *Snapshot) HandleDDL(job *timodel.Job) error

HandleDDL handles the given job.

func (*Snapshot) IsIneligibleTableID

func (s *Snapshot) IsIneligibleTableID(id int64) bool

IsIneligibleTableID returns true if the table is ineligible.

func (*Snapshot) IsTruncateTableID

func (s *Snapshot) IsTruncateTableID(id int64) bool

IsTruncateTableID returns true if the table id have been truncated by truncate table DDL.

func (*Snapshot) IterPartitions

func (s *Snapshot) IterPartitions(includeIneligible bool, f func(id int64, i *model.TableInfo))

IterPartitions iterates all partitions in the snapshot.

func (*Snapshot) IterSchemaNames

func (s *Snapshot) IterSchemaNames(f func(schema string, target int64))

IterSchemaNames iterates all schema names in the snapshot.

func (*Snapshot) IterSchemas

func (s *Snapshot) IterSchemas(f func(i *timodel.DBInfo))

IterSchemas iterates all schemas in the snapshot.

func (*Snapshot) IterTableNames

func (s *Snapshot) IterTableNames(f func(schema int64, table string, target int64))

IterTableNames iterates all table names in the snapshot.

func (*Snapshot) IterTables

func (s *Snapshot) IterTables(includeIneligible bool, f func(i *model.TableInfo))

IterTables iterates all tables in the snapshot.

func (*Snapshot) PhysicalTableByID

func (s *Snapshot) PhysicalTableByID(id int64) (*model.TableInfo, bool)

PhysicalTableByID returns the TableInfo by table id or partition id. The second returned value is false if no table with the specified id is found. NOTE: The returned table info should always be READ-ONLY!

func (*Snapshot) PreTableInfo

func (s *Snapshot) PreTableInfo(job *timodel.Job) (*model.TableInfo, error)

PreTableInfo returns the table info which will be overwritten by the specified job

func (*Snapshot) PrintStatus

func (s *Snapshot) PrintStatus(logger func(msg string, fields ...zap.Field))

PrintStatus prints the schema snapshot.

func (*Snapshot) SchemaByID

func (s *Snapshot) SchemaByID(id int64) (*timodel.DBInfo, bool)

SchemaByID returns the DBInfo by schema id. The second returned value is false if no schema with the specified id is found. NOTE: The returned table info should always be READ-ONLY!

func (*Snapshot) SchemaByTableID

func (s *Snapshot) SchemaByTableID(tableID int64) (*timodel.DBInfo, bool)

SchemaByTableID returns the schema ID by table ID.

func (*Snapshot) SchemaCount

func (s *Snapshot) SchemaCount() (count int)

SchemaCount counts schemas in the snapshot. It's only for tests.

func (*Snapshot) SchemaIDByName

func (s *Snapshot) SchemaIDByName(schema string) (int64, bool)

SchemaIDByName gets the schema id from the given schema name.

func (*Snapshot) TableByName

func (s *Snapshot) TableByName(schema, table string) (*model.TableInfo, bool)

TableByName queries a table by name, The second returned value is false if no table with the specified name is found. NOTE: The returned table info should always be READ-ONLY!

func (*Snapshot) TableCount

func (s *Snapshot) TableCount(includeIneligible bool,
	filter func(schema, table string) bool,
) (count int)

TableCount counts tables in the snapshot. It's only for tests.

func (*Snapshot) TableIDByName

func (s *Snapshot) TableIDByName(schema string, table string) (int64, bool)

TableIDByName returns the tableID by table schemaName and tableName. The second returned value is false if no table with the specified name is found.

Jump to

Keyboard shortcuts

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