open-nomad/nomad
Michael Schurter 0f8164b2f1 nomad: evaluate plans after previous plan index
The previous commit prevented evaluating plans against a state snapshot
which is older than the snapshot at which the plan was created.  This is
correct and prevents failures trying to retrieve referenced objects that
may not exist until the plan's snapshot. However, this is insufficient
to guarantee consistency if the following events occur:

1. P1, P2, and P3 are enqueued with snapshot @ 100
2. Leader evaluates and applies Plan P1 with snapshot @ 100
3. Leader evaluates Plan P2 with snapshot+P1 @ 100
4. P1 commits @ 101
4. Leader evaluates applies Plan P3 with snapshot+P2 @ 100

Since only the previous plan is optimistically applied to the state
store, the snapshot used to evaluate a plan may not contain the N-2
plan!

To ensure plans are evaluated and applied serially we must consider all
previous plan's committed indexes when evaluating further plans.

Therefore combined with the last PR, the minimum index at which to
evaluate a plan is:

    min(previousPlanResultIndex, plan.SnapshotIndex)
2019-06-24 12:16:46 -07:00
..
deploymentwatcher Merge pull request #5747 from hashicorp/b-test-fixes-20190521-1 2019-06-05 19:09:18 -04:00
drainer Merge pull request #5747 from hashicorp/b-test-fixes-20190521-1 2019-06-05 19:09:18 -04:00
mock goimports 2019-01-22 15:44:31 -08:00
state comment DenormalizeAllocationDiffSlice applies to terminal allocs only 2019-06-12 08:28:43 -04:00
structs nomad: include snapshot index when submitting plans 2019-06-24 12:16:46 -07:00
types
acl.go
acl_endpoint.go server 2018-09-15 16:23:13 -07:00
acl_endpoint_test.go non-Existent -> nonexistent 2018-03-12 11:59:33 -07:00
acl_test.go
alloc_endpoint.go alloc lifecycle: 404 when attempting to stop non-existent allocation 2019-06-20 21:27:22 +00:00
alloc_endpoint_test.go allocs: Add nomad alloc stop 2019-04-23 12:50:23 +02:00
autopilot.go goimports 2019-01-22 15:44:31 -08:00
autopilot_test.go
blocked_evals.go nomad: fix deadlock in UnblockClassAndQuota 2019-05-20 15:41:52 -07:00
blocked_evals_test.go Handle new eval being the duplicate properly 2018-11-12 16:02:23 -08:00
client_alloc_endpoint.go server: server forwarding logic for nomad exec endpoint 2019-05-09 16:49:08 -04:00
client_alloc_endpoint_test.go Run TestClientAllocations_Restart_ACL test 2019-05-17 20:30:23 -04:00
client_fs_endpoint.go server: server forwarding logic for nomad exec endpoint 2019-05-09 16:49:08 -04:00
client_fs_endpoint_test.go convert all config durations to strings in tests 2018-11-13 10:21:40 -05:00
client_rpc.go server 2018-09-15 16:23:13 -07:00
client_rpc_test.go tests: fix usages of TestClient cleanup and mock driver 2018-10-29 14:21:05 -07:00
client_stats_endpoint.go server 2018-09-15 16:23:13 -07:00
client_stats_endpoint_test.go fix tests that fail as a result of async client startup 2018-12-20 00:53:44 -05:00
config.go goimports until make check is happy 2019-01-23 06:27:14 -08:00
core_sched.go Fix panic on failure 2019-01-08 12:19:44 -05:00
core_sched_test.go Don't GC running but desired stop allocations 2018-12-05 13:01:12 -08:00
deployment_endpoint.go server 2018-09-15 16:23:13 -07:00
deployment_endpoint_test.go Fix tests 2018-05-07 14:50:01 -05:00
deployment_watcher_shims.go Fix typos 2018-05-07 14:50:01 -05:00
drainer_int_test.go tests: fix usages of TestClient cleanup and mock driver 2018-10-29 14:21:05 -07:00
drainer_shims.go set node.StatusUpdatedAt in raft 2019-05-21 16:13:32 -04:00
endpoints_oss.go
eval_broker.go nomad: refactor waitForIndex into SnapshotAfter 2019-05-17 13:30:23 -07:00
eval_broker_test.go evalbroker: test for no enqueue on disabled 2019-05-15 11:02:21 +02:00
eval_endpoint.go Update nomad/eval_endpoint.go 2019-03-05 15:19:07 -08:00
eval_endpoint_test.go Update nomad/eval_endpoint_test.go 2019-03-05 15:19:15 -08:00
fsm.go set node.StatusUpdatedAt in raft 2019-05-21 16:13:32 -04:00
fsm_not_ent.go
fsm_registry_oss.go
fsm_test.go Rename to match system scheduler config. 2019-05-03 14:06:12 -05:00
heartbeat.go goimports 2019-01-22 15:44:31 -08:00
heartbeat_test.go goimports 2019-01-22 15:44:31 -08:00
job_endpoint.go Add flag similar to --all for allocs to be able to filter deployments by latest 2019-05-13 18:33:41 -05:00
job_endpoint_oss.go
job_endpoint_test.go Fix test setup to have correct jobcreateindex for deployments 2019-05-13 18:53:47 -05:00
leader.go metrics: add namespace label to allocation metrics 2019-06-17 20:50:26 +00:00
leader_oss.go
leader_test.go Set NextEval when making failed-follow-up evals 2019-02-20 16:07:11 -08:00
merge.go
node_endpoint.go set node.StatusUpdatedAt in raft 2019-05-21 16:13:32 -04:00
node_endpoint_test.go update callers in tests 2019-05-21 21:10:17 -04:00
operator_endpoint.go Add code for plan normalization 2019-04-23 09:18:01 -07:00
operator_endpoint_test.go ensure tests run a 0.9 server 2019-01-29 16:19:45 -06:00
periodic.go fix more cases of logging arity errors 2019-01-09 09:22:47 -05:00
periodic_endpoint.go goimports 2019-01-22 15:44:31 -08:00
periodic_endpoint_test.go test: fix race and nil panic in nomad/ tests 2018-12-19 15:48:02 -08:00
periodic_test.go server 2018-09-15 16:23:13 -07:00
plan_apply.go nomad: evaluate plans after previous plan index 2019-06-24 12:16:46 -07:00
plan_apply_not_ent.go
plan_apply_pool.go
plan_apply_pool_test.go
plan_apply_test.go Change min version required for plan optimization 2019-04-24 12:36:07 -07:00
plan_endpoint.go goimports 2019-01-22 15:44:31 -08:00
plan_endpoint_test.go goimports 2019-01-22 15:44:31 -08:00
plan_normalization_test.go Add comments to functions, and use require instead of assert 2019-04-23 09:57:21 -07:00
plan_queue.go nomad: refactor waitForIndex into SnapshotAfter 2019-05-17 13:30:23 -07:00
plan_queue_test.go
raft_rpc.go
regions_endpoint.go server 2018-09-15 16:23:13 -07:00
regions_endpoint_test.go goimports 2019-01-22 15:44:31 -08:00
rpc.go some changes for more idiomatic code 2018-12-12 23:11:17 +00:00
rpc_test.go backfill region from job hcl in jobUpdate and jobPlan endpoints 2019-06-13 08:03:16 -07:00
search_endpoint.go server 2018-09-15 16:23:13 -07:00
search_endpoint_oss.go
search_endpoint_test.go
serf.go do not bootstrap with non voters 2018-09-19 17:17:39 -07:00
serf_test.go backfill region from job hcl in jobUpdate and jobPlan endpoints 2019-06-13 08:03:16 -07:00
server.go Change interval of raft stats collection to 10s 2019-06-19 11:58:46 -05:00
server_setup_oss.go server 2018-09-15 16:23:13 -07:00
server_test.go backfill region from job hcl in jobUpdate and jobPlan endpoints 2019-06-13 08:03:16 -07:00
stats_fetcher.go server 2018-09-15 16:23:13 -07:00
stats_fetcher_test.go
status_endpoint.go server 2018-09-15 16:23:13 -07:00
status_endpoint_test.go goimports 2019-01-22 15:44:31 -08:00
system_endpoint.go server 2018-09-15 16:23:13 -07:00
system_endpoint_test.go goimports 2019-01-22 15:44:31 -08:00
testing.go goimports until make check is happy 2019-01-23 06:27:14 -08:00
timetable.go
timetable_test.go
util.go Change min version required for plan optimization 2019-04-24 12:36:07 -07:00
util_test.go Add tests for plan normalization 2019-04-23 09:18:01 -07:00
vault.go nomad: refactor waitForIndex into SnapshotAfter 2019-05-17 13:30:23 -07:00
vault_test.go server vault client: use two vault clients, one with namespace, one without for /sys calls 2019-04-10 10:34:10 -05:00
vault_testing.go nomad: refactor waitForIndex into SnapshotAfter 2019-05-17 13:30:23 -07:00
worker.go nomad: include snapshot index when submitting plans 2019-06-24 12:16:46 -07:00
worker_test.go nomad: emit more detailed error 2019-05-17 14:37:42 -07:00