Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude version conflict errors from failure store #112537

Conversation

gmarouli
Copy link
Contributor

@gmarouli gmarouli commented Sep 5, 2024

When indexing to a data stream with a failure store it's possible to get a version conflict. The reproduction path is the following:

PUT /_bulk
{"create":{"_index": "my-ds-with-fs", "_id": "1"}}
{"@timestamp": "2022-01-01", "baz": "quick", "a": "brown", "b": "fox"}
{"create":{"_index": "my-ds-with-fs", "_id": "1"}}
{"@timestamp": "2022-01-01", "baz": "lazy", "a": "dog"}

We would like the second document to not be sent to the failure store and return an error to the user:

{
  "errors" : true,
  "took" : 409,
  "items" : [
    {
      "create" : {
        "_index" : ".ds-my-ds-with-fs-xxxxx-xxxx",
        "_id" : "1",
        "_version" : 1,
        "result" : "created",
        "_shards" : {
          "total" : 2,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 0,
        "_primary_term" : 1,
        "status" : 201
      }
    },
    {
      "create" : {
        "_index" : ".ds-my-ds-with-fs-xxxxx-xxxx",
        "_id" : "1",
        "status" : 409,
        "error" : {
          "type" : "version_conflict_engine_exception",
          "reason" : "[1]: version conflict, document already exists (current version [1])",
          "index_uuid" : ".....",
          "shard" : "0",
          "index" : ".ds-my-ds-with-fs-xxxxx-xxxx"
        }
      }
    }
  ]
}

The version conflict doc is counted as a rejected doc in APM telemetry.

@gmarouli gmarouli added >non-issue :Data Management/Data streams Data streams and their lifecycles labels Sep 5, 2024
@gmarouli gmarouli requested a review from jbaiera September 5, 2024 07:36
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine elasticsearchmachine added Team:Data Management Meta label for data/management team v8.16.0 labels Sep 5, 2024
Copy link
Member

@jbaiera jbaiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gmarouli
Copy link
Contributor Author

gmarouli commented Sep 9, 2024

@elasticmachine upgrade branch

@gmarouli gmarouli added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Sep 9, 2024
@gmarouli
Copy link
Contributor Author

gmarouli commented Sep 9, 2024

@elasticmachine update branch

@elasticsearchmachine elasticsearchmachine merged commit a43ffd5 into elastic:main Sep 9, 2024
15 checks passed
@gmarouli gmarouli deleted the failure-store-no-version-conflict-ES-9036 branch September 9, 2024 10:48
pulak777 pushed a commit to pulak777/elasticsearch that referenced this pull request Sep 9, 2024
When indexing to a data stream with a failure store it's possible to get
a version conflict. The reproduction path is the following:

```
PUT /_bulk
{"create":{"_index": "my-ds-with-fs", "_id": "1"}}
{"@timestamp": "2022-01-01", "baz": "quick", "a": "brown", "b": "fox"}
{"create":{"_index": "my-ds-with-fs", "_id": "1"}}
{"@timestamp": "2022-01-01", "baz": "lazy", "a": "dog"}
```

We would like the second document to not be sent to the failure store
and return an error to the user:

```
{
  "errors" : true,
  "took" : 409,
  "items" : [
    {
      "create" : {
        "_index" : ".ds-my-ds-with-fs-xxxxx-xxxx",
        "_id" : "1",
        "_version" : 1,
        "result" : "created",
        "_shards" : {
          "total" : 2,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 0,
        "_primary_term" : 1,
        "status" : 201
      }
    },
    {
      "create" : {
        "_index" : ".ds-my-ds-with-fs-xxxxx-xxxx",
        "_id" : "1",
        "status" : 409,
        "error" : {
          "type" : "version_conflict_engine_exception",
          "reason" : "[1]: version conflict, document already exists (current version [1])",
          "index_uuid" : ".....",
          "shard" : "0",
          "index" : ".ds-my-ds-with-fs-xxxxx-xxxx"
        }
      }
    }
  ]
}
```

The version conflict doc is counted as a rejected doc in APM telemetry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Data Management/Data streams Data streams and their lifecycles >non-issue Team:Data Management Meta label for data/management team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants