Skip to content

Commit

Permalink
Merge #24404
Browse files Browse the repository at this point in the history
24404: sql: show KV value on cluster version bump failure r=tschottdorf a=tschottdorf

Touches #24204

Actually I will chalk that issue up to a fluke, so

Fixes #24204.

Release note: None
  • Loading branch information
craig[bot] committed Apr 6, 2018
2 parents 7737c6a + 9cefd89 commit 3043766
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/sql/show_cluster_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,24 @@ func (p *planner) showStateMachineSetting(
// value, and the corresponding sql migration that makes sure
// the above select finds something usually runs pretty quickly
// when the cluster is bootstrapped.
kvRawVal, obj, err := s.Validate(&st.SV, prevRawVal, nil)
kvRawVal, kvObj, err := s.Validate(&st.SV, prevRawVal, nil)
if err != nil {
return errors.Errorf("unable to read existing value: %s", err)
}

// NB: if there is no persisted cluster version yet, this will match
// kvRawVal (which is taken from `st.SV` in this case too).
gossipRawVal := []byte(s.Get(&st.SV))

_, gossipObj, err := s.Validate(&st.SV, gossipRawVal, nil)
if err != nil {
gossipObj = fmt.Sprintf("<error: %s>", err)
}
if !bytes.Equal(gossipRawVal, kvRawVal) {
return errors.Errorf("gossip and KV store disagree about value")
return errors.Errorf("value differs between gossip (%v) and KV (%v); try again later", gossipObj, kvObj)
}

d = tree.NewDString(obj.(fmt.Stringer).String())
d = tree.NewDString(kvObj.(fmt.Stringer).String())
return nil
}); err != nil {
return nil, err
Expand Down

0 comments on commit 3043766

Please sign in to comment.