Skip to main content

I am using G-Connector to upsert records into Salesforce. When I run it, it works just fine. Some of my users are not so lucky and they get UNABLE_TO_LOCK_ROW errors for a chunk of the records. 

The number of errors is always clumped to the same number as the import batch size. So if the batch size is set to 10, there will be clumps of records where the error looks like this for those 10 records:

 

UNABLE_TO_LOCK_ROW:unable to obtain exclusive access to this record or 10 records:0015x00002D7fodAAB,0015x00002D7foRAAR,0015x00002D7foiAAB,001f200001svma9AAA,0015x00002D7fovAAB,0015x00002D7fp2AAB,0015x00002D7foxAAB,0015x00002D7foZAAR,0015x00002D7fogAAB,0015x00002D7foSAAR:--

 

These records that are getting locked are the parent records of the ones I am upserting. 

 

I have turned on a Debug log with the levels all turned up to finest, but can't see anything that corresponds to the errors. 

 

How do I figure out what process or flow is triggering these errors?

9 answers
  1. Jan 30, 2023, 2:12 PM

    @Alex Husted : i never used G-Connector but this settings should normally exist if it use BULK API.

     

    : i never used G-Connector but this settings should normally exist if it use BULK API.Ordering your data by parentId is a salesforce recommandation :

    Bulk API

     

    Inserting or updating records through the Bulk API can cause multiple updates on the same parent record at once, because the batches are processed in parallel. For example, if two batches are being processed at the same time and the two of them contain records pointing to the same parent record, one of the batches will attempt to place a lock in the parent record, which can lead to the other batch throwing a "unable to lock row" error as the batch was not able to get a lock within 10 seconds.

     

    To prevent this, you can do either of the following:

    • Reduce the batch size
    • Process the records in Serial mode instead of parallel, that way one batch is processed at a time.
    • Sort main records based on their parent record, to avoid having different child records (with the same parent) in different batches when using parallel mode. 

0/9000