Merge pull request #5773 from hashicorp/b-revert-planapply-snapshotafter

nomad: revert use of SnapshotAfter in planApply
This commit is contained in:
Michael Schurter
2019-06-04 08:25:21 -07:00
committed by GitHub

View File

@@ -1,7 +1,6 @@
package nomad
import (
"context"
"fmt"
"runtime"
"time"
@@ -100,15 +99,7 @@ func (p *planner) planApply() {
// Snapshot the state so that we have a consistent view of the world
// if no snapshot is available
if waitCh == nil || snap == nil {
// Wait up to 5s for raft to catch up. Timing out
// causes the eval to be nacked and retried on another
// server, so timing out too quickly could cause
// greater scheduling latency than if we just waited
// longer here.
const indexTimeout = 5 * time.Second
ctx, cancel := context.WithTimeout(context.Background(), indexTimeout)
snap, err = p.fsm.State().SnapshotAfter(ctx, p.raft.LastIndex())
cancel()
snap, err = p.fsm.State().Snapshot()
if err != nil {
p.logger.Error("failed to snapshot state", "error", err)
pending.respond(nil, err)