logstash-output-s3 4.3.6 → 4.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4671860be7ad0735c12ef8f886c157dce2990975a30022a07b9f95cfe5187e3b
4
- data.tar.gz: e17d8f575abcd12968b5a4065be4786f904536aa0e77a2c48854e20ac259ddf3
3
+ metadata.gz: 238e7be91fe40e4fcb80736f3e8d62e76b6f8108be35e5a0c054cb19bb239428
4
+ data.tar.gz: eb0c70181aa21d20b794cd05d2e458b322b10f6e343ae41d96a1e6f49cf85858
5
5
  SHA512:
6
- metadata.gz: 3c20213ce22c85afc5512adb8641aa72c365f0644b42939acd40fb189c846118153523b8de749bb8b19e866faed7c80e870494d61c4f99b1691417f0618fcc8e
7
- data.tar.gz: 046f0d0f0ceaf6cc69c3494348d0e6b867c919be4d1a053b3c1fcbe0fe5591e47a97fd7e71b2606fa0949a72fc807bf1877a73cb4cbdd30bf091d91317c7a261
6
+ metadata.gz: 1194c4ee3defe1104fcc1c68d914c20e2ca2548ba6405960c75d4b398a7cd9949287c3410ead913ff82b5183164c4bd5bf858fe836f94f63654c582efab78ab5
7
+ data.tar.gz: cb135c3b28297db0f5ad90a4f7ab4ba6b8c112574815e38bdccdec685f5caa28ed7636f68569586f71205d651118dad7cc7dd0194786efb59bfb8113fa7d0afb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.3.7
2
+ - Refactor: avoid usage of CHM (JRuby 9.3.4 work-around) [#248](https://github.com/logstash-plugins/logstash-output-s3/pull/248)
3
+
1
4
  ## 4.3.6
2
5
  - Docs: more documentation on restore + temp dir [#236](https://github.com/logstash-plugins/logstash-output-s3/pull/236)
3
6
  * minor logging improvements - use the same path: naming convention
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require "java"
3
- require "concurrent"
3
+ require "concurrent/map"
4
4
  require "concurrent/timer_task"
5
5
  require "logstash/util"
6
6
 
@@ -39,7 +39,7 @@ module LogStash
39
39
  end
40
40
 
41
41
  class FactoryInitializer
42
- include java.util.function.Function
42
+
43
43
  def initialize(tags, encoding, temporary_directory, stale_time)
44
44
  @tags = tags
45
45
  @encoding = encoding
@@ -47,9 +47,10 @@ module LogStash
47
47
  @stale_time = stale_time
48
48
  end
49
49
 
50
- def apply(prefix_key)
50
+ def create_value(prefix_key)
51
51
  PrefixedValue.new(TemporaryFileFactory.new(prefix_key, @tags, @encoding, @temporary_directory), @stale_time)
52
52
  end
53
+
53
54
  end
54
55
 
55
56
  def initialize(tags, encoding, temporary_directory,
@@ -57,7 +58,7 @@ module LogStash
57
58
  sweeper_interval = DEFAULT_STATE_SWEEPER_INTERVAL_SECS)
58
59
  # The path need to contains the prefix so when we start
59
60
  # logtash after a crash we keep the remote structure
60
- @prefixed_factories = java.util.concurrent.ConcurrentHashMap.new
61
+ @prefixed_factories = Concurrent::Map.new
61
62
 
62
63
  @sweeper_interval = sweeper_interval
63
64
 
@@ -67,18 +68,19 @@ module LogStash
67
68
  end
68
69
 
69
70
  def keys
70
- @prefixed_factories.keySet
71
+ @prefixed_factories.keys
71
72
  end
72
73
 
73
74
  def each_files
74
- @prefixed_factories.elements.each do |prefixed_file|
75
+ @prefixed_factories.values.each do |prefixed_file|
75
76
  prefixed_file.with_lock { |factory| yield factory.current }
76
77
  end
77
78
  end
78
79
 
79
80
  # Return the file factory
80
81
  def get_factory(prefix_key)
81
- @prefixed_factories.computeIfAbsent(prefix_key, @factory_initializer).with_lock { |factory| yield factory }
82
+ prefix_val = @prefixed_factories.fetch_or_store(prefix_key) { @factory_initializer.create_value(prefix_key) }
83
+ prefix_val.with_lock { |factory| yield factory }
82
84
  end
83
85
 
84
86
  def get_file(prefix_key)
@@ -95,7 +97,7 @@ module LogStash
95
97
 
96
98
  def remove_stale(k, v)
97
99
  if v.stale?
98
- @prefixed_factories.remove(k, v)
100
+ @prefixed_factories.delete_pair(k, v)
99
101
  v.delete!
100
102
  end
101
103
  end
@@ -104,7 +106,7 @@ module LogStash
104
106
  @stale_sweeper = Concurrent::TimerTask.new(:execution_interval => @sweeper_interval) do
105
107
  LogStash::Util.set_thread_name("S3, Stale factory sweeper")
106
108
 
107
- @prefixed_factories.forEach{|k,v| remove_stale(k,v)}
109
+ @prefixed_factories.each { |k, v| remove_stale(k,v) }
108
110
  end
109
111
 
110
112
  @stale_sweeper.execute
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-s3'
3
- s.version = '4.3.6'
3
+ s.version = '4.3.7'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Sends Logstash events to the Amazon Simple Storage Service"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -89,7 +89,7 @@ describe LogStash::Outputs::S3::FileRepository do
89
89
  it "returns all available keys" do
90
90
  subject.get_file(prefix_key) { |file| file.write("something") }
91
91
  expect(subject.keys).to include(prefix_key)
92
- expect(subject.keys.to_a.size).to eq(1)
92
+ expect(subject.keys.size).to eq(1)
93
93
  end
94
94
 
95
95
  it "clean stale factories" do
@@ -105,9 +105,14 @@ describe LogStash::Outputs::S3::FileRepository do
105
105
 
106
106
  @file_repository.get_file("another-prefix") { |file| file.write("hello") }
107
107
  expect(@file_repository.size).to eq(2)
108
+ sleep 1.2 # allow sweeper to kick in
108
109
  try(10) { expect(@file_repository.size).to eq(1) }
109
110
  expect(File.directory?(path)).to be_falsey
111
+
112
+ sleep 1.5 # allow sweeper to kick in, again
113
+ expect(@file_repository.size).to eq(1)
110
114
  end
115
+
111
116
  end
112
117
 
113
118
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.6
4
+ version: 4.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-14 00:00:00.000000000 Z
11
+ date: 2022-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement