tgtdb

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	ORACLE     = "oracle"
	MYSQL      = "mysql"
	POSTGRESQL = "postgresql"
	YUGABYTEDB = "yugabytedb"
)
View Source
const (
	LB_WARN_MSG = "--target-db-host is a load balancer IP which will be used to create connections for data import.\n" +
		"\t To control the parallelism and servers used, refer to help for --parallel-jobs and --target-endpoints flags.\n"

	GET_YB_SERVERS_QUERY = "SELECT host, port, num_connections, node_type, cloud, region, zone, public_ip FROM yb_servers()"
)
View Source
const (
	SET_CLIENT_ENCODING_TO_UTF8           = "SET client_encoding TO 'UTF8'"
	SET_SESSION_REPLICATE_ROLE_TO_REPLICA = "SET session_replication_role TO replica" //Disable triggers or fkeys constraint checks.
	SET_YB_ENABLE_UPSERT_MODE             = "SET yb_enable_upsert_mode to true"
	SET_YB_DISABLE_TRANSACTIONAL_WRITES   = "SET yb_disable_transactional_writes to true" // Disable transactions to improve ingestion throughput.
)

import session parameters

View Source
const ALTER_QUERY_RETRY_COUNT = 5
View Source
const BATCH_METADATA_TABLE_NAME = BATCH_METADATA_TABLE_SCHEMA + "." + "ybvoyager_import_data_batches_metainfo_v3"
View Source
const BATCH_METADATA_TABLE_SCHEMA = "ybvoyager_metadata"

The _v2 is appended in the table name so that the import code doesn't try to use the similar table created by the voyager 1.3 and earlier. Voyager 1.4 uses import data state format that is incompatible from the earlier versions.

View Source
const EVENTS_PER_TABLE_METADATA_TABLE_NAME = BATCH_METADATA_TABLE_SCHEMA + "." + "ybvoyager_imported_event_count_by_table"
View Source
const EVENT_CHANNELS_METADATA_TABLE_NAME = BATCH_METADATA_TABLE_SCHEMA + "." + "ybvoyager_import_data_event_channels_metainfo"
View Source
const PG_DEFAULT_PARALLELISM_FACTOR = 8 // factor for default parallelism in case fetchDefaultParallelJobs() is not able to get the no of cores
View Source
const YB_DEFAULT_PARALLELISM_FACTOR = 2 // factor for default parallelism in case fetchDefaultParallelJobs() is not able to get the no of cores

Variables

View Source
var NonRetryCopyErrors = []string{
	"invalid input syntax",
	"violates unique constraint",
	"syntax error at",
}

Functions

This section is empty.

Types

type Batch added in v1.5.0

type Batch interface {
	Open() (*os.File, error)
	GetFilePath() string
	GetTableName() string
	GetQueryIsBatchAlreadyImported() string
	GetQueryToRecordEntryInDB(rowsAffected int64) string
}

type ConnectionParams

type ConnectionParams struct {
	NumConnections    int
	ConnUriList       []string
	SessionInitScript []string
}

type ConnectionPool

type ConnectionPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewConnectionPool

func NewConnectionPool(params *ConnectionParams) *ConnectionPool

func (*ConnectionPool) DisableThrottling added in v1.5.0

func (pool *ConnectionPool) DisableThrottling()

func (*ConnectionPool) PrepareStatement added in v1.5.0

func (pool *ConnectionPool) PrepareStatement(conn *pgx.Conn, stmtName string, stmt string) error

func (*ConnectionPool) WithConn

func (pool *ConnectionPool) WithConn(fn func(*pgx.Conn) (bool, error)) error

type Event added in v1.5.0

type Event struct {
	Vsn          int64              `json:"vsn"` // Voyager Sequence Number
	Op           string             `json:"op"`
	SchemaName   string             `json:"schema_name"`
	TableName    string             `json:"table_name"`
	Key          map[string]*string `json:"key"`
	Fields       map[string]*string `json:"fields"`
	BeforeFields map[string]*string `json:"before_fields"`
	ExporterRole string             `json:"exporter_role"`
}

func (*Event) Copy added in v1.6.5

func (e *Event) Copy() *Event

func (*Event) GetParams added in v1.5.0

func (e *Event) GetParams() []interface{}

func (*Event) GetPreparedSQLStmt added in v1.5.0

