Skip to content

Conversation

anders-swanson
Copy link
Contributor

If the OpenSearch backend is unreachable when the plugin starts its initial configuration, it will crash the Fluentd container (see #7).
This PR fixes this by adding a retry mechanism to the configuration step, relying on eventual consistency. I did not add a limit to the retry, as the connection should either eventually work, or there is something wrong in the environment that requires manual intervention.

Signed-off-by: Anders Swanson <anders.swanson@oracle.com>
@anders-swanson anders-swanson force-pushed the retry-config-connection branch from a234277 to e8a37d9 Compare January 20, 2022 17:48
Signed-off-by: Anders Swanson <anders.swanson@oracle.com>
@anders-swanson
Copy link
Contributor Author

@cosmo0920 could you take a look at this? Thank you.

anders-swanson and others added 2 commits January 21, 2022 13:08
Signed-off-by: Anders Swanson <anders.swanson@oracle.com>
Signed-off-by: Hiroshi Hatake <cosmo0920.oucc@gmail.com>
Comment on lines 34 to 43
delay = 1
begin
@data_stream_names = [@data_stream_name]
create_index_template(@data_stream_name, @data_stream_template_name, @host)
create_data_stream(@data_stream_name)
rescue => e
raise Fluent::ConfigError, "Failed to create data stream: <#{@data_stream_name}> #{e.message}"
log.info "Failed to create data stream, will retry in #{delay} second(s): <#{@data_stream_name}> #{e.message}"
sleep(delay)
delay *= 2
retry
Copy link
Collaborator

Choose a reason for hiding this comment

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

Retrying forever is harmful in the current Fluentd core mechanism.
Instead, I've committed another retrying mechanism in 47b4275

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thank you!

@cosmo0920 cosmo0920 merged commit 414c2fe into fluent:main Jan 26, 2022
@anders-swanson anders-swanson deleted the retry-config-connection branch January 26, 2022 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants