Bulk Api v2 provides successful and failed records in two different files. This means if there are some records failed in between a batch, then we will not be able to correlate those failed records source records.
For ex., let's say you have 10 records out of which rec5, and rec7 failed. Now success file contains record (rec1-rec4, rec6, rec8-rec10) and failed file contains (rec5 and rec7). This completely re-orders the records compared to source record.
If it is operations (involves id), you could use that to correlate source records but for insert and upsert, it is not possible.
I tried to add a dummy field like "external__id" and process the files but batch completely failed because of unrecognized field.
How have you solved this problem?