sqlccl

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2018 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package sqlccl is a generated protocol buffer package.

It is generated from these files:

cockroach/pkg/ccl/sqlccl/backup.proto

It has these top-level messages:

BackupDescriptor

Index

Constants

View Source
const (
	// BackupDescriptorName is the file name used for serialized
	// BackupDescriptor protos.
	BackupDescriptorName = "BACKUP"
	// BackupFormatInitialVersion is the first version of backup and its files.
	BackupFormatInitialVersion uint32 = 0
)

Variables

View Source
var (
	ErrInvalidLengthBackup = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBackup   = fmt.Errorf("proto: integer overflow")
)

Functions

func Import

Import loads some data in sstables into an empty range. Only the keys between startKey and endKey are loaded. Every row's key is rewritten to be for newTableID.

func MakeKeyRewriterForNewTableID

func MakeKeyRewriterForNewTableID(
	desc *sqlbase.TableDescriptor, newTableID sqlbase.ID,
) storageccl.PrefixRewriter

MakeKeyRewriterForNewTableID creates a KeyRewriter that rewrites all keys from a table to have a new tableID. For dependency reasons, the implementation of the matching is in storageccl, but the interesting constructor is here.

func Restore

func Restore(
	ctx context.Context,
	p sql.PlanHookState,
	uris []string,
	targets parser.TargetList,
	opt parser.KVOptions,
	jobLogger *sql.JobLogger,
) (dataSize int64, err error)

Restore imports a SQL table (or tables) from sets of non-overlapping sstable files.

func ValidatePreviousBackups

func ValidatePreviousBackups(ctx context.Context, uris []string) (hlc.Timestamp, error)

ValidatePreviousBackups checks that the timestamps of previous backups are consistent. The most recently backed-up time is returned.

Types

type BackupDescriptor

type BackupDescriptor struct {
	StartTime cockroach_util_hlc.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime" json:"start_time"`
	EndTime   cockroach_util_hlc.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime" json:"end_time"`
	// Spans contains the spans requested for backup. The keyranges covered by
	// `files` may be a subset of this if there were ranges with no changes since
	// the last backup.
	Spans         []cockroach_roachpb1.Span                           `protobuf:"bytes,3,rep,name=spans" json:"spans"`
	Files         []BackupDescriptor_File                             `protobuf:"bytes,4,rep,name=files" json:"files"`
	Descriptors   []cockroach_sql_sqlbase1.Descriptor                 `protobuf:"bytes,5,rep,name=descriptors" json:"descriptors"`
	DataSize      int64                                               `protobuf:"varint,6,opt,name=data_size,json=dataSize,proto3" json:"data_size,omitempty"`
	Dir           cockroach_roachpb3.ExportStorage                    `protobuf:"bytes,7,opt,name=dir" json:"dir"`
	FormatVersion uint32                                              `protobuf:"varint,8,opt,name=format_version,json=formatVersion,proto3" json:"format_version,omitempty"`
	ClusterID     github_com_cockroachdb_cockroach_pkg_util_uuid.UUID `` /* 141-byte string literal not displayed */
	// node_id and build_info of the gateway node (which writes the descriptor).
	NodeID    github_com_cockroachdb_cockroach_pkg_roachpb.NodeID `` /* 142-byte string literal not displayed */
	BuildInfo cockroach_build.Info                                `protobuf:"bytes,11,opt,name=build_info,json=buildInfo" json:"build_info"`
}

BackupDescriptor represents a consistent snapshot of ranges.

Each range snapshot includes a path to data that is a diff of the data in that key range between a start and end timestamp. The end timestamp of all ranges in a backup is the same, but the start may vary (to allow individual tables to be backed up on different schedules).

func Backup

func Backup(
	ctx context.Context,
	p sql.PlanHookState,
	uri string,
	targets parser.TargetList,
	startTime, endTime hlc.Timestamp,
	_ parser.KVOptions,
	jobLogger *sql.JobLogger,
) (BackupDescriptor, error)

Backup exports a snapshot of every kv entry into ranged sstables.

The output is an sstable per range with files in the following locations:

  • <dir>/<unique_int>.sst
  • <dir> is given by the user and may be cloud storage
  • Each file contains data for a key range that doesn't overlap with any other file.

func Load

func Load(
	ctx context.Context,
	db *gosql.DB,
	r io.Reader,
	database, uri string,
	ts hlc.Timestamp,
	loadChunkBytes int64,
	tempPrefix string,
) (BackupDescriptor, error)

Load converts r into SSTables and backup descriptors. database is the name of the database into which the SSTables will eventually be written. uri is the storage location. ts is the time at which the MVCC data will be set. loadChunkBytes is the size at which to create a new SSTable (which will translate into a new range during restore); set to 0 to use the zone's default range max / 2.

func (*BackupDescriptor) Descriptor

func (*BackupDescriptor) Descriptor() ([]byte, []int)

func (*BackupDescriptor) Marshal

func (m *BackupDescriptor) Marshal() (dAtA []byte, err error)

func (*BackupDescriptor) MarshalTo

func (m *BackupDescriptor) MarshalTo(dAtA []byte) (int, error)

func (*BackupDescriptor) ProtoMessage

func (*BackupDescriptor) ProtoMessage()

func (*BackupDescriptor) Reset

func (m *BackupDescriptor) Reset()

func (*BackupDescriptor) Size

func (m *BackupDescriptor) Size() (n int)

func (*BackupDescriptor) String

func (m *BackupDescriptor) String() string

func (*BackupDescriptor) Unmarshal

func (m *BackupDescriptor) Unmarshal(dAtA []byte) error

type BackupDescriptor_File

type BackupDescriptor_File struct {
	Span   cockroach_roachpb1.Span `protobuf:"bytes,1,opt,name=span" json:"span"`
	Path   string                  `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Sha512 []byte                  `protobuf:"bytes,4,opt,name=sha512,proto3" json:"sha512,omitempty"`
}

BackupDescriptor_File represents a file that contains the diff for a key range between two timestamps.

func (*BackupDescriptor_File) Descriptor

func (*BackupDescriptor_File) Descriptor() ([]byte, []int)

func (*BackupDescriptor_File) Marshal

func (m *BackupDescriptor_File) Marshal() (dAtA []byte, err error)

func (*BackupDescriptor_File) MarshalTo

func (m *BackupDescriptor_File) MarshalTo(dAtA []byte) (int, error)

func (*BackupDescriptor_File) ProtoMessage

func (*BackupDescriptor_File) ProtoMessage()

func (*BackupDescriptor_File) Reset

func (m *BackupDescriptor_File) Reset()

func (*BackupDescriptor_File) Size

func (m *BackupDescriptor_File) Size() (n int)

func (*BackupDescriptor_File) String

func (m *BackupDescriptor_File) String() string

func (*BackupDescriptor_File) Unmarshal

func (m *BackupDescriptor_File) Unmarshal(dAtA []byte) error

Jump to

Keyboard shortcuts

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