github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ccl/backupccl/backup.proto (about)

     1  // Copyright 2016 The Cockroach Authors.
     2  //
     3  // Licensed as a CockroachDB Enterprise file under the Cockroach Community
     4  // License (the "License"); you may not use this file except in compliance with
     5  // the License. You may obtain a copy of the License at
     6  //
     7  //     https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt
     8  
     9  syntax = "proto3";
    10  package cockroach.ccl.backupccl;
    11  option go_package = "backupccl";
    12  
    13  import "build/info.proto";
    14  import "roachpb/api.proto";
    15  import "roachpb/data.proto";
    16  import "sql/stats/table_statistic.proto";
    17  import "sql/sqlbase/structured.proto";
    18  import "util/hlc/timestamp.proto";
    19  import "gogoproto/gogo.proto";
    20  
    21  enum MVCCFilter {
    22    Latest = 0;
    23    All = 1;
    24  }
    25  
    26  // RowCount tracks the size and row/index entry counts.
    27  message RowCount {
    28    int64 data_size = 1;
    29    int64 rows = 2;
    30    int64 index_entries = 3;
    31    reserved 4; // was BulkOpSummary's system_records.
    32  }
    33  
    34  // BackupManifest represents a consistent snapshot of ranges.
    35  //
    36  // Each range snapshot includes a path to data that is a diff of the data in
    37  // that key range between a start and end timestamp. The end timestamp of all
    38  // ranges in a backup is the same, but the start may vary (to allow individual
    39  // tables to be backed up on different schedules).
    40  message BackupManifest {
    41    // BackupManifest_File represents a file that contains the diff for a key
    42    // range between two timestamps.
    43    message File {
    44      roachpb.Span span = 1 [(gogoproto.nullable) = false];
    45      string path = 2;
    46      reserved 3;
    47      bytes sha512 = 4;
    48      reserved 5;
    49      RowCount entry_counts = 6 [(gogoproto.nullable) = false];
    50  
    51      // StartTime 0 is sometimes legitimately used, so it is only meaningful if
    52      // EndTime is non-zero, otherwise both just inherit from containing backup.
    53      util.hlc.Timestamp start_time = 7 [(gogoproto.nullable) = false];
    54      util.hlc.Timestamp end_time = 8 [(gogoproto.nullable) = false];
    55      string locality_kv = 9 [(gogoproto.customname) = "LocalityKV"];
    56    }
    57  
    58    message DescriptorRevision {
    59      util.hlc.Timestamp time = 1 [(gogoproto.nullable) = false];
    60      uint32 ID = 2 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/sqlbase.ID"];
    61      sql.sqlbase.Descriptor desc = 3;
    62    }
    63  
    64    util.hlc.Timestamp start_time = 1 [(gogoproto.nullable) = false];
    65    util.hlc.Timestamp end_time = 2 [(gogoproto.nullable) = false];
    66    MVCCFilter mvcc_filter = 13 [(gogoproto.customname) = "MVCCFilter"];
    67    // Even if StartTime is zero, we only get revisions since gc threshold, so
    68    // do not allow AS OF SYSTEM TIME before revision_start_time.
    69    util.hlc.Timestamp revision_start_time = 17 [(gogoproto.nullable) = false];
    70  
    71    // Spans contains the spans requested for backup. The keyranges covered by
    72    // `files` may be a subset of this if there were ranges with no changes since
    73    // the last backup. For all tables in the backup descriptor, these spans must
    74    // completely cover each table's span. For example, if a table with ID 51 were
    75    // being backed up, then the span `/Table/5{1-2}` must be completely covered.
    76    repeated roachpb.Span spans = 3 [(gogoproto.nullable) = false];
    77  
    78    // IntroducedSpans are a subset of spans, set only when creating incremental
    79    // backups that cover spans not included in a previous backup. Spans contained
    80    // here are covered in the interval (0, startTime], which, in conjunction with
    81    // the coverage from (startTime, endTime] implied for all spans in Spans,
    82    // results in coverage from [0, endTime] for these spans.
    83    repeated roachpb.Span introduced_spans = 15 [(gogoproto.nullable) = false];
    84  
    85    repeated DescriptorRevision descriptor_changes = 16  [(gogoproto.nullable) = false];
    86  
    87    repeated File files = 4 [(gogoproto.nullable) = false];
    88    repeated sql.sqlbase.Descriptor descriptors = 5 [(gogoproto.nullable) = false];
    89    // databases in descriptors that have all tables also in descriptors.
    90    repeated uint32 complete_dbs = 14 [
    91      (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/sqlbase.ID"];
    92    reserved 6;
    93    RowCount entry_counts = 12 [(gogoproto.nullable) = false];
    94  
    95    roachpb.ExternalStorage dir = 7 [(gogoproto.nullable) = false];
    96  
    97    uint32 format_version = 8;
    98  
    99    bytes cluster_id = 9 [(gogoproto.nullable) = false, (gogoproto.customname) = "ClusterID",
   100      (gogoproto.customtype) = "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID"];
   101  
   102    // node_id and build_info of the gateway node (which writes the descriptor).
   103    int32 node_id = 10 [(gogoproto.customname) = "NodeID",
   104      (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"];
   105    build.Info build_info = 11 [(gogoproto.nullable) = false];
   106  
   107    bytes id = 18 [(gogoproto.nullable) = false,
   108                  (gogoproto.customname) = "ID",
   109                  (gogoproto.customtype) = "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID"];
   110    repeated string partition_descriptor_filenames = 19;
   111    repeated string locality_kvs = 20 [(gogoproto.customname) = "LocalityKVs"];
   112    repeated sql.stats.TableStatisticProto statistics = 21;
   113    int32 descriptor_coverage = 22 [
   114      (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/sem/tree.DescriptorCoverage"];
   115  }
   116  
   117  message BackupPartitionDescriptor{
   118    string locality_kv = 1 [(gogoproto.customname) = "LocalityKV"];
   119    repeated BackupManifest.File files = 2 [(gogoproto.nullable) = false];
   120    bytes backup_id = 3 [(gogoproto.nullable) = false,
   121                        (gogoproto.customname) = "BackupID",
   122                        (gogoproto.customtype) = "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID"];
   123  }
   124  
   125  
   126  // EncryptionInfo is stored IN PLAINTEXT along side collections of encrypted
   127  // files stored outside of cockroach, for example by BACKUP/RESTORE.
   128  message EncryptionInfo {
   129    enum Scheme {
   130      AES256GCM = 0;
   131    }
   132    option (gogoproto.equal) = true;
   133  
   134    Scheme scheme = 1;
   135    bytes salt = 2;
   136  }