I have a batch job that reads records from a table and does some processing. During the execute method, these records are deleted.
This job can, under certain circumstances, be running more than once. I am worried about an instance in which the records that Job #2 is trying to process have been deleted by Job #1.
The question is:
How does the Database.QueryLocator works? Will it attempt to retrieve (or somehow earmark) all the records during the start method or will a quick query be run before each execute method?
If it's the latter, I feel ok about my job. If it's the former, what do you suggest to avoid my scenario?
The question is, will the queryMore potentially get records that have already been deleted?
– Sebastian Kessel Mar 25 '16 at 20:59