Skip to content

Commit

Permalink
roachpb: make AdminChangeReplicasRequest.ExpDesc non-nullable
Browse files Browse the repository at this point in the history
Prior to 19.1 AdminChangeReplicas did not take an expected range descriptor
value which allowed for races with other changes to the range descriptor. For
backwards compatibility the expectation was left as an optional field. This
commit completes the migration and makes ExpDesc a required, non-nullable
field. Clients which supply a zero value ExpDesc will now receive an error.

Release note: None
  • Loading branch information
ajwerner committed Jul 12, 2019
1 parent 509baff commit 0a33dca
Show file tree
Hide file tree
Showing 7 changed files with 580 additions and 618 deletions.
6 changes: 0 additions & 6 deletions c-deps/libroach/protos/roachpb/api.pb.cc

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

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

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

2 changes: 1 addition & 1 deletion pkg/internal/client/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ func (b *Batch) adminChangeReplicas(
},
ChangeType: changeType,
Targets: targets,
ExpDesc: &expDesc,
ExpDesc: expDesc,
}
b.appendReqs(req)
b.initResult(1, 0, notRaw, nil)
Expand Down
3 changes: 2 additions & 1 deletion pkg/internal/client/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ func (db *DB) AdminChangeReplicas(
return nil, errors.Errorf("unexpected response of type %T for AdminChangeReplicas",
responses[0].GetInner())
}
return resp.Desc, nil
desc := resp.Desc
return &desc, nil
}

// AdminRelocateRange relocates the replicas for a range onto the specified
Expand Down
Loading

0 comments on commit 0a33dca

Please sign in to comment.