diff --git a/.changelog/26974.txt b/.changelog/26974.txt new file mode 100644 index 00000000000..9e6c078bcb8 --- /dev/null +++ b/.changelog/26974.txt @@ -0,0 +1,3 @@ +```release-note:bug +core: Fixed a bug where GC batch sizes for jobs resulted in excessively large Raft logs +``` diff --git a/nomad/core_sched.go b/nomad/core_sched.go index ca25abcb4fb..ffcf1378728 100644 --- a/nomad/core_sched.go +++ b/nomad/core_sched.go @@ -216,8 +216,10 @@ OUTER: // jobReap contacts the leader and issues a reap on the passed jobs func (c *CoreScheduler) jobReap(jobs []*structs.Job, leaderACL string) error { - // Call to the leader to issue the reap - for _, req := range c.partitionJobReap(jobs, leaderACL, structs.MaxUUIDsPerWriteRequest) { + // Call to the leader to issue the reap with a batch size intended to be + // similar to the GC by batches of UUIDs for evals, allocs, and nodes + // (limited by structs.MaxUUIDsPerWriteRequest) + for _, req := range c.partitionJobReap(jobs, leaderACL, 2048) { var resp structs.JobBatchDeregisterResponse if err := c.srv.RPC(structs.JobBatchDeregisterRPCMethod, req, &resp); err != nil { c.logger.Error("batch job reap failed", "error", err)