Skip to content

Data Stream may already exist  #43

@anders-swanson

Description

@anders-swanson

Is your feature request related to a problem? Please describe.

Plugin tries to create data stream when it doesn't need to, and data stream may already exist in some scenarios.
If data stream was created between check for data stream and PUT, retry operate would loop until finishing (concurrent execution problem):
https://github.com/fluent/fluent-plugin-opensearch/blob/main/lib/fluent/plugin/out_opensearch_data_stream.rb#L113

Describe the solution you'd like

allow _bulk POST to automatically create data streams matching the index template

Describe alternatives you've considered

N/A

Additional context

Data stream doesn't exist, so it will try to create

2022-03-31 16:28:32 +0000 [info]: #0 [out_all] Specified data stream does not exist. Will be created: <[404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [my-data-stream]","index":"verrazzano-application-hello-helidon","resource.id":"my-data-stream","resource.type":"index_or_alias","index_uuid":"na"}],"type":"index_not_found_exception","reason":"no such index [my-data-stream]","index":"my-data-stream","resource.id":"my-data-streamn","resource.type":"index_or_alias","index_uuid":"na"},"status":404}>

Someone else had created the data stream between 16:28:32 and 16:28:34. Now we get 400 err from opensearch because the data stream is present now.

2022-03-31 16:28:34 +0000 [warn]: #0 [out_all] Could not communicate to OpenSearch, resetting connection and trying again. [400] {"error":{"root_cause":[{"type":"resource_already_exists_exception","reason":"data_stream [my-data-stream] already exists"}],"type":"resource_already_exists_exception","reason":"data_stream [my-data-stream] already exists"},"status":400}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions