logstash-plugins / logstash-integration-aws

Apache License 2.0
7 stars 17 forks source link

s3 output: resolve stale-detection races #19

Closed yaauie closed 1 year ago

yaauie commented 1 year ago

This is largely a forward-port of logstash-plugins/logstash-output-s3#252 with some minor changes to deal with the integrated plugin's usage of the java-native ConcurrentHashMap in place of the stand-alone plugin's ruby-native Concurrent::Map.

Refactor of S3::FileRepository to avoid several closely-related race conditions:

Additionally, S3#rotate_if_needed was migrated to use the now-safer S3::FileRepository#each_factory that avoids initializing new factories (and therefore avoids creating empty files on disk after the existing ones had been stale-reaped).