func (e *Event) GetPreparedSQLStmt(targetDBType string) string

func (*Event) GetPreparedStmtName added in v1.5.0

func (event *Event) GetPreparedStmtName() string

func (*Event) GetSQLStmt added in v1.5.0

func (e *Event) GetSQLStmt() string

func (*Event) IsCutoverToSource added in v1.6.2

func (e *Event) IsCutoverToSource() bool

func (*Event) IsCutoverToSourceReplica added in v1.6.2

func (e *Event) IsCutoverToSourceReplica() bool

func (*Event) IsCutoverToTarget added in v1.6.2

func (e *Event) IsCutoverToTarget() bool

func (*Event) IsUniqueKeyChanged added in v1.6.5

func (event *Event) IsUniqueKeyChanged(uniqueKeyCols []string) bool

func (*Event) String added in v1.5.0

func (e *Event) String() string

type EventBatch added in v1.5.0

type EventBatch struct {
	Events             []*Event
	ChanNo             int
	EventCounts        *EventCounter
	EventCountsByTable map[string]*EventCounter
}

func NewEventBatch added in v1.5.0

func NewEventBatch(events []*Event, chanNo int) *EventBatch

func (*EventBatch) GetChannelMetadataUpdateQuery added in v1.5.0

func (eb *EventBatch) GetChannelMetadataUpdateQuery(migrationUUID uuid.UUID) string

func (*EventBatch) GetLastVsn added in v1.5.0

func (eb *EventBatch) GetLastVsn() int64

func (*EventBatch) GetQueriesToInsertEventStatsByTable added in v1.5.0

func (eb *EventBatch) GetQueriesToInsertEventStatsByTable(migrationUUID uuid.UUID, tableName string) string

func (*EventBatch) GetQueriesToUpdateEventStatsByTable added in v1.5.0

func (eb *EventBatch) GetQueriesToUpdateEventStatsByTable(migrationUUID uuid.UUID, tableName string) string

func (*EventBatch) GetTableNames added in v1.5.0

func (eb *EventBatch) GetTableNames() []string

type EventCounter added in v1.5.0

type EventCounter struct {
	TotalEvents int64
	NumInserts  int64
	NumUpdates  int64
	NumDeletes  int64
}

func (*EventCounter) CountEvent added in v1.5.0

func (ec *EventCounter) CountEvent(ev *Event)

func (*EventCounter) Merge added in v1.6.0

func (ec *EventCounter) Merge(ec2 *EventCounter)

type ImportBatchArgs added in v1.5.0

type ImportBatchArgs struct {
	FilePath  string
	TableName string
	Columns   []string

	FileFormat string
	HasHeader  bool
	Delimiter  string
	QuoteChar  byte
	EscapeChar byte
	NullString string

	RowsPerTransaction int64
}

func (*ImportBatchArgs) GetPGCopyStatement added in v1.6.2

func (args *ImportBatchArgs) GetPGCopyStatement() string

func (*ImportBatchArgs) GetSqlLdrControlFile added in v1.5.0

func (args *ImportBatchArgs) GetSqlLdrControlFile(schema string, tableSchema map[string]map[string]string) string

func (*ImportBatchArgs) GetYBCopyStatement added in v1.5.0

func (args *ImportBatchArgs) GetYBCopyStatement() string

type Row added in v1.6.0

type Row interface {
	Scan(dest ...interface{}) error
}

type Rows added in v1.6.0

type Rows interface {
	Row
	Next() bool
	Close()
	Err() error
}

type TargetConf added in v1.5.0

