no need to handle duplicate evals anymore
This commit is contained in:
parent
a314744210
commit
f4a921f2be
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue