+ Start a Discussion

BatchApexWorker record in the AsyncApexJob object

According to the Apex documentation and, I swear, up until yesterday, a Batch Apex job would create a single record in the AsyncApexJob object with a JobType = 'BatchApex'.  This record would keep track of the job including total batches, errored batches, number processed, status, etc.


Today I started seeing a 2nd record created for a batch job with a JobType = 'BatchApexWorker'.  It seems that this record has a Parent Job Id of the main BatchApex record, but it's this record that tracks the job while it runs.  Once the job completes, the main BatchApex record gets updated.


Is this the plan going forward? When did this change? It's not documented anywhere.  in fact, the docs specifically say to use the BatchApex record.


Did some more research.  This is happening on NA7, but is not happening on NA1.


I think something snuck through in the code where this is occurring on NA7 when it's not supposed to.  NA1 works as the Apex documentation states.


I don't think the issue is that BatchApexWorker records are present.  Rather, it's that the parent record (jobType='BatchApex') is not getting updated with the job stats as the job runs.


I have also observed that two threads of type 'BatchApex' and 'BatchApexWorker' are running if we execute second or more batch immediately after first is Queued.