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
- Variables
- func Import(ctx context.Context, db client.DB, startKey, endKey roachpb.Key, ...) error
- func MakeKeyRewriterForNewTableID(desc *sqlbase.TableDescriptor, newTableID sqlbase.ID) storageccl.KeyRewriter
- func MakeKeyRewriterForNewTableIDs(tables []*sqlbase.TableDescriptor, newTableIDs map[sqlbase.ID]sqlbase.ID) (storageccl.KeyRewriter, error)
- func Restore(ctx context.Context, db client.DB, uris []string, targets parser.TargetList) ([]sqlbase.TableDescriptor, error)
- func ValidatePreviousBackups(ctx context.Context, uris []string) (hlc.Timestamp, error)
- type BackupDescriptor
- func Backup(ctx context.Context, db client.DB, uri string, targets parser.TargetList, ...) (BackupDescriptor, error)
- func Load(ctx context.Context, db *gosql.DB, r io.Reader, database, uri string, ...) (BackupDescriptor, error)
- func ReadBackupDescriptor(ctx context.Context, dir storageccl.ExportStorage) (BackupDescriptor, error)
- func (*BackupDescriptor) Descriptor() ([]byte, []int)
- func (m *BackupDescriptor) Marshal() (dAtA []byte, err error)
- func (m *BackupDescriptor) MarshalTo(dAtA []byte) (int, error)
- func (*BackupDescriptor) ProtoMessage()
- func (m *BackupDescriptor) Reset()
- func (m *BackupDescriptor) Size() (n int)
- func (m *BackupDescriptor) String() string
- func (m *BackupDescriptor) Unmarshal(dAtA []byte) error
- type BackupDescriptor_File
- func (*BackupDescriptor_File) Descriptor() ([]byte, []int)
- func (m *BackupDescriptor_File) Marshal() (dAtA []byte, err error)
- func (m *BackupDescriptor_File) MarshalTo(dAtA []byte) (int, error)
- func (*BackupDescriptor_File) ProtoMessage()
- func (m *BackupDescriptor_File) Reset()
- func (m *BackupDescriptor_File) Size() (n int)
- func (m *BackupDescriptor_File) String() string
- func (m *BackupDescriptor_File) Unmarshal(dAtA []byte) error
Constants ¶
const ( // BackupDescriptorName is the file name used for serialized // BackupDescriptor protos. BackupDescriptorName = "BACKUP" )
Variables ¶
var ( ErrInvalidLengthBackup = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowBackup = fmt.Errorf("proto: integer overflow") )
Functions ¶
func Import ¶
func Import( ctx context.Context, db client.DB, startKey, endKey roachpb.Key, files []importFile, kr storageccl.KeyRewriter, ) error
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.KeyRewriter
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 MakeKeyRewriterForNewTableIDs ¶
func MakeKeyRewriterForNewTableIDs( tables []*sqlbase.TableDescriptor, newTableIDs map[sqlbase.ID]sqlbase.ID, ) (storageccl.KeyRewriter, error)
MakeKeyRewriterForNewTableIDs creates a KeyRewriter that rewrites all keys from a set of tables 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, db client.DB, uris []string, targets parser.TargetList, ) ([]sqlbase.TableDescriptor, error)
Restore imports a SQL table (or tables) from sets of non-overlapping sstable files.
func ValidatePreviousBackups ¶
ValidatePreviousBackups checks that the timestamps of previous backups are consistent. The most recently backed-up time is returned.
TODO(dan): This should call into restoreTablesRequests instead to get the full validation logic.
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"` }
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, db client.DB, uri string, targets parser.TargetList, startTime, endTime hlc.Timestamp, ) (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, ) (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 ReadBackupDescriptor ¶
func ReadBackupDescriptor( ctx context.Context, dir storageccl.ExportStorage, ) (BackupDescriptor, error)
ReadBackupDescriptor reads and unmarshals a BackupDescriptor from given base.
func (*BackupDescriptor) Descriptor ¶
func (*BackupDescriptor) Descriptor() ([]byte, []int)
func (*BackupDescriptor) Marshal ¶
func (m *BackupDescriptor) Marshal() (dAtA []byte, err 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"` CRC uint32 `protobuf:"varint,3,opt,name=crc,proto3" json:"crc,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