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, ...) (*roachpb.ImportResponse, error)
- func LoadCSV(ctx context.Context, table string, dataFiles []string, dest string, ...) (csvCount, kvCount, sstCount int64, err error)
- func PresplitRanges(baseCtx context.Context, db client.DB, input []roachpb.Key) error
- func Restore(ctx context.Context, p sql.PlanHookState, uris []string, ...) (roachpb.BulkOpSummary, error)
- func ValidatePreviousBackups(ctx context.Context, uris []string) (hlc.Timestamp, error)
- type BackupDescriptor
- 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" // BackupFormatInitialVersion is the first version of backup and its files. BackupFormatInitialVersion uint32 = 0 )
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 []roachpb.ImportRequest_File, kr *storageccl.KeyRewriter, rekeys []roachpb.ImportRequest_TableRekey, ) (*roachpb.ImportResponse, 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 LoadCSV ¶
func LoadCSV( ctx context.Context, table string, dataFiles []string, dest string, comma, comment rune, nullif *string, sstMaxSize int64, ) (csvCount, kvCount, sstCount int64, err error)
LoadCSV converts CSV files into enterprise backup format.
func PresplitRanges ¶
PresplitRanges concurrently creates the splits described by `input`. It does this by finding the middle key, splitting and recursively presplitting the resulting left and right hand ranges. NB: The split code assumes that the LHS of the resulting ranges is the smaller, so normally you'd split from the left, but this method should only be called on empty keyranges, so it's okay.
The `input` parameter expected to be sorted.
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"` EntryCounts cockroach_roachpb3.BulkOpSummary `protobuf:"bytes,12,opt,name=entry_counts,json=entryCounts" json:"entry_counts"` 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 *jobs.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) 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