Skip to content

[BUG] Update with retry_on_conflict stays stuck in an infinite loop when sent as a part of bulk #11152

@raghuvanshraj

Description

@raghuvanshraj

Describe the bug
When an update is sent as a part of bulk, the request stays stuck in an infinite loop in TransportShardBulkAction due to repeated retries. This code pointer is expected to limit the number of retries to retry_on_conflict specified by the user in the bulk request, but the retryCounter in the BulkPrimaryExecutionContext is never incremented in the resetForExecutionForRetry method. In a scenario where there are repeated conflicts for an update, the loop in TransportShardBulkAction remains stuck forever. Note that this same behaviour is not seen when the _update API is invoked and a single document is updated because for the _update API, retries are handled in TransportUpdateAction.

To Reproduce
We need to throw VersionConflictEngineExceptions repeatedly for this to show up. I have created a remote branch on my fork where I have modified the update code to always throw VersionConflictEngineExceptions: https://github.com/raghuvanshraj/OpenSearch/tree/retry-on-conflict-testing

Steps to reproduce the behavior:

  1. Clone the branch linked above
  2. Bring up the opensearch process
  3. Create an index
  4. Ingest a single document on the index
  5. Update the document with the bulk API with retry_on_conflict set in the update request. Sample:
{ "update" : { "_index" : "{{index_name}}", "retry_on_conflict": 3, "_id": "IYGCtIsBspX0Krzt2kus" } }
{ "doc": { "counter": 3 } }

Expected behavior
The expected behavior in this case would be for retry_on_conflict to be honored and for the request to be succeeded/failed gracefully.

Plugins
NA

Screenshots
NA

Host/Environment (please complete the following information):
NA

Additional context
NA

Metadata

Metadata

Assignees

Labels

IndexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions