Don't stop rescheduleLater allocations

When an alloc is due to be rescheduleLater, it goes through the
reconciler twice: once to be ignored with a follow up evals, and once
again when processing the follow up eval where they appear as
rescheduleNow.

Here, we ignore them in the first run and mark them as stopped in second
iteration; rather than stop them twice.
This commit is contained in:
Mahmood Ali
2019-06-13 09:37:18 -04:00
parent c62c246ad9
commit 34a66835db
2 changed files with 6 additions and 12 deletions

View File

@@ -356,7 +356,6 @@ func (a *allocReconciler) computeGroup(group string, all allocSet) bool {
// Create batched follow up evaluations for allocations that are
// reschedulable later and mark the allocations for in place updating
a.handleDelayedReschedules(rescheduleLater, all, tg.Name)
desiredChanges.Stop += uint64(len(rescheduleLater))
// Create a structure for choosing names. Seed with the taken names which is
// the union of untainted and migrating nodes (includes canaries)
@@ -861,11 +860,6 @@ func (a *allocReconciler) handleDelayedReschedules(rescheduleLater []*delayedRes
evals = append(evals, eval)
for _, allocReschedInfo := range rescheduleLater {
a.result.stop = append(a.result.stop, allocStopResult{
alloc: allocReschedInfo.alloc,
statusDescription: allocRescheduled,
})
if allocReschedInfo.rescheduleTime.Sub(nextReschedTime) < batchedFailedAllocWindowSize {
allocIDToFollowupEvalID[allocReschedInfo.allocID] = eval.ID
} else {

View File

@@ -1320,13 +1320,13 @@ func TestReconciler_RescheduleLater_Batch(t *testing.T) {
place: 0,
inplace: 0,
attributeUpdates: 1,
stop: 1,
stop: 0,
desiredTGUpdates: map[string]*structs.DesiredUpdates{
job.TaskGroups[0].Name: {
Place: 0,
InPlaceUpdate: 0,
Ignore: 4,
Stop: 1,
Stop: 0,
},
},
})
@@ -1403,13 +1403,13 @@ func TestReconciler_RescheduleLaterWithBatchedEvals_Batch(t *testing.T) {
place: 0,
inplace: 0,
attributeUpdates: 7,
stop: 7,
stop: 0,
desiredTGUpdates: map[string]*structs.DesiredUpdates{
job.TaskGroups[0].Name: {
Place: 0,
InPlaceUpdate: 0,
Ignore: 10,
Stop: 7,
Stop: 0,
},
},
})
@@ -1568,13 +1568,13 @@ func TestReconciler_RescheduleLater_Service(t *testing.T) {
place: 1,
inplace: 0,
attributeUpdates: 1,
stop: 1,
stop: 0,
desiredTGUpdates: map[string]*structs.DesiredUpdates{
job.TaskGroups[0].Name: {
Place: 1,
InPlaceUpdate: 0,
Ignore: 4,
Stop: 1,
Stop: 0,
},
},
})