function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hemmhemm 

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.

hemmhemm

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.

hemmhemm

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.

amitashtekaramitashtekar

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.

 

 

.