Skip to content

Add transient-error retry to SalesforceBulkOperator#64574

Closed
nagasrisai wants to merge 4 commits intoapache:mainfrom
nagasrisai:feat/salesforce-bulk-transient-retry
Closed

Add transient-error retry to SalesforceBulkOperator#64574
nagasrisai wants to merge 4 commits intoapache:mainfrom
nagasrisai:feat/salesforce-bulk-transient-retry

Conversation

@nagasrisai
Copy link
Copy Markdown
Contributor

@nagasrisai nagasrisai commented Apr 1, 2026

While wrapping up #64519, eladkal pointed to BigQueryInsertJobOperator as a reference for handling transient errors. This is that follow-up.

The problem is that Salesforce Bulk errors live at the record level, not the API level. When Salesforce is under concurrent write load you can get UNABLE_TO_LOCK_ROW back on individual records, but the API call itself succeeded — so you just end up with success=False entries in the result list. There's no built-in way to deal with that today without unwrapping the XCom, filtering for those codes, building a new payload, and calling the operator again yourself.

This adds three optional parameters:

  • max_retries (default 0) — how many times to re-submit records that come back with a transient error. Defaults to zero so existing behaviour is unchanged.
  • retry_delay (default 5.0) — seconds to wait before each retry.
  • transient_error_codes — which Salesforce statusCode values count as transient. Defaults to {"UNABLE_TO_LOCK_ROW", "API_TEMPORARILY_UNAVAILABLE"}.

When retrying, only the failing records are re-submitted, not the whole payload. The retry results slot back into the original positions because Salesforce always returns results in the same order as the input. Permanent errors like INVALID_FIELD are not in the default set and are never retried.

Related to #64519

Introduces max_retries, retry_delay, and transient_error_codes parameters.
When max_retries > 0, records that fail with a transient Salesforce error
(UNABLE_TO_LOCK_ROW, API_TEMPORARILY_UNAVAILABLE by default) are
re-submitted after retry_delay seconds, up to max_retries times.
Only the failed records are re-submitted, not the entire payload.

Related to apache#64519
@nagasrisai nagasrisai closed this Apr 1, 2026
@nagasrisai nagasrisai deleted the feat/salesforce-bulk-transient-retry branch April 1, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant