Skip to content

Commit

Permalink
roachpb: change ReplicaDescriptor.Type to nullable
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
jeffrey-xiao authored and asubiotto committed Jun 29, 2019
1 parent 06f85cd commit 5968fa5
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 148 deletions.
3 changes: 3 additions & 0 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.

2 changes: 2 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.

10 changes: 9 additions & 1 deletion pkg/roachpb/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (r ReplicaDescriptor) String() string {
} else {
fmt.Fprintf(&buf, "%d", r.ReplicaID)
}
if r.Type == ReplicaType_LEARNER {
if r.GetType() == ReplicaType_LEARNER {
buf.WriteString("LEARNER")
}
return buf.String()
Expand All @@ -286,6 +286,14 @@ func (r ReplicaDescriptor) Validate() error {
return nil
}

// GetType returns the type of this ReplicaDescriptor.
func (r ReplicaDescriptor) GetType() ReplicaType {
if r.Type == nil {
return ReplicaType_VOTER
}
return *r.Type
}

// PercentilesFromData derives percentiles from a slice of data points.
// Sorts the input data if it isn't already sorted.
func PercentilesFromData(data []float64) Percentiles {
Expand Down
Loading

0 comments on commit 5968fa5

Please sign in to comment.