cockroach: github.com/cockroachdb/cockroach/pkg/ccl/backupccl Index | Files

package backupccl

import "github.com/cockroachdb/cockroach/pkg/ccl/backupccl"

Index

Package Files

backup.pb.go backup_job.go backup_planning.go manifest_handling.go restore_job.go restore_planning.go show.go targets.go

Constants

const (
    // BackupManifestName is the file name used for serialized
    // BackupManifest protos.
    BackupManifestName = "BACKUP"
    // BackupNewManifestName is a future name for the serialized
    // BackupManifest proto.
    BackupNewManifestName = "BACKUP_MANIFEST"

    // BackupPartitionDescriptorPrefix is the file name prefix for serialized
    // BackupPartitionDescriptor protos.
    BackupPartitionDescriptorPrefix = "BACKUP_PART"
    // BackupManifestCheckpointName is the file name used to store the
    // serialized BackupManifest proto while the backup is in progress.
    BackupManifestCheckpointName = "BACKUP-CHECKPOINT"
    // BackupFormatDescriptorTrackingVersion added tracking of complete DBs.
    BackupFormatDescriptorTrackingVersion uint32 = 1
)

Variables

var (
    ErrInvalidLengthBackup = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowBackup   = fmt.Errorf("proto: integer overflow")
)
var BackupCheckpointInterval = time.Minute

BackupCheckpointInterval is the interval at which backup progress is saved to durable storage.

var EncryptionInfo_Scheme_name = map[int32]string{
    0: "AES256GCM",
}
var EncryptionInfo_Scheme_value = map[string]int32{
    "AES256GCM": 0,
}
var MVCCFilter_name = map[int32]string{
    0:  "Latest",
    1:  "All",
}
var MVCCFilter_value = map[string]int32{
    "Latest": 0,
    "All":    1,
}
var RestoreHeader = sqlbase.ResultColumns{
    {Name: "job_id", Typ: types.Int},
    {Name: "status", Typ: types.String},
    {Name: "fraction_completed", Typ: types.Float},
    {Name: "rows", Typ: types.Int},
    {Name: "index_entries", Typ: types.Int},
    {Name: "bytes", Typ: types.Int},
}

RestoreHeader is the header for RESTORE stmt results.

func CheckTableExists Uses

func CheckTableExists(
    ctx context.Context, txn *client.Txn, parentID sqlbase.ID, name string,
) error

CheckTableExists returns an error if a table already exists with given parent and name.

func ResolveTargetsToDescriptors Uses

func ResolveTargetsToDescriptors(
    ctx context.Context,
    p sql.PlanHookState,
    endTime hlc.Timestamp,
    targets tree.TargetList,
    descriptorCoverage tree.DescriptorCoverage,
) ([]sqlbase.Descriptor, []sqlbase.ID, error)

ResolveTargetsToDescriptors performs name resolution on a set of targets and returns the resulting descriptors.

func RewriteTableDescs Uses

func RewriteTableDescs(
    tables []*sqlbase.TableDescriptor, tableRewrites TableRewriteMap, overrideDB string,
) error

RewriteTableDescs mutates tables to match the ID and privilege specified in tableRewrites, as well as adjusting cross-table references to use the new IDs. overrideDB can be specified to set database names in views.

func VerifyUsableExportTarget Uses

func VerifyUsableExportTarget(
    ctx context.Context,
    settings *cluster.Settings,
    exportStore cloud.ExternalStorage,
    readable string,
    encryption *roachpb.FileEncryptionOptions,
) error

VerifyUsableExportTarget ensures that the target location does not already contain a BACKUP or checkpoint and writes an empty checkpoint, both verifying that the location is writable and locking out accidental concurrent operations on that location if subsequently try this check. Callers must clean up the written checkpoint file (BackupManifestCheckpointName) only after writing to the backup file location (BackupManifestName).

func WriteTableDescs Uses

func WriteTableDescs(
    ctx context.Context,
    txn *client.Txn,
    databases []*sqlbase.DatabaseDescriptor,
    tables []*sqlbase.TableDescriptor,
    descCoverage tree.DescriptorCoverage,
    user string,
    settings *cluster.Settings,
    extra []roachpb.KeyValue,
) error

WriteTableDescs writes all the the new descriptors: First the ID -> TableDescriptor for the new table, then flip (or initialize) the name -> ID entry so any new queries will use the new one. The tables are assigned the permissions of their parent database and the user must have CREATE permission on that database at the time this function is called.

type BackupFileDescriptors Uses

type BackupFileDescriptors []BackupManifest_File

BackupFileDescriptors is an alias on which to implement sort's interface.

func (BackupFileDescriptors) Len Uses

func (r BackupFileDescriptors) Len() int

func (BackupFileDescriptors) Less Uses

func (r BackupFileDescriptors) Less(i, j int) bool

func (BackupFileDescriptors) Swap Uses

func (r BackupFileDescriptors) Swap(i, j int)

type BackupManifest Uses

type BackupManifest struct {
    StartTime  hlc.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time"`
    EndTime    hlc.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time"`
    MVCCFilter MVCCFilter    `protobuf:"varint,13,opt,name=mvcc_filter,json=mvccFilter,proto3,enum=cockroach.ccl.backupccl.MVCCFilter" json:"mvcc_filter,omitempty"`
    // Even if StartTime is zero, we only get revisions since gc threshold, so
    // do not allow AS OF SYSTEM TIME before revision_start_time.
    RevisionStartTime hlc.Timestamp `protobuf:"bytes,17,opt,name=revision_start_time,json=revisionStartTime,proto3" json:"revision_start_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. For all tables in the backup descriptor, these spans must
    // completely cover each table's span. For example, if a table with ID 51 were
    // being backed up, then the span `/Table/5{1-2}` must be completely covered.
    Spans []roachpb.Span `protobuf:"bytes,3,rep,name=spans,proto3" json:"spans"`
    // IntroducedSpans are a subset of spans, set only when creating incremental
    // backups that cover spans not included in a previous backup. Spans contained
    // here are covered in the interval (0, startTime], which, in conjunction with
    // the coverage from (startTime, endTime] implied for all spans in Spans,
    // results in coverage from [0, endTime] for these spans.
    IntroducedSpans   []roachpb.Span                      `protobuf:"bytes,15,rep,name=introduced_spans,json=introducedSpans,proto3" json:"introduced_spans"`
    DescriptorChanges []BackupManifest_DescriptorRevision `protobuf:"bytes,16,rep,name=descriptor_changes,json=descriptorChanges,proto3" json:"descriptor_changes"`
    Files             []BackupManifest_File               `protobuf:"bytes,4,rep,name=files,proto3" json:"files"`
    Descriptors       []sqlbase.Descriptor                `protobuf:"bytes,5,rep,name=descriptors,proto3" json:"descriptors"`
    // databases in descriptors that have all tables also in descriptors.
    CompleteDbs   []github_com_cockroachdb_cockroach_pkg_sql_sqlbase.ID `protobuf:"varint,14,rep,packed,name=complete_dbs,json=completeDbs,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/sqlbase.ID" json:"complete_dbs,omitempty"`
    EntryCounts   roachpb.BulkOpSummary                                 `protobuf:"bytes,12,opt,name=entry_counts,json=entryCounts,proto3" json:"entry_counts"`
    Dir           roachpb.ExternalStorage                               `protobuf:"bytes,7,opt,name=dir,proto3" 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   `protobuf:"bytes,9,opt,name=cluster_id,json=clusterId,proto3,customtype=github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" json:"cluster_id"`
    // node_id and build_info of the gateway node (which writes the descriptor).
    NodeID                       github_com_cockroachdb_cockroach_pkg_roachpb.NodeID                  `protobuf:"varint,10,opt,name=node_id,json=nodeId,proto3,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" json:"node_id,omitempty"`
    BuildInfo                    build.Info                                                           `protobuf:"bytes,11,opt,name=build_info,json=buildInfo,proto3" json:"build_info"`
    ID                           github_com_cockroachdb_cockroach_pkg_util_uuid.UUID                  `protobuf:"bytes,18,opt,name=id,proto3,customtype=github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" json:"id"`
    PartitionDescriptorFilenames []string                                                             `protobuf:"bytes,19,rep,name=partition_descriptor_filenames,json=partitionDescriptorFilenames,proto3" json:"partition_descriptor_filenames,omitempty"`
    LocalityKVs                  []string                                                             `protobuf:"bytes,20,rep,name=locality_kvs,json=localityKvs,proto3" json:"locality_kvs,omitempty"`
    Statistics                   []*stats.TableStatisticProto                                         `protobuf:"bytes,21,rep,name=statistics,proto3" json:"statistics,omitempty"`
    DescriptorCoverage           github_com_cockroachdb_cockroach_pkg_sql_sem_tree.DescriptorCoverage `protobuf:"varint,22,opt,name=descriptor_coverage,json=descriptorCoverage,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/sem/tree.DescriptorCoverage" json:"descriptor_coverage,omitempty"`
}

