diff --git a/CHANGELOG.md b/CHANGELOG.md index 32b59d6ab42d..05fbf8afd56d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ IMPROVEMENTS: * core: Improved job deregistration error logging. [[GH-8745](https://github.com/hashicorp/nomad/issues/8745)] * api: Added support for cancellation contexts to HTTP API. [[GH-8836](https://github.com/hashicorp/nomad/issues/8836)] + * api: Job Register API now permits non-zero initial Version to accommodate multi-region deployments. [[GH-9071](https://github.com/hashicorp/nomad/issues/9071)] * cli: Added `scale` and `scaling-events` subcommands to the `job` command. [[GH-9023](https://github.com/hashicorp/nomad/pull/9023)] * cli: Added `scaling` command for interaction with the scaling API endpoint. [[GH-9025](https://github.com/hashicorp/nomad/pull/9025)] * client: Added support for Azure fingerprinting. [[GH-8979](https://github.com/hashicorp/nomad/issues/8979)] diff --git a/nomad/job_endpoint.go b/nomad/job_endpoint.go index 09deab68640d..a75e9eddc2e4 100644 --- a/nomad/job_endpoint.go +++ b/nomad/job_endpoint.go @@ -327,11 +327,11 @@ func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegis // Submit a multiregion job to other regions (enterprise only). // The job will have its region interpolated. - var existingVersion uint64 + var newVersion uint64 if existingJob != nil { - existingVersion = existingJob.Version + newVersion = existingJob.Version + 1 } - isRunner, err := j.multiregionRegister(args, reply, existingVersion) + isRunner, err := j.multiregionRegister(args, reply, newVersion) if err != nil { return err } diff --git a/nomad/job_endpoint_oss.go b/nomad/job_endpoint_oss.go index c9688f1ce87a..ac43893f4ebe 100644 --- a/nomad/job_endpoint_oss.go +++ b/nomad/job_endpoint_oss.go @@ -16,7 +16,7 @@ func (j *Job) enforceSubmitJob(override bool, job *structs.Job) (error, error) { } // multiregionRegister is used to send a job across multiple regions -func (j *Job) multiregionRegister(args *structs.JobRegisterRequest, reply *structs.JobRegisterResponse, existingVersion uint64) (bool, error) { +func (j *Job) multiregionRegister(args *structs.JobRegisterRequest, reply *structs.JobRegisterResponse, newVersion uint64) (bool, error) { return false, nil } diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index 4e2a2a44ecbb..6bb71382d88e 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -1434,7 +1434,6 @@ func (s *StateStore) upsertJobImpl(index uint64, job *structs.Job, keepVersion b job.CreateIndex = index job.ModifyIndex = index job.JobModifyIndex = index - job.Version = 0 if err := s.setJobStatus(index, txn, job, false, ""); err != nil { return fmt.Errorf("setting job status for %q failed: %v", job.ID, err)