Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage,roachpb: proto changes for learners #38147

Merged
merged 2 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 54 additions & 9 deletions c-deps/libroach/protos/roachpb/metadata.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions c-deps/libroach/protos/roachpb/metadata.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions pkg/roachpb/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ func (r *RangeDescriptor) AddReplica(toAdd ReplicaDescriptor) {
r.SetReplicas(rs)
}

// RemoveReplica removes the given replica from this range's set. If it wasn't
// found to remove, false is returned.
func (r *RangeDescriptor) RemoveReplica(toRemove ReplicaDescriptor) bool {
// RemoveReplica removes the matching replica from this range's set and returns
// it. If it wasn't found to remove, false is returned.
func (r *RangeDescriptor) RemoveReplica(nodeID NodeID, storeID StoreID) (ReplicaDescriptor, bool) {
rs := r.Replicas()
found := rs.RemoveReplica(toRemove)
if found {
removedRepl, ok := rs.RemoveReplica(nodeID, storeID)
if ok {
r.SetReplicas(rs)
}
return found
return removedRepl, ok
}

// GetReplicaDescriptor returns the replica which matches the specified store
Expand Down Expand Up @@ -259,6 +259,9 @@ func (r ReplicaDescriptor) String() string {
} else {
fmt.Fprintf(&buf, "%d", r.ReplicaID)
}
if r.Type == ReplicaType_LEARNER {
buf.WriteString("LEARNER")
}
return buf.String()
}

Expand Down
Loading