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

package backupccl

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

Index

Package Files

backup.go backup.pb.go restore.go show.go targets.go

Constants

const (
    // BackupDescriptorName is the file name used for serialized
    // BackupDescriptor protos.
    BackupDescriptorName = "BACKUP"
    // BackupPartitionDescriptorPrefix is the file name prefix for serialized
    // BackupPartitionDescriptor protos.
    BackupPartitionDescriptorPrefix = "BACKUP_PART"
    // BackupDescriptorCheckpointName is the file name used to store the
    // serialized BackupDescriptor proto while the backup is in progress.
    BackupDescriptorCheckpointName = "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 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: "system_records", 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,
) ([]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 storageccl.ExportStorage,
    readable string,
) 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 (BackupDescriptorCheckpointName) only after writing to the backup file location (BackupDescriptorName).

func WriteTableDescs Uses

func WriteTableDescs(
    ctx context.Context,
    txn *client.Txn,
    databases []*sqlbase.DatabaseDescriptor,
    tables []*sqlbase.TableDescriptor,
    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 BackupDescriptor Uses

type BackupDescriptor 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 []BackupDescriptor_DescriptorRevision `protobuf:"bytes,16,rep,name=descriptor_changes,json=descriptorChanges,proto3" json:"descriptor_changes"`
    Files             []BackupDescriptor_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.ExportStorage                                 `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.TableStatistic                             `protobuf:"bytes,21,rep,name=statistics,proto3" json:"statistics,omitempty"`
}

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 ReadBackupDescriptorFromURI Uses

func ReadBackupDescriptorFromURI(
    ctx context.Context, uri string, settings *cluster.Settings,
) (BackupDescriptor, error)

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

func (*BackupDescriptor) Descriptor Uses

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

func (*BackupDescriptor) Marshal Uses

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

func (*BackupDescriptor) MarshalTo Uses

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

func (*BackupDescriptor) ProtoMessage Uses

func (*BackupDescriptor) ProtoMessage()

func (*BackupDescriptor) Reset Uses

func (m *BackupDescriptor) Reset()

func (*BackupDescriptor) Size Uses

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

func (*BackupDescriptor) String Uses

func (m *BackupDescriptor) String() string

func (*BackupDescriptor) Unmarshal Uses

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

func (*BackupDescriptor) XXX_DiscardUnknown Uses

func (m *BackupDescriptor) XXX_DiscardUnknown()

func (*BackupDescriptor) XXX_Marshal Uses

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

func (*BackupDescriptor) XXX_Merge Uses

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

func (*BackupDescriptor) XXX_Size Uses

func (m *BackupDescriptor) XXX_Size() int

func (*BackupDescriptor) XXX_Unmarshal Uses

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

type BackupDescriptor_DescriptorRevision Uses

type BackupDescriptor_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 (*BackupDescriptor_DescriptorRevision) Descriptor Uses

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

func (*BackupDescriptor_DescriptorRevision) Marshal Uses

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

func (*BackupDescriptor_DescriptorRevision) MarshalTo Uses

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

func (*BackupDescriptor_DescriptorRevision) ProtoMessage Uses

func (*BackupDescriptor_DescriptorRevision) ProtoMessage()

func (*BackupDescriptor_DescriptorRevision) Reset Uses

func (m *BackupDescriptor_DescriptorRevision) Reset()

func (*BackupDescriptor_DescriptorRevision) Size Uses

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

func (*BackupDescriptor_DescriptorRevision) String Uses

func (m *BackupDescriptor_DescriptorRevision) String() string

func (*BackupDescriptor_DescriptorRevision) Unmarshal Uses

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

func (*BackupDescriptor_DescriptorRevision) XXX_DiscardUnknown Uses

func (m *BackupDescriptor_DescriptorRevision) XXX_DiscardUnknown()

func (*BackupDescriptor_DescriptorRevision) XXX_Marshal Uses

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

func (*BackupDescriptor_DescriptorRevision) XXX_Merge Uses

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

func (*BackupDescriptor_DescriptorRevision) XXX_Size Uses

func (m *BackupDescriptor_DescriptorRevision) XXX_Size() int

func (*BackupDescriptor_DescriptorRevision) XXX_Unmarshal Uses

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

type BackupDescriptor_File Uses

type BackupDescriptor_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"`
}

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

func (*BackupDescriptor_File) Descriptor Uses

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

func (*BackupDescriptor_File) Marshal Uses

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

func (*BackupDescriptor_File) MarshalTo Uses

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

func (*BackupDescriptor_File) ProtoMessage Uses

func (*BackupDescriptor_File) ProtoMessage()

func (*BackupDescriptor_File) Reset Uses

func (m *BackupDescriptor_File) Reset()

func (*BackupDescriptor_File) Size Uses

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

func (*BackupDescriptor_File) String Uses

func (m *BackupDescriptor_File) String() string

func (*BackupDescriptor_File) Unmarshal Uses

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

func (*BackupDescriptor_File) XXX_DiscardUnknown Uses

func (m *BackupDescriptor_File) XXX_DiscardUnknown()

func (*BackupDescriptor_File) XXX_Marshal Uses

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

func (*BackupDescriptor_File) XXX_Merge Uses

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

func (*BackupDescriptor_File) XXX_Size Uses

func (m *BackupDescriptor_File) XXX_Size() int

func (*BackupDescriptor_File) XXX_Unmarshal Uses

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

type BackupFileDescriptors Uses

type BackupFileDescriptors []BackupDescriptor_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 BackupPartitionDescriptor Uses

type BackupPartitionDescriptor struct {
    LocalityKV string                                              `protobuf:"bytes,1,opt,name=locality_kv,json=localityKv,proto3" json:"locality_kv,omitempty"`
    Files      []BackupDescriptor_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 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 10 packages. Updated 2019-09-18. Refresh now. Tools for package owners.