BackupManifest 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 ReadBackupManifestFromURI Uses

func ReadBackupManifestFromURI(
    ctx context.Context,
    uri string,
    makeExternalStorageFromURI cloud.ExternalStorageFromURIFactory,
    encryption *roachpb.FileEncryptionOptions,
) (BackupManifest, error)

ReadBackupManifestFromURI creates an export store from the given URI, then reads and unmarshals a BackupManifest at the standard location in the export storage.

func (*BackupManifest) Descriptor Uses

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

func (*BackupManifest) Marshal Uses

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

func (*BackupManifest) MarshalTo Uses

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

func (*BackupManifest) ProtoMessage Uses

func (*BackupManifest) ProtoMessage()

func (*BackupManifest) Reset Uses

func (m *BackupManifest) Reset()

func (*BackupManifest) Size Uses

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

func (*BackupManifest) String Uses

func (m *BackupManifest) String() string

func (*BackupManifest) Unmarshal Uses

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

func (*BackupManifest) XXX_DiscardUnknown Uses

func (m *BackupManifest) XXX_DiscardUnknown()

func (*BackupManifest) XXX_Marshal Uses

func (m *BackupManifest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BackupManifest) XXX_Merge Uses

func (dst *BackupManifest) XXX_Merge(src proto.Message)

func (*BackupManifest) XXX_Size Uses

func (m *BackupManifest) XXX_Size() int

func (*BackupManifest) XXX_Unmarshal Uses

func (m *BackupManifest) XXX_Unmarshal(b []byte) error

type BackupManifest_DescriptorRevision Uses

type BackupManifest_DescriptorRevision struct {
    Time hlc.Timestamp                                       `protobuf:"bytes,1,opt,name=time,proto3" json:"time"`
    ID   github_com_cockroachdb_cockroach_pkg_sql_sqlbase.ID `protobuf:"varint,2,opt,name=ID,proto3,casttype=github.com/cockroachdb/cockroach/pkg/sql/sqlbase.ID" json:"ID,omitempty"`
    Desc *sqlbase.Descriptor                                 `protobuf:"bytes,3,opt,name=desc,proto3" json:"desc,omitempty"`
}

func (*BackupManifest_DescriptorRevision) Descriptor Uses

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

func (*BackupManifest_DescriptorRevision) Marshal Uses

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

func (*BackupManifest_DescriptorRevision) MarshalTo Uses

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

func (*BackupManifest_DescriptorRevision) ProtoMessage Uses

func (*BackupManifest_DescriptorRevision) ProtoMessage()

func (*BackupManifest_DescriptorRevision) Reset Uses

func (m *BackupManifest_DescriptorRevision) Reset()

func (*BackupManifest_DescriptorRevision) Size Uses

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

func (*BackupManifest_DescriptorRevision) String Uses

