-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathrecovery.proto
87 lines (79 loc) · 3.93 KB
/
recovery.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright 2021 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
syntax = "proto3";
package cockroach.kv.kvserver.loqrecovery.loqrecoverypb;
option go_package = "loqrecoverypb";
import "roachpb/api.proto";
import "roachpb/metadata.proto";
import "gogoproto/gogo.proto";
// ReplicaInfo contains info about state of range replica for the purpose of range
// recovery. This information should be enough for recovery algorithm to pick a
// survivor replica in when not replicas are available.
// Information includes range descriptor as well as parts of raft state.
message ReplicaInfo {
int32 node_id = 1 [(gogoproto.customname) = "NodeID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"];
int32 store_id = 2 [(gogoproto.customname) = "StoreID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.StoreID"];
roachpb.RangeDescriptor desc = 3 [(gogoproto.nullable) = false];
uint64 raft_applied_index = 4;
uint64 raft_committed_index = 5;
bool has_uncommitted_descriptors = 6;
}
// Collection of replica information gathered from a collect-info run on a single node.
message NodeReplicaInfo {
repeated ReplicaInfo replicas = 1 [(gogoproto.nullable) = false];
}
// ReplicaUpdate contains information that needs to be updated on replica on the node
// to make it a designated survivor so that replica could act as a source of truth when
// doing loss of quorum recovery.
message ReplicaUpdate {
option (gogoproto.goproto_stringer) = false;
int64 range_id = 1 [(gogoproto.customname) = "RangeID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID",
(gogoproto.moretags) = "yaml:\"RangeID\""];
bytes start_key = 2 [
(gogoproto.casttype) = "RecoveryKey",
(gogoproto.moretags) = "yaml:\"StartKey\""];
int32 old_replica_id = 3 [(gogoproto.customname) = "OldReplicaID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.ReplicaID",
(gogoproto.moretags) = "yaml:\"OldReplicaID\""];
roachpb.ReplicaDescriptor new_replica = 4 [(gogoproto.moretags) = "yaml:\"NewReplica\""];
int32 next_replica_id = 5 [(gogoproto.customname) = "NextReplicaID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.ReplicaID",
(gogoproto.moretags) = "yaml:\"NextReplicaID\""];
}
// ReplicaUpdatePlan Collection of updates for all recoverable replicas in the cluster.
message ReplicaUpdatePlan {
repeated ReplicaUpdate updates = 1 [(gogoproto.nullable) = false];
}
// ReplicaRecoveryRecord is a struct that loss of quorum recovery commands
// write to the store locally when replicas are rewritten to preserve information
// about changes. This records are then consumed on startup to post data to
// appropriate destinations like log, rangelog etc.
// This struct is a union of all necessary information that is needed by all
// downstream destinations.
message ReplicaRecoveryRecord {
// timestamp is unix time in nanos
int64 timestamp = 1;
int64 range_id = 2 [(gogoproto.customname) = "RangeID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID",
(gogoproto.moretags) = "yaml:\"RangeID\""];
bytes start_key = 3 [
(gogoproto.casttype) = "RecoveryKey",
(gogoproto.moretags) = "yaml:\"StartKey\""];
bytes end_key = 4 [
(gogoproto.casttype) = "RecoveryKey",
(gogoproto.moretags) = "yaml:\"StartKey\""];
int32 old_replica_id = 5 [(gogoproto.customname) = "OldReplicaID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.ReplicaID",
(gogoproto.moretags) = "yaml:\"OldReplicaID\""];
roachpb.ReplicaDescriptor new_replica = 6 [(gogoproto.moretags) = "yaml:\"NewReplica\""];
}