Fix missing summary restoration

This commit is contained in:
Alex Dadgar 2017-02-08 11:51:48 -08:00
parent 5d293c0f1e
commit eaf285b208
1 changed files with 3 additions and 3 deletions

View File

@ -676,7 +676,7 @@ func (n *nomadFSM) Restore(old io.ReadCloser) error {
// summaries if they were not present previously. When users upgrade to 0.5 // summaries if they were not present previously. When users upgrade to 0.5
// from 0.4.1, the snapshot will contain job summaries so it will be safe to // from 0.4.1, the snapshot will contain job summaries so it will be safe to
// remove this block. // remove this block.
index, err := n.state.Index("job_summary") index, err := newState.Index("job_summary")
if err != nil { if err != nil {
return fmt.Errorf("couldn't fetch index of job summary table: %v", err) return fmt.Errorf("couldn't fetch index of job summary table: %v", err)
} }
@ -685,11 +685,11 @@ func (n *nomadFSM) Restore(old io.ReadCloser) error {
// we will have to create them // we will have to create them
if index == 0 { if index == 0 {
// query the latest index // query the latest index
latestIndex, err := n.state.LatestIndex() latestIndex, err := newState.LatestIndex()
if err != nil { if err != nil {
return fmt.Errorf("unable to query latest index: %v", index) return fmt.Errorf("unable to query latest index: %v", index)
} }
if err := n.state.ReconcileJobSummaries(latestIndex); err != nil { if err := newState.ReconcileJobSummaries(latestIndex); err != nil {
return fmt.Errorf("error reconciling summaries: %v", err) return fmt.Errorf("error reconciling summaries: %v", err)
} }
} }