type TargetConf struct {
	TargetDBType         string        `json:"target_db_type"`
	Host                 string        `json:"host"`
	Port                 int           `json:"port"`
	User                 string        `json:"user"`
	Password             string        `json:"password"`
	DBName               string        `json:"db_name"`
	Schema               string        `json:"schema"`
	SSLMode              string        `json:"ssl_mode"`
	SSLCertPath          string        `json:"ssl_cert_path"`
	SSLKey               string        `json:"ssl_key"`
	SSLRootCert          string        `json:"ssl_root_cert"`
	SSLCRL               string        `json:"ssl_crl"`
	SSLQueryString       string        `json:"ssl_query_string"`
	DBSid                string        `json:"db_sid"`
	TNSAlias             string        `json:"tns_alias"`
	OracleHome           string        `json:"oracle_home"`
	Uri                  string        `json:"uri"`
	ContinueOnError      utils.BoolStr `json:"continue_on_error"`
	IgnoreIfExists       utils.BoolStr `json:"ignore_if_exists"`
	TableList            string        `json:"table_list"`
	ExcludeTableList     string        `json:"exclude_table_list"`
	ImportMode           bool          `json:"import_mode"`
	ImportObjects        string        `json:"import_objects"`
	ExcludeImportObjects string        `json:"exclude_import_objects"`
	DBVersion            string        `json:"db_version"`

	TargetEndpoints            string        `json:"target_endpoints"`
	UsePublicIP                utils.BoolStr `json:"use_public_ip"`
	EnableUpsert               utils.BoolStr `json:"enable_upsert"`
	DisableTransactionalWrites utils.BoolStr `json:"disable_transactional_writes"`
	Parallelism                int           `json:"parallelism"`
}

func GetRedactedTargetConf added in v1.5.0

func GetRedactedTargetConf(t *TargetConf) *TargetConf

func (*TargetConf) Clone added in v1.5.0

func (t *TargetConf) Clone() *TargetConf

func (*TargetConf) GetConnectionUri added in v1.5.0

func (t *TargetConf) GetConnectionUri() string

type TargetDB

type TargetDB interface {
	Init() error
	Finalize()
	InitConnPool() error
	PrepareForStreaming()
	GetVersion() string
	CreateVoyagerSchema() error
	GetNonEmptyTables(tableNames []string) []string
	IsNonRetryableCopyError(err error) bool
	ImportBatch(batch Batch, args *ImportBatchArgs, exportDir string, tableSchema map[string]map[string]string) (int64, error)
	IfRequiredQuoteColumnNames(tableName string, columns []string) ([]string, error)
	ExecuteBatch(migrationUUID uuid.UUID, batch *EventBatch) error
	GetDebeziumValueConverterSuite() map[string]tgtdbsuite.ConverterFn
	MaxBatchSizeInBytes() int64
	RestoreSequences(sequencesLastValue map[string]int64) error
	GetIdentityColumnNamesForTable(table string, identityType string) ([]string, error)
	DisableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error
	EnableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error
	EnableGeneratedByDefaultAsIdentityColumns(tableColumnsMap map[string][]string) error
	GetTableToUniqueKeyColumnsMap(tableList []string) (map[string][]string, error)
	ClearMigrationState(migrationUUID uuid.UUID, exportDir string) error
	InvalidIndexes() (map[string]bool, error)
	// NOTE: The following four methods should not be used for arbitrary query
	// execution on TargetDB. The should be only used from higher level
	// abstractions like ImportDataState.
	Query(query string) (Rows, error)
	QueryRow(query string) Row
	Exec(query string) (int64, error)
	WithTx(fn func(tx Tx) error) error
}

func NewTargetDB added in v1.5.0

func NewTargetDB(tconf *TargetConf) TargetDB

type TargetOracleDB added in v1.5.0

type TargetOracleDB struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*TargetOracleDB) ClearMigrationState added in v1.6.0

func (tdb *TargetOracleDB) ClearMigrationState(migrationUUID uuid.UUID, exportDir string) error

this will be only called by FallForward or FallBack DBs

func (*TargetOracleDB) CreateVoyagerSchema added in v1.5.0

func (tdb *TargetOracleDB) CreateVoyagerSchema() error

func (*TargetOracleDB) DisableGeneratedAlwaysAsIdentityColumns added in v1.5.0

func (tdb *TargetOracleDB) DisableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetOracleDB) EnableGeneratedAlwaysAsIdentityColumns added in v1.5.0

func (tdb *TargetOracleDB) EnableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetOracleDB) EnableGeneratedByDefaultAsIdentityColumns added in v1.6.0

func (tdb *TargetOracleDB) EnableGeneratedByDefaultAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetOracleDB) Exec added in v1.6.0

func (tdb *TargetOracleDB) Exec(query string) (int64, error)

func (*TargetOracleDB) ExecuteBatch added in v1.5.0

func (tdb *TargetOracleDB) ExecuteBatch(migrationUUID uuid.UUID, batch *EventBatch) error

execute all events sequentially one by one in a single transaction

func (*TargetOracleDB) Finalize added in v1.5.0

func (tdb *TargetOracleDB) Finalize()

