diff --git a/nomad/fsm.go b/nomad/fsm.go index 28f12da5f..ca043d4e8 100644 --- a/nomad/fsm.go +++ b/nomad/fsm.go @@ -686,10 +686,7 @@ func (n *nomadFSM) applyUpdateEval(buf []byte, index uint64) interface{} { } func (n *nomadFSM) upsertEvals(index uint64, evals []*structs.Evaluation) error { - if err := n.state.UpsertEvals(index, evals); len(evals) == 1 && err == state.ErrDuplicateEval { - // the request is a duplicate, ignore processing it - return nil - } else if err != nil { + if err := n.state.UpsertEvals(index, evals); err != nil { n.logger.Error("UpsertEvals failed", "error", err) return err } diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index 058237367..eb57f3814 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -2540,19 +2540,6 @@ func (s *StateStore) UpsertEvalsTxn(index uint64, evals []*structs.Evaluation, t return nil } -// ErrDuplicateEval indicates that the eval is already present in state and ought not -// to be reprocessed again. -// -// Such duplication might occur in the background compatibility path in job registration -// or deregistration -var ErrDuplicateEval = fmt.Errorf("eval already exists") - -func isPotentialDuplicateEval(eval *structs.Evaluation) bool { - return eval.Status == structs.EvalStatusPending && - (eval.TriggeredBy == structs.EvalTriggerJobRegister || - eval.TriggeredBy == structs.EvalTriggerPeriodicJob) -} - // nestedUpsertEvaluation is used to nest an evaluation upsert within a transaction func (s *StateStore) nestedUpsertEval(txn *memdb.Txn, index uint64, eval *structs.Evaluation) error { // Lookup the evaluation @@ -2561,10 +2548,6 @@ func (s *StateStore) nestedUpsertEval(txn *memdb.Txn, index uint64, eval *struct return fmt.Errorf("eval lookup failed: %v", err) } - if existing != nil && isPotentialDuplicateEval(eval) { - return ErrDuplicateEval - } - // Update the indexes if existing != nil { eval.CreateIndex = existing.(*structs.Evaluation).CreateIndex