func (m *BackupManifest_DescriptorRevision) String() string

func (*BackupManifest_DescriptorRevision) Unmarshal Uses

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

func (*BackupManifest_DescriptorRevision) XXX_DiscardUnknown Uses

func (m *BackupManifest_DescriptorRevision) XXX_DiscardUnknown()

func (*BackupManifest_DescriptorRevision) XXX_Marshal Uses

func (m *BackupManifest_DescriptorRevision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BackupManifest_DescriptorRevision) XXX_Merge Uses

func (dst *BackupManifest_DescriptorRevision) XXX_Merge(src proto.Message)

func (*BackupManifest_DescriptorRevision) XXX_Size Uses

func (m *BackupManifest_DescriptorRevision) XXX_Size() int

func (*BackupManifest_DescriptorRevision) XXX_Unmarshal Uses

func (m *BackupManifest_DescriptorRevision) XXX_Unmarshal(b []byte) error

type BackupManifest_File Uses

type BackupManifest_File struct {
    Span        roachpb.Span          `protobuf:"bytes,1,opt,name=span,proto3" 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"`
    EntryCounts roachpb.BulkOpSummary `protobuf:"bytes,6,opt,name=entry_counts,json=entryCounts,proto3" json:"entry_counts"`
    // StartTime 0 is sometimes legitimately used, so it is only meaningful if
    // EndTime is non-zero, otherwise both just inherit from containing backup.
    StartTime  hlc.Timestamp `protobuf:"bytes,7,opt,name=start_time,json=startTime,proto3" json:"start_time"`
    EndTime    hlc.Timestamp `protobuf:"bytes,8,opt,name=end_time,json=endTime,proto3" json:"end_time"`
    LocalityKV string        `protobuf:"bytes,9,opt,name=locality_kv,json=localityKv,proto3" json:"locality_kv,omitempty"`
}

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

func (*BackupManifest_File) Descriptor Uses

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

func (*BackupManifest_File) Marshal Uses

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

func (*BackupManifest_File) MarshalTo Uses

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

func (*BackupManifest_File) ProtoMessage Uses

func (*BackupManifest_File) ProtoMessage()

func (*BackupManifest_File) Reset Uses

func (m *BackupManifest_File) Reset()

func (*BackupManifest_File) Size Uses

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

func (*BackupManifest_File) String Uses

func (m *BackupManifest_File) String() string

func (*BackupManifest_File) Unmarshal Uses

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

func (*BackupManifest_File) XXX_DiscardUnknown Uses

func (m *BackupManifest_File) XXX_DiscardUnknown()

func (*BackupManifest_File) XXX_Marshal Uses

func (m *BackupManifest_File) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BackupManifest_File) XXX_Merge Uses

func (dst *BackupManifest_File) XXX_Merge(src proto.Message)

func (*BackupManifest_File) XXX_Size Uses

func (m *BackupManifest_File) XXX_Size() int

func (*BackupManifest_File) XXX_Unmarshal Uses

func (m *BackupManifest_File) XXX_Unmarshal(b []byte) error

type BackupPartitionDescriptor Uses

type BackupPartitionDescriptor struct {
    LocalityKV string                                              `protobuf:"bytes,1,opt,name=locality_kv,json=localityKv,proto3" json:"locality_kv,omitempty"`
    Files      []BackupManifest_File                               `protobuf:"bytes,2,rep,name=files,proto3" json:"files"`
    BackupID   github_com_cockroachdb_cockroach_pkg_util_uuid.UUID `protobuf:"bytes,3,opt,name=backup_id,json=backupId,proto3,customtype=github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" json:"backup_id"`
}

func (*BackupPartitionDescriptor) Descriptor Uses

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

func (*BackupPartitionDescriptor) Marshal Uses

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

func (*BackupPartitionDescriptor) MarshalTo Uses

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

func (*BackupPartitionDescriptor) ProtoMessage Uses

func (*BackupPartitionDescriptor) ProtoMessage()

func (*BackupPartitionDescriptor) Reset Uses

func (m *BackupPartitionDescriptor) Reset()

func (*BackupPartitionDescriptor) Size Uses

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

func (*BackupPartitionDescriptor) String Uses

func (m *BackupPartitionDescriptor) String() string

func (*BackupPartitionDescriptor) Unmarshal Uses

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

func (*BackupPartitionDescriptor) XXX_DiscardUnknown Uses

func (m *BackupPartitionDescriptor) XXX_DiscardUnknown()

func (*BackupPartitionDescriptor) XXX_Marshal Uses

func (m *BackupPartitionDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BackupPartitionDescriptor) XXX_Merge Uses

func (dst *BackupPartitionDescriptor) XXX_Merge(src proto.Message)

func (*BackupPartitionDescriptor) XXX_Size Uses

func (m *BackupPartitionDescriptor) XXX_Size() int

func (*BackupPartitionDescriptor) XXX_Unmarshal Uses

func (m *BackupPartitionDescriptor) XXX_Unmarshal(b []byte) error

type EncryptionInfo Uses

type EncryptionInfo struct {
    Scheme EncryptionInfo_Scheme `protobuf:"varint,1,opt,name=scheme,proto3,enum=cockroach.ccl.backupccl.EncryptionInfo_Scheme" json:"scheme,omitempty"`
    Salt   []byte                `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"`
}

EncryptionInfo is stored IN PLAINTEXT along side collections of encrypted files stored outside of cockroach, for example by BACKUP/RESTORE.

func (*EncryptionInfo) Descriptor Uses

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

func (*EncryptionInfo) Equal Uses

func (this *EncryptionInfo) Equal(that interface{}) bool

func (*EncryptionInfo) Marshal Uses

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

func (*EncryptionInfo) MarshalTo Uses

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

func (*EncryptionInfo) ProtoMessage Uses

func (*EncryptionInfo) ProtoMessage()

func (*EncryptionInfo) Reset Uses

func (m *EncryptionInfo) Reset()

func (*EncryptionInfo) Size Uses

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

func (*EncryptionInfo) String Uses

func (m *EncryptionInfo) String() string

func (*EncryptionInfo) Unmarshal Uses

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

func (*EncryptionInfo) XXX_DiscardUnknown Uses

func (m *EncryptionInfo) XXX_DiscardUnknown()

func (*EncryptionInfo) XXX_Marshal Uses

func (m *EncryptionInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EncryptionInfo) XXX_Merge Uses

func (dst *EncryptionInfo) XXX_Merge(src proto.Message)

func (*EncryptionInfo) XXX_Size Uses

func (m *EncryptionInfo) XXX_Size() int

func (*EncryptionInfo) XXX_Unmarshal Uses

func (m *EncryptionInfo) XXX_Unmarshal(b []byte) error

type EncryptionInfo_Scheme Uses

type EncryptionInfo_Scheme int32
const (
    EncryptionInfo_AES256GCM EncryptionInfo_Scheme = 0
)

func (EncryptionInfo_Scheme) EnumDescriptor Uses

func (EncryptionInfo_Scheme) EnumDescriptor() ([]byte, []int)

func (EncryptionInfo_Scheme) String Uses

func (x EncryptionInfo_Scheme) String() string

type MVCCFilter Uses

type MVCCFilter int32
const (
    MVCCFilter_Latest MVCCFilter = 0
    MVCCFilter_All    MVCCFilter = 1
)

func (MVCCFilter) EnumDescriptor Uses

func (MVCCFilter) EnumDescriptor() ([]byte, []int)

func (MVCCFilter) String Uses

func (x MVCCFilter) String() string

type TableRewriteMap Uses

type TableRewriteMap map[sqlbase.ID]*jobspb.RestoreDetails_TableRewrite

TableRewriteMap maps old table IDs to new table and parent IDs.

Package backupccl imports 49 packages (graph) and is imported by 28 packages. Updated 2020-02-17. Refresh now. Tools for package owners.