func (*TargetOracleDB) GetConnection added in v1.5.0

func (tdb *TargetOracleDB) GetConnection() *sql.Conn

func (*TargetOracleDB) GetDebeziumValueConverterSuite added in v1.5.0

func (tdb *TargetOracleDB) GetDebeziumValueConverterSuite() map[string]tgtdbsuite.ConverterFn

func (*TargetOracleDB) GetIdentityColumnNamesForTable added in v1.6.0

func (tdb *TargetOracleDB) GetIdentityColumnNamesForTable(table string, identityType string) ([]string, error)

func (*TargetOracleDB) GetNonEmptyTables added in v1.5.0

func (tdb *TargetOracleDB) GetNonEmptyTables(tables []string) []string

func (*TargetOracleDB) GetTableToUniqueKeyColumnsMap added in v1.6.5

func (tdb *TargetOracleDB) GetTableToUniqueKeyColumnsMap(tableList []string) (map[string][]string, error)

func (*TargetOracleDB) GetVersion added in v1.5.0

func (tdb *TargetOracleDB) GetVersion() string

func (*TargetOracleDB) IfRequiredQuoteColumnNames added in v1.5.0

func (tdb *TargetOracleDB) IfRequiredQuoteColumnNames(tableName string, columns []string) ([]string, error)

func (*TargetOracleDB) ImportBatch added in v1.5.0

func (tdb *TargetOracleDB) ImportBatch(batch Batch, args *ImportBatchArgs, exportDir string, tableSchema map[string]map[string]string) (int64, error)

func (*TargetOracleDB) Init added in v1.5.0

func (tdb *TargetOracleDB) Init() error

func (*TargetOracleDB) InitConnPool added in v1.5.0

func (tdb *TargetOracleDB) InitConnPool() error

func (*TargetOracleDB) InvalidIndexes added in v1.6.5

func (tdb *TargetOracleDB) InvalidIndexes() (map[string]bool, error)

func (*TargetOracleDB) IsNonRetryableCopyError added in v1.5.0

func (tdb *TargetOracleDB) IsNonRetryableCopyError(err error) bool

func (*TargetOracleDB) MaxBatchSizeInBytes added in v1.5.0

func (tdb *TargetOracleDB) MaxBatchSizeInBytes() int64

func (*TargetOracleDB) PrepareForStreaming added in v1.5.0

func (tdb *TargetOracleDB) PrepareForStreaming()

func (*TargetOracleDB) Query added in v1.6.0

func (tdb *TargetOracleDB) Query(query string) (Rows, error)

func (*TargetOracleDB) QueryRow added in v1.6.0

func (tdb *TargetOracleDB) QueryRow(query string) Row

func (*TargetOracleDB) RestoreSequences added in v1.5.0

func (tdb *TargetOracleDB) RestoreSequences(sequencesLastVal map[string]int64) error

NOTE: TODO support for identity columns sequences

func (*TargetOracleDB) WithConn added in v1.5.0

func (tdb *TargetOracleDB) WithConn(fn func(*sql.Conn) (bool, error)) error

func (*TargetOracleDB) WithTx added in v1.6.0

func (tdb *TargetOracleDB) WithTx(fn func(tx Tx) error) error

type TargetPostgreSQL added in v1.6.2

type TargetPostgreSQL struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*TargetPostgreSQL) ClearMigrationState added in v1.6.2

func (pg *TargetPostgreSQL) ClearMigrationState(migrationUUID uuid.UUID, exportDir string) error

func (*TargetPostgreSQL) Conn added in v1.6.2

func (pg *TargetPostgreSQL) Conn() *pgx.Conn

TODO We should not export `Conn`. This is temporary--until we refactor all target db access.

func (*TargetPostgreSQL) CreateVoyagerSchema added in v1.6.2

func (pg *TargetPostgreSQL) CreateVoyagerSchema() error

func (*TargetPostgreSQL) DisableGeneratedAlwaysAsIdentityColumns added in v1.6.2

func (pg *TargetPostgreSQL) DisableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetPostgreSQL) EnableGeneratedAlwaysAsIdentityColumns added in v1.6.2

func (pg *TargetPostgreSQL) EnableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetPostgreSQL) EnableGeneratedByDefaultAsIdentityColumns added in v1.6.2

func (pg *TargetPostgreSQL) EnableGeneratedByDefaultAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetPostgreSQL) EnsureConnected added in v1.6.2

func (pg *TargetPostgreSQL) EnsureConnected()

func (*TargetPostgreSQL) Exec added in v1.6.2

func (pg *TargetPostgreSQL) Exec(query string) (int64, error)

func (*TargetPostgreSQL) ExecuteBatch added in v1.6.2

func (pg *TargetPostgreSQL) ExecuteBatch(migrationUUID uuid.UUID, batch *EventBatch) error

TODO(future): figure out the sql error codes for prepared statements which have become invalid and needs to be prepared again

func (*TargetPostgreSQL) Finalize added in v1.6.2

func (pg *TargetPostgreSQL) Finalize()

func (*TargetPostgreSQL) GetDebeziumValueConverterSuite added in v1.6.2

func (pg *TargetPostgreSQL) GetDebeziumValueConverterSuite() map[string]tgtdbsuite.ConverterFn

func (*TargetPostgreSQL) GetIdentityColumnNamesForTable added in v1.6.2

func (pg *TargetPostgreSQL) GetIdentityColumnNamesForTable(table string, identityType string) ([]string, error)

func (*TargetPostgreSQL) GetNonEmptyTables added in v1.6.2

func (pg *TargetPostgreSQL) GetNonEmptyTables(tables []string) []string

func (*TargetPostgreSQL) GetTableToUniqueKeyColumnsMap added in v1.6.5

func (pg *TargetPostgreSQL) GetTableToUniqueKeyColumnsMap(tableList []string) (map[string][]string, error)

func (*TargetPostgreSQL) GetVersion added in v1.6.2

func (pg *TargetPostgreSQL) GetVersion() string

func (*TargetPostgreSQL) IfRequiredQuoteColumnNames added in v1.6.2

func (pg *TargetPostgreSQL) IfRequiredQuoteColumnNames(tableName string, columns []string) ([]string, error)

func (*TargetPostgreSQL) ImportBatch added in v1.6.2

func (pg *TargetPostgreSQL) ImportBatch(batch Batch, args *ImportBatchArgs, exportDir string, tableSchema map[string]map[string]string) (int64, error)

func (*TargetPostgreSQL) Init added in v1.6.2

func (pg *TargetPostgreSQL) Init() error

func (*TargetPostgreSQL) InitConnPool added in v1.6.2

func (pg *TargetPostgreSQL) InitConnPool() error

func (*TargetPostgreSQL) InvalidIndexes added in v1.6.5

func (pg *TargetPostgreSQL) InvalidIndexes() (map[string]bool, error)

func (*TargetPostgreSQL) IsNonRetryableCopyError added in v1.6.2

func (pg *TargetPostgreSQL) IsNonRetryableCopyError(err error) bool

func (*TargetPostgreSQL) MaxBatchSizeInBytes added in v1.6.2

func (pg *TargetPostgreSQL) MaxBatchSizeInBytes() int64

func (*TargetPostgreSQL) PrepareForStreaming added in v1.6.2

func (pg *TargetPostgreSQL) PrepareForStreaming()

func (*TargetPostgreSQL) Query added in v1.6.2

func (pg *TargetPostgreSQL) Query(query string) (Rows, error)

func (*TargetPostgreSQL) QueryRow added in v1.6.2

func (pg *TargetPostgreSQL) QueryRow(query string) Row

func (*TargetPostgreSQL) RestoreSequences added in v1.6.2

func (pg *TargetPostgreSQL) RestoreSequences(sequencesLastVal map[string]int64) error

func (*TargetPostgreSQL) WithTx added in v1.6.2

func (pg *TargetPostgreSQL) WithTx(fn func(tx Tx) error) error

type TargetYugabyteDB added in v1.5.0

type TargetYugabyteDB struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*TargetYugabyteDB) ClearMigrationState added in v1.6.0

func (yb *TargetYugabyteDB) ClearMigrationState(migrationUUID uuid.UUID, exportDir string) error

func (*TargetYugabyteDB) Conn added in v1.5.0

func (yb *TargetYugabyteDB) Conn() *pgx.Conn

TODO We should not export `Conn`. This is temporary--until we refactor all target db access.

func (*TargetYugabyteDB) CreateVoyagerSchema added in v1.5.0

func (yb *TargetYugabyteDB) CreateVoyagerSchema() error

func (*TargetYugabyteDB) DisableGeneratedAlwaysAsIdentityColumns added in v1.5.0

func (yb *TargetYugabyteDB) DisableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetYugabyteDB) EnableGeneratedAlwaysAsIdentityColumns added in v1.5.0

func (yb *TargetYugabyteDB) EnableGeneratedAlwaysAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetYugabyteDB) EnableGeneratedByDefaultAsIdentityColumns added in v1.6.0

func (yb *TargetYugabyteDB) EnableGeneratedByDefaultAsIdentityColumns(tableColumnsMap map[string][]string) error

func (*TargetYugabyteDB) EnsureConnected added in v1.5.0

func (yb *TargetYugabyteDB) EnsureConnected()

func (*TargetYugabyteDB) Exec added in v1.6.0

func (yb *TargetYugabyteDB) Exec(query string) (int64, error)

func (*TargetYugabyteDB) ExecuteBatch added in v1.5.0

func (yb *TargetYugabyteDB) ExecuteBatch(migrationUUID uuid.UUID, batch *EventBatch) error

TODO(future): figure out the sql error codes for prepared statements which have become invalid and needs to be prepared again

func (*TargetYugabyteDB) Finalize added in v1.5.0

func (yb *TargetYugabyteDB) Finalize()

func (*TargetYugabyteDB) GetDebeziumValueConverterSuite added in v1.5.0

func (yb *TargetYugabyteDB) GetDebeziumValueConverterSuite() map[string]tgtdbsuite.ConverterFn

func (*TargetYugabyteDB) GetIdentityColumnNamesForTable added in v1.6.0

func (yb *TargetYugabyteDB) GetIdentityColumnNamesForTable(table string, identityType string) ([]string, error)

func (*TargetYugabyteDB) GetNonEmptyTables added in v1.5.0

func (yb *TargetYugabyteDB) GetNonEmptyTables(tables []string) []string

func (*TargetYugabyteDB) GetTableToUniqueKeyColumnsMap added in v1.6.5

func (yb *TargetYugabyteDB) GetTableToUniqueKeyColumnsMap(tableList []string) (map[string][]string, error)

func (*TargetYugabyteDB) GetVersion added in v1.5.0

func (yb *TargetYugabyteDB) GetVersion() string

func (*TargetYugabyteDB) IfRequiredQuoteColumnNames added in v1.5.0

func (yb *TargetYugabyteDB) IfRequiredQuoteColumnNames(tableName string, columns []string) ([]string, error)

func (*TargetYugabyteDB) ImportBatch added in v1.5.0

func (yb *TargetYugabyteDB) ImportBatch(batch Batch, args *ImportBatchArgs, exportDir string, tableSchema map[string]map[string]string) (int64, error)

func (*TargetYugabyteDB) Init added in v1.5.0

func (yb *TargetYugabyteDB) Init() error

func (*TargetYugabyteDB) InitConnPool added in v1.5.0

func (yb *TargetYugabyteDB) InitConnPool() error

func (*TargetYugabyteDB) InvalidIndexes added in v1.6.5

func (yb *TargetYugabyteDB) InvalidIndexes() (map[string]bool, error)

func (*TargetYugabyteDB) IsNonRetryableCopyError added in v1.5.0

func (yb *TargetYugabyteDB) IsNonRetryableCopyError(err error) bool

func (*TargetYugabyteDB) MaxBatchSizeInBytes added in v1.5.0

func (yb *TargetYugabyteDB) MaxBatchSizeInBytes() int64

func (*TargetYugabyteDB) PrepareForStreaming added in v1.5.0

func (yb *TargetYugabyteDB) PrepareForStreaming()

func (*TargetYugabyteDB) Query added in v1.6.0

func (yb *TargetYugabyteDB) Query(query string) (Rows, error)

func (*TargetYugabyteDB) QueryRow added in v1.6.0

func (yb *TargetYugabyteDB) QueryRow(query string) Row

func (*TargetYugabyteDB) RestoreSequences added in v1.5.0

func (yb *TargetYugabyteDB) RestoreSequences(sequencesLastVal map[string]int64) error

func (*TargetYugabyteDB) WithTx added in v1.6.0

func (yb *TargetYugabyteDB) WithTx(fn func(tx Tx) error) error

type Tx added in v1.6.0

type Tx interface {
	Exec(ctx context.Context, query string) (